Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BLE_API mbed nRF51822
Fork of BLE_Button by
Revision 6:c18ec2f18b33, committed 2015-06-12
- Comitter:
- blinky
- Date:
- Fri Jun 12 16:33:21 2015 +0000
- Parent:
- 5:bf55ff59a71f
- Commit message:
- Blinky sample modifed by blinky.
Changed in this revision
ButtonService.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r bf55ff59a71f -r c18ec2f18b33 ButtonService.h --- a/ButtonService.h Fri Jun 12 15:22:36 2015 +0000 +++ b/ButtonService.h Fri Jun 12 16:33:21 2015 +0000 @@ -44,10 +44,14 @@ public: const static uint16_t BUTTON_SERVICE_UUID = 0xB000; const static uint16_t BUTTON_STATE_CHARACTERISTIC_UUID = 0xB001; + const static uint16_t READWRITE_CHARACTERISTIC_UUID = 0xB002; ButtonServiceB(BLEDevice &_ble, bool buttonPressedInitial) : - ble(_ble), buttonState(BUTTON_STATE_CHARACTERISTIC_UUID, &buttonPressedInitial, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY) { - GattCharacteristic *charTable[] = {&buttonState}; + ble(_ble), + buttonState(BUTTON_STATE_CHARACTERISTIC_UUID, &buttonPressedInitial, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY), + readWrite(READWRITE_CHARACTERISTIC_UUID, 0, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ) { + + GattCharacteristic *charTable[] = {&buttonState, &readWrite}; GattService buttonService(ButtonServiceB::BUTTON_SERVICE_UUID, charTable, sizeof(charTable) / sizeof(GattCharacteristic *)); ble.addService(buttonService); } @@ -59,6 +63,7 @@ private: BLEDevice &ble; ReadOnlyGattCharacteristic<bool> buttonState; + ReadWriteGattCharacteristic<uint8_t> readWrite; }; #endif /* #ifndef __BLE_BUTTON_SERVICE_H__ */