adaptation for bkap
Fork of X_NUCLEO_IDB0XA1 by
Diff: source/BlueNRGGap.cpp
- Branch:
- af1d84618655ed0f9f8f0faa3591ab512645edf7
- Revision:
- 302:ed6f74ab78f9
- Parent:
- 293:5a1f577bf92f
--- 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