Bluetooth Low Energy enabled device with "Switch" feature, compatible with BlueST Protocol.
Bluetooth Low Energy enabled device with "Switch" feature, compatible with BlueST Protocol.
Revision 6:d00b2e9a016e, committed 2018-08-06
- Comitter:
- Davidroid
- Date:
- Mon Aug 06 09:58:58 2018 +0000
- Parent:
- 5:1651815d2a74
- Commit message:
- Correct Custom Service UUID
Changed in this revision
source/CustomService.h | Show annotated file Show diff for this revision Revisions of this file |
source/main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/source/CustomService.h Thu May 31 19:02:30 2018 +0000 +++ b/source/CustomService.h Mon Aug 06 09:58:58 2018 +0000 @@ -48,7 +48,7 @@ #define SWITCH_DATA_LENGTH (TIMESTAMP_LENGTH + SWITCH_LENGTH) #define SWITCH_DATA_INDEX (TIMESTAMP_LENGTH) -const UUID::LongUUIDBytes_t CUSTOM_SWITCH_SERVICE_UUID = {0x00,0x00,0x00,0x00,0x00,0x01,0x11,0xe1,0xac,0x36,0x00,0x02,0xa5,0xd5,0xc5,0x1b}; +const UUID::LongUUIDBytes_t CUSTOM_SERVICE_UUID = {0x00,0x00,0x00,0x00,0x00,0x01,0x11,0xe1,0x9a,0xb4,0x00,0x02,0xa5,0xd5,0xc5,0x1b}; const UUID::LongUUIDBytes_t CUSTOM_SWITCH_CHARACTERISTIC_UUID = {0x20,0x00,0x00,0x00,0x00,0x01,0x11,0xe1,0xac,0x36,0x00,0x02,0xa5,0xd5,0xc5,0x1b}; class CustomService { @@ -67,7 +67,7 @@ /*GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | */GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY) { GattCharacteristic *char_table[] = {&state_command}; - GattService switch_service(CUSTOM_SWITCH_SERVICE_UUID, char_table, sizeof(char_table) / sizeof(GattCharacteristic *)); + GattService switch_service(CUSTOM_SERVICE_UUID, char_table, sizeof(char_table) / sizeof(GattCharacteristic *)); ble.addService(switch_service); memset (packed_state_command, 0, SWITCH_DATA_LENGTH); }
--- a/source/main.cpp Thu May 31 19:02:30 2018 +0000 +++ b/source/main.cpp Mon Aug 06 09:58:58 2018 +0000 @@ -167,7 +167,7 @@ /* Setup advertising data. */ ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::BREDR_NOT_SUPPORTED | GapAdvertisingData::LE_GENERAL_DISCOVERABLE); - ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_128BIT_SERVICE_IDS, (uint8_t *) CUSTOM_SWITCH_SERVICE_UUID, sizeof(CUSTOM_SWITCH_SERVICE_UUID)); + ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_128BIT_SERVICE_IDS, (uint8_t *) CUSTOM_SERVICE_UUID, sizeof(CUSTOM_SERVICE_UUID)); ble.gap().accumulateScanResponse(GapAdvertisingData::MANUFACTURER_SPECIFIC_DATA, MANUFACTURER_SPECIFIC_DATA, sizeof(MANUFACTURER_SPECIFIC_DATA)); ble.gap().accumulateScanResponse(GapAdvertisingData::COMPLETE_LOCAL_NAME, (const uint8_t *) DEVICE_NAME, sizeof(DEVICE_NAME) - 1); ble.gap().setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);