simple project to control mirrorless camera
Dependencies: mbed BLE_API nRF51822
Diff: bleservices/ServicePower.h
- Revision:
- 2:ed001667a2b6
- Parent:
- 1:0932324a41f7
- Child:
- 3:38ec35b54db8
--- a/bleservices/ServicePower.h Wed Oct 21 21:43:58 2015 +0000 +++ b/bleservices/ServicePower.h Thu Oct 22 09:08:15 2015 +0000 @@ -6,6 +6,15 @@ #include "Light.h" #include "FlashStore.h" +#define UUID_POWER(FIRST, SECOND) {\ +0xd4, 0x9f, FIRST, SECOND, 0xce,0xb2, 0x4c, 0x39, 0xa4, 0xea,\ +0x85, 0xfa, 0xfa, 0xae, 0x22, 0xbf\ +} + +static const uint8_t UUID_power_service[] = UUID_POWER(0x20, 0x80); +static const uint8_t UUID_power_value_char[] = UUID_POWER(0x20, 0x81); +static const uint8_t UUID_power_state_char[] = UUID_POWER(0x20, 0x82); + class ServicePower { public: @@ -15,8 +24,8 @@ Power(_Power), dayLight(_dayLight), Store(_Store), - valueCharacteristic(GattCharacteristic::UUID_USER_CONTROL_HUMIDITY, &powerValue, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY), - stateCharacteristic(GattCharacteristic::UUID_USER_CONTROL_POINT, &powerState) + valueCharacteristic(UUID_power_value_char, &powerValue, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY), + stateCharacteristic(UUID_power_state_char, &powerState) { setupService(); } @@ -35,7 +44,7 @@ protected: void setupService(void) { GattCharacteristic *characteristics[] = {&stateCharacteristic, &valueCharacteristic}; - GattService powerService(GattService::UUID_SCAN_PARAMETERS_SERVICE, characteristics, sizeof(characteristics) / sizeof(GattCharacteristic *)); + GattService powerService(UUID_power_service, characteristics, sizeof(characteristics) / sizeof(GattCharacteristic *)); powerState = false; powerValue = 0.0;