use UART Service to loopback anything received on the TX characteristic onto the RX.

Dependencies:   BLE_API mbed nRF51822

Fork of BLE_LoopbackUART by 1r1g

Revision:
14:53991aa283ad
Parent:
13:bae1b6012907
--- 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);