Locator beacon firmware
Dependencies: BLE_API mbed nRF51822
Fork of WeatherStation by
_LampService.h@9:dd7ba1fdae47, 2017-04-29 (annotated)
- Committer:
- sycorax
- Date:
- Sat Apr 29 16:33:11 2017 +0000
- Revision:
- 9:dd7ba1fdae47
- Parent:
- 7:8fa805941074
NON CONNECTABLE
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
PostaL | 6:dc269cf4f951 | 1 | #include "ble/BLE.h" |
PostaL | 6:dc269cf4f951 | 2 | |
PostaL | 6:dc269cf4f951 | 3 | class LampService { |
PostaL | 6:dc269cf4f951 | 4 | public: |
PostaL | 6:dc269cf4f951 | 5 | typedef uint8_t LightLevel_t; |
PostaL | 6:dc269cf4f951 | 6 | WriteOnlyGattCharacteristic<LightLevel_t> lightLevelCharacteristic; |
PostaL | 6:dc269cf4f951 | 7 | |
PostaL | 6:dc269cf4f951 | 8 | LampService(BLE& _ble) : |
PostaL | 6:dc269cf4f951 | 9 | ble(_ble), |
PostaL | 6:dc269cf4f951 | 10 | lightLevelCharacteristic(0x2A58, &lightLevel) |
PostaL | 6:dc269cf4f951 | 11 | { |
PostaL | 6:dc269cf4f951 | 12 | GattCharacteristic *charTable[] = { &lightLevelCharacteristic }; |
PostaL | 6:dc269cf4f951 | 13 | GattService lampService(0x2600, charTable, sizeof(charTable) / sizeof(GattCharacteristic *)); |
PostaL | 6:dc269cf4f951 | 14 | ble.gattServer().addService(lampService); |
PostaL | 6:dc269cf4f951 | 15 | } |
PostaL | 6:dc269cf4f951 | 16 | private: |
PostaL | 6:dc269cf4f951 | 17 | BLE& ble; |
PostaL | 6:dc269cf4f951 | 18 | |
PostaL | 6:dc269cf4f951 | 19 | LightLevel_t lightLevel; |
PostaL | 6:dc269cf4f951 | 20 | }; |