Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added get/set methods for advertisement payload and parameters. #42

Merged
merged 2 commits into from
May 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 0 additions & 4 deletions public/GapAdvertisingParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,6 @@ class GapAdvertisingParams {
AdvertisingType _advType;
uint16_t _interval;
uint16_t _timeout;

private:
/* disallow copy constructor */
GapAdvertisingParams(const GapAdvertisingParams &);
};

#endif // ifndef __GAP_ADVERTISING_PARAMS_H__