Lancaster University's fork of the mbed BLE API. Lives on github, https://github.com/lancaster-university/BLE_API
Dependents: microbit-dal microbit-dal microbit-ble-open microbit-dal ... more
Fork of BLE_API by
Diff: ble/services/UARTService.h
- Revision:
- 727:1a1f5c5aedfe
- Parent:
- 723:71507679c9b2
- Child:
- 728:997ba5e7b3b6
diff -r 6884e374e2eb -r 1a1f5c5aedfe ble/services/UARTService.h --- a/ble/services/UARTService.h Thu Jul 02 09:06:12 2015 +0100 +++ b/ble/services/UARTService.h Mon Jul 06 10:10:34 2015 +0100 @@ -41,7 +41,8 @@ class UARTService { public: /**< Maximum length of data (in bytes) that can be transmitted by the UART service module to the peer. */ - static const unsigned BLE_UART_SERVICE_MAX_DATA_LEN = (BLE_GATT_MTU_SIZE_DEFAULT - 3); + static const unsigned GATT_MTU_SIZE_DEFAULT = 23; + static const unsigned BLE_UART_SERVICE_MAX_DATA_LEN = (GATT_MTU_SIZE_DEFAULT - 3); public: @@ -117,7 +118,7 @@ if ((sendBufferIndex == BLE_UART_SERVICE_MAX_DATA_LEN) || // (sendBuffer[sendBufferIndex - 1] == '\r') || (sendBuffer[sendBufferIndex - 1] == '\n')) { - ble.gattServer().write(getRXCharacteristicHandle(), static_cast<const uint8_t *>(sendBuffer), sendBufferIndex); + ble.updateCharacteristicValue(getRXCharacteristicHandle(), static_cast<const uint8_t *>(sendBuffer), sendBufferIndex); sendBufferIndex = 0; } } @@ -159,7 +160,7 @@ return receiveBuffer[receiveBufferIndex++]; } -protected: +private: /** * This callback allows the UART service to receive updates to the * txCharacteristic. The application should forward the call to this @@ -177,7 +178,7 @@ } } -protected: +private: BLE &ble; uint8_t receiveBuffer[BLE_UART_SERVICE_MAX_DATA_LEN]; /**< The local buffer into which we receive