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_notifications_with_orig_mbed by
Diff: ButtonService.h
- Revision:
- 6:18d8750f39ee
- Parent:
- 1:7202df456146
- Child:
- 13:d4448d59ab69
--- a/ButtonService.h Sat Jun 20 00:00:32 2015 +0000
+++ b/ButtonService.h Sat Jun 20 23:52:29 2015 +0000
@@ -22,20 +22,20 @@
const static uint16_t BUTTON_SERVICE_UUID = 0xA000;
const static uint16_t BUTTON_STATE_CHARACTERISTIC_UUID = 0xA001;
- ButtonService(BLEDevice &_ble, bool buttonPressedInitial) :
+ ButtonService(BLE &_ble, bool buttonPressedInitial) :
ble(_ble), buttonState(BUTTON_STATE_CHARACTERISTIC_UUID, &buttonPressedInitial, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY)
{
GattCharacteristic *charTable[] = {&buttonState};
GattService buttonService(ButtonService::BUTTON_SERVICE_UUID, charTable, sizeof(charTable) / sizeof(GattCharacteristic *));
- ble.addService(buttonService);
+ ble.gattServer().addService(buttonService);
}
void updateButtonState(bool newState) {
- ble.updateCharacteristicValue(buttonState.getValueHandle(), (uint8_t *)&newState, sizeof(bool));
+ ble.gattServer().write(buttonState.getValueHandle(), (uint8_t *)&newState, sizeof(bool));
}
private:
- BLEDevice &ble;
+ BLE &ble;
ReadOnlyGattCharacteristic<bool> buttonState;
};
