Added get/set methods for advPayload and advParams.

This commit is contained in:
Marcus Chang 2015-05-18 19:40:17 +01:00
parent 6d3b65391e
commit 8c39703246

View file

@ -135,6 +135,12 @@ public:
*/
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
@ -145,6 +151,17 @@ public:
*/
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().
@ -679,6 +696,12 @@ BLEDevice::setAdvertisingParams(const GapAdvertisingParams &newAdvParams)
advParams = newAdvParams;
}
inline GapAdvertisingParams
BLEDevice::getAdvertisingParams(void)
{
return advParams;
}
inline void
BLEDevice::clearAdvertisingPayload(void)
{
@ -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)
{