use UART Service to loopback anything received on the TX characteristic onto the RX.
Dependencies: BLE_API mbed nRF51822
Fork of BLE_LoopbackUART by
Revision 14:53991aa283ad, committed 2015-08-11
- Comitter:
- jensstruemper
- Date:
- Tue Aug 11 15:04:44 2015 +0000
- Parent:
- 13:bae1b6012907
- Commit message:
- make changes to comply with BLE_API release 0.4
Changed in this revision
BLE_API.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r bae1b6012907 -r 53991aa283ad BLE_API.lib --- a/BLE_API.lib Mon Aug 10 14:44:51 2015 +0000 +++ b/BLE_API.lib Tue Aug 11 15:04:44 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/teams/Bluetooth-Low-Energy/code/BLE_API/#6cf1407e6620 +http://mbed.org/teams/Bluetooth-Low-Energy/code/BLE_API/#920101117187
diff -r bae1b6012907 -r 53991aa283ad main.cpp --- a/main.cpp Mon Aug 10 14:44:51 2015 +0000 +++ b/main.cpp Tue Aug 11 15:04:44 2015 +0000 @@ -40,9 +40,9 @@ ble.startAdvertising(); } -void onDataWritten(const GattCharacteristicWriteParams *params) +void onDataWritten(const GattWriteCallbackParams *params) { - if ((uartServicePtr != NULL) && (params->charHandle == uartServicePtr->getTXCharacteristicHandle())) { + if ((uartServicePtr != NULL) && (params->handle == uartServicePtr->getTXCharacteristicHandle())) { uint16_t bytesRead = params->len; DEBUG("received %u bytes\n\r", bytesRead); ble.updateCharacteristicValue(uartServicePtr->getRXCharacteristicHandle(), params->data, bytesRead); @@ -73,7 +73,7 @@ ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_128BIT_SERVICE_IDS, (const uint8_t *)UARTServiceUUID_reversed, sizeof(UARTServiceUUID_reversed)); - ble.setAdvertisingInterval(Gap::MSEC_TO_ADVERTISEMENT_DURATION_UNITS(1000)); + ble.setAdvertisingInterval(Gap::MSEC_TO_GAP_DURATION_UNITS(1000)); ble.startAdvertising(); UARTService uartService(ble);