Workings and tests to create custom GATT services, for use as part of peripheral communication in cars
Dependencies: BLE_API mbed nRF51822
Diff: BroadcasterService.h
- Revision:
- 10:2c5c202c69a5
- Parent:
- 9:0ed64b14d46b
- Child:
- 12:f5b12e8b6043
--- a/BroadcasterService.h Thu Mar 12 12:52:26 2015 +0000 +++ b/BroadcasterService.h Sun Mar 22 17:47:11 2015 +0000 @@ -5,7 +5,7 @@ /** * @class BroadcasterService -* @brief Based heavily on the BLE Battery Service, the aim is to send key, pair values <br> +* @brief Based heavily on the BLE Battery Service, the aim is to send key, pair values <br>. UPDATE: Should now be sending 8-byte string - 4 bytes for */ class BroadcasterService { @@ -27,8 +27,7 @@ GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | // GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY) { - - + static bool serviceAdded = false; /* We should only ever need to add the service once. */ if (serviceAdded) { return; @@ -48,9 +47,9 @@ */ void sendCommand(uint8_t _newCommand[8]) { // command = _newCommand; - + memcpy(command, _newCommand, sizeof(_newCommand)); - ble.updateCharacteristicValue(broadcasterCharacteristic.getValueAttribute().getHandle(), command, 8, false); + ble.updateCharacteristicValue(broadcasterCharacteristic.getValueAttribute().getHandle(), command, sizeof(command), false); } private: