Skip to content

Commit

Permalink
Added get/set methods for advPayload and advParams.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcus Chang committed May 18, 2015
1 parent 6d3b653 commit 8c39703
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions public/BLEDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ class BLEDevice
*/
void setAdvertisingParams(const GapAdvertisingParams &advParams);

/**
* @return Read back advertising parameters. Useful for storing and
* restoring parameters rapidly.
*/
GapAdvertisingParams getAdvertisingParams(void);

/**
* This API is typically used as an internal helper to udpate the transport
* backend with advertising data before starting to advertise. It may also
Expand All @@ -145,6 +151,17 @@ class BLEDevice
*/
ble_error_t setAdvertisingPayload(void);

/**
* Set advertising data using object.
*/
ble_error_t setAdvertisingData(const GapAdvertisingData &advData);

/**
* @return Read back advertising data. Useful for storing and
* restoring payload.
*/
GapAdvertisingData getAdvertisingData(void);

/**
* Reset any advertising payload prepared from prior calls to
* accumulateAdvertisingPayload().
Expand Down Expand Up @@ -679,6 +696,12 @@ BLEDevice::setAdvertisingParams(const GapAdvertisingParams &newAdvParams)
advParams = newAdvParams;
}

inline GapAdvertisingParams
BLEDevice::getAdvertisingParams(void)
{
return advParams;
}

inline void
BLEDevice::clearAdvertisingPayload(void)
{
Expand Down Expand Up @@ -738,6 +761,19 @@ BLEDevice::setAdvertisingPayload(void) {
return transport->getGap().setAdvertisingData(advPayload, scanResponse);
}

inline ble_error_t
BLEDevice::setAdvertisingData(const GapAdvertisingData& newPayload)
{
advPayload = newPayload;

return setAdvertisingPayload();
}

inline GapAdvertisingData
BLEDevice::getAdvertisingData(void) {
return advPayload;
}

inline ble_error_t
BLEDevice::startAdvertising(void)
{
Expand Down

0 comments on commit 8c39703

Please sign in to comment.