Merge Marcus's work on accessors to advertising payload and params.

This commit is contained in:
Rohit Grover 2015-05-19 09:51:03 +01:00
commit 01ffebdc80
2 changed files with 36 additions and 4 deletions

View file

@ -135,6 +135,12 @@ public:
*/
void setAdvertisingParams(const GapAdvertisingParams &advParams);
/**
* @return Read back advertising parameters. Useful for storing and
* restoring parameters rapidly.
*/
const GapAdvertisingParams &getAdvertisingParams(void) const;
/**
* 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.
*/
const GapAdvertisingData &getAdvertisingData(void) const;
/**
* Reset any advertising payload prepared from prior calls to
* accumulateAdvertisingPayload().
@ -679,6 +696,12 @@ BLEDevice::setAdvertisingParams(const GapAdvertisingParams &newAdvParams)
advParams = newAdvParams;
}
inline const GapAdvertisingParams &
BLEDevice::getAdvertisingParams(void) const
{
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 const GapAdvertisingData &
BLEDevice::getAdvertisingData(void) const {
return advPayload;
}
inline ble_error_t
BLEDevice::startAdvertising(void)
{

View file

@ -106,10 +106,6 @@ private:
AdvertisingType _advType;
uint16_t _interval;
uint16_t _timeout;
private:
/* disallow copy constructor */
GapAdvertisingParams(const GapAdvertisingParams &);
};
#endif // ifndef __GAP_ADVERTISING_PARAMS_H__