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:
- 728:997ba5e7b3b6
- Parent:
- 727:1a1f5c5aedfe
- Child:
- 843:7d22b29f91bf
diff -r 1a1f5c5aedfe -r 997ba5e7b3b6 ble/services/UARTService.h --- a/ble/services/UARTService.h Mon Jul 06 10:10:34 2015 +0100 +++ b/ble/services/UARTService.h Mon Jul 06 10:10:34 2015 +0100 @@ -41,8 +41,7 @@ class UARTService { public: /**< Maximum length of data (in bytes) that can be transmitted by the UART service module to the peer. */ - static const unsigned GATT_MTU_SIZE_DEFAULT = 23; - static const unsigned BLE_UART_SERVICE_MAX_DATA_LEN = (GATT_MTU_SIZE_DEFAULT - 3); + static const unsigned BLE_UART_SERVICE_MAX_DATA_LEN = (BLE_GATT_MTU_SIZE_DEFAULT - 3); public: @@ -118,7 +117,7 @@ if ((sendBufferIndex == BLE_UART_SERVICE_MAX_DATA_LEN) || // (sendBuffer[sendBufferIndex - 1] == '\r') || (sendBuffer[sendBufferIndex - 1] == '\n')) { - ble.updateCharacteristicValue(getRXCharacteristicHandle(), static_cast<const uint8_t *>(sendBuffer), sendBufferIndex); + ble.gattServer().write(getRXCharacteristicHandle(), static_cast<const uint8_t *>(sendBuffer), sendBufferIndex); sendBufferIndex = 0; } } @@ -160,7 +159,7 @@ return receiveBuffer[receiveBufferIndex++]; } -private: +protected: /** * This callback allows the UART service to receive updates to the * txCharacteristic. The application should forward the call to this @@ -178,7 +177,7 @@ } } -private: +protected: BLE &ble; uint8_t receiveBuffer[BLE_UART_SERVICE_MAX_DATA_LEN]; /**< The local buffer into which we receive