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: SDFileSystem circular_buffer MPU6050 SoftSerial
Diff: source/ButtonService.h
- Revision:
- 3:b2087af18efe
- Parent:
- 0:a4de55cab4e2
- Child:
- 4:147bbe6f9626
--- a/source/ButtonService.h Wed Feb 01 11:23:59 2017 +0000
+++ b/source/ButtonService.h Wed Jun 21 16:00:36 2017 +0000
@@ -21,11 +21,13 @@
public:
const static uint16_t BUTTON_SERVICE_UUID = 0xA000;
const static uint16_t BUTTON_STATE_CHARACTERISTIC_UUID = 0xA001;
+ const static uint16_t INTERRUPT_STATE_CHARACTERISTIC_UUID = 0xA002;
ButtonService(BLE &_ble, float buttonPressedInitial) :
- ble(_ble), buttonState(BUTTON_STATE_CHARACTERISTIC_UUID, &buttonPressedInitial, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY)
+ ble(_ble), buttonState(BUTTON_STATE_CHARACTERISTIC_UUID, &buttonPressedInitial, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY),
+ interruptState(INTERRUPT_STATE_CHARACTERISTIC_UUID, &interruptInitial, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY)
{
- GattCharacteristic *charTable[] = {&buttonState};
+ GattCharacteristic *charTable[] = {&buttonState,&interruptState};
GattService buttonService(ButtonService::BUTTON_SERVICE_UUID, charTable, sizeof(charTable) / sizeof(GattCharacteristic *));
ble.gattServer().addService(buttonService);
}
@@ -34,10 +36,15 @@
ble.gattServer().write(buttonState.getValueHandle(), (uint8_t *)&newState, sizeof(float));
}
+
+ void updateInterruptState(float newState) {
+ ble.gattServer().write(interruptState.getValueHandle(), (uint8_t *)&newState, sizeof(float));
+ }
private:
BLE &ble;
ReadOnlyGattCharacteristic<float> buttonState;
+ ReadOnlyGattCharacteristic<float> interruptState;
};
#endif /* #ifndef __BLE_BUTTON_SERVICE_H__ */
\ No newline at end of file