bluetooth control motor
Dependents: BLE_LED_IDB0XA1_demo MOTOR_BLE_V2 Motor_Ble_v1 Motor_Ble_v10223 ... more
Fork of X_NUCLEO_IDB0XA1 by
Revision 303:fb52f2a212d2, committed 2016-09-15
- Comitter:
- Vincent Coubard
- Date:
- Thu Sep 15 10:52:12 2016 +0100
- Branch:
- sync_with_github
- Parent:
- 301:9c0d8f9382c7
- Parent:
- 302:ed6f74ab78f9
- Child:
- 304:e92f264aa731
- Commit message:
- Sync with a5d5d0b558395110a5c2edd398a167b1a70e7c99
Merge af1d84618655ed0f9f8f0faa3591ab512645edf7 into 6781fbb835912132d7fed0d78606c7090ae03959
2016-08-04 16:53:42+01:00: Vincent Coubard
Merge pull request #12 from ARMmbed/update_advertisement_paylod_while_advertising
Report changes in advertisement payload and scan response to the shield
Changed in this revision
--- a/source/BlueNRGGap.cpp Thu Sep 15 10:52:09 2016 +0100 +++ b/source/BlueNRGGap.cpp Thu Sep 15 10:52:12 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