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.
Dependents: BLE_HeartRate_IDB0XA1_EPUDEE_Avril2018
Fork of X_NUCLEO_IDB0XA1 by
Revision 302:ed6f74ab78f9, committed 2016-09-15
- Comitter:
- Vincent Coubard
- Date:
- Thu Sep 15 10:52:11 2016 +0100
- Branch:
- af1d84618655ed0f9f8f0faa3591ab512645edf7
- Parent:
- 301:9c0d8f9382c7
- Child:
- 303:fb52f2a212d2
- Commit message:
- Sync with af1d84618655ed0f9f8f0faa3591ab512645edf7
2016-08-04 16:23:47+01:00: Vincent Coubard
Report changes in advertisement payload and scan response to the shield
if the shield is already advertising.
Changed in this revision
| source/BlueNRGGap.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/source/BlueNRGGap.cpp Thu Sep 15 10:52:09 2016 +0100
+++ b/source/BlueNRGGap.cpp Thu Sep 15 10:52:11 2016 +0100
@@ -43,7 +43,7 @@
#include "mbed-drivers/mbed.h"
#else
#include "mbed.h"
-#endif
+#endif
#include "ble_payload.h"
#include "ble_utils.h"
#include "ble_debug.h"
@@ -162,6 +162,27 @@
}
+ // update the advertising data in the shield if advertising is running
+ if (state.advertising == 1) {
+ tBleStatus ret = hci_le_set_scan_resp_data(scanResponse.getPayloadLen(), scanResponse.getPayload());
+
+ if(BLE_STATUS_SUCCESS != ret) {
+ PRINTF(" error while setting scan response data (ret=0x%x)\n", ret);
+ switch (ret) {
+ case BLE_STATUS_TIMEOUT:
+ return BLE_STACK_BUSY;
+ default:
+ return BLE_ERROR_UNSPECIFIED;
+ }
+ }
+
+ ret = hci_le_set_advertising_data(advData.getPayloadLen(), advData.getPayload());
+ if (ret) {
+ PRINTF("error while setting the payload\r\n");
+ return BLE_ERROR_UNSPECIFIED;
+ }
+ }
+
_advData = advData;
_scanResponse = scanResponse;
@@ -1423,4 +1444,4 @@
void BlueNRGGap::setGapRole(Role_t role)
{
gapRole = role;
-}
+}
\ No newline at end of file
