Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of MaximBLE by
Revision 1:4e764337d5c5, committed 2016-03-22
- Comitter:
- kgills
- Date:
- Tue Mar 22 18:16:10 2016 +0000
- Parent:
- 0:b562096246b3
- Commit message:
- Caching the advertising data and scan response.
Changed in this revision
MaximGap.cpp | Show annotated file Show diff for this revision Revisions of this file |
MaximGap.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/MaximGap.cpp Thu Mar 03 14:13:21 2016 +0000 +++ b/MaximGap.cpp Tue Mar 22 18:16:10 2016 +0000 @@ -52,9 +52,11 @@ return BLE_ERROR_PARAM_OUT_OF_RANGE; } - /* set advertising and scan response data for discoverable mode */ - DmAdvSetData(DM_DATA_LOC_ADV, advData.getPayloadLen(), (uint8_t*)advData.getPayload()); - DmAdvSetData(DM_DATA_LOC_SCAN, scanResponse.getPayloadLen(), (uint8_t*)scanResponse.getPayload()); + /* save advertising and scan response data */ + advDataLen = advData.getPayloadLen(); + scanResponseLen = scanResponse.getPayloadLen(); + memcpy((void*)advDataCache, (void*)advData.getPayload(), advDataLen); + memcpy((void*)advDataCache, (void*)advData.getPayload(), scanResponseLen); return BLE_ERROR_NONE; } @@ -94,6 +96,10 @@ return BLE_ERROR_PARAM_OUT_OF_RANGE; } + /* set advertising and scan response data for discoverable mode */ + DmAdvSetData(DM_DATA_LOC_ADV, advDataLen, advDataCache); + DmAdvSetData(DM_DATA_LOC_SCAN, scanResponseLen, scanResponseCache); + DmAdvSetInterval(params.getInterval(), params.getInterval()); DmAdvStart(params.getAdvertisingType(), params.getTimeout());
--- a/MaximGap.h Thu Mar 03 14:13:21 2016 +0000 +++ b/MaximGap.h Tue Mar 22 18:16:10 2016 +0000 @@ -102,6 +102,11 @@ MaximGap(MaximGap const &); void operator=(MaximGap const &); + + uint8_t advDataCache[HCI_LEN_LE_SET_ADV_DATA]; + uint8_t scanResponseCache[HCI_LEN_LE_SET_SCAN_RESP_DATA]; + int advDataLen; + int scanResponseLen; }; #endif /* _MAXIM_GAP_H_ */