From 8d8c10fd433c6a8cc6bd3d41709ed27df2e5d429 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Fri, 31 May 2024 15:12:25 -0400 Subject: [PATCH 1/2] make BLE UUID constants be lowercase, add note about bluez --- src/ble/BleUUID.h | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/ble/BleUUID.h b/src/ble/BleUUID.h index 6470cfe36e8494..74c213fa1ad14f 100644 --- a/src/ble/BleUUID.h +++ b/src/ble/BleUUID.h @@ -95,16 +95,22 @@ constexpr std::pair StringToUUID(const char (&str)[N]) }(); // UUID of CHIP BLE service. +// NOTE: lower-case string seems to be required at least by bluez when +// executing g_variant_lookup_value +// +// BlueZ API https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/org.bluez.Device.rst +// describes ServiceData as "Keys are the UUIDs in string format" however no description +// on actual case required inline constexpr char CHIP_BLE_DESC_SHORT_UUID_STR[] = "2902"; -inline constexpr char CHIP_BLE_SERVICE_SHORT_UUID_STR[] = "FFF6"; -inline constexpr char CHIP_BLE_SERVICE_LONG_UUID_STR[] = "0000FFF6-0000-1000-8000-00805F9B34FB"; -inline constexpr char CHIP_BLE_CHAR_1_UUID_STR[] = "18EE2EF5-263D-4559-959F-4F9C429F9D11"; -inline constexpr char CHIP_BLE_CHAR_2_UUID_STR[] = "18EE2EF5-263D-4559-959F-4F9C429F9D12"; -inline constexpr char CHIP_BLE_CHAR_3_UUID_STR[] = "64630238-8772-45F2-B87D-748A83218F04"; -inline constexpr ChipBleUUID CHIP_BLE_SVC_ID = StringToUUIDConstexpr("0000FFF6-0000-1000-8000-00805F9B34FB"); -inline constexpr ChipBleUUID CHIP_BLE_CHAR_1_UUID = StringToUUIDConstexpr("18EE2EF5-263D-4559-959F-4F9C429F9D11"); -inline constexpr ChipBleUUID CHIP_BLE_CHAR_2_UUID = StringToUUIDConstexpr("18EE2EF5-263D-4559-959F-4F9C429F9D12"); -inline constexpr ChipBleUUID CHIP_BLE_CHAR_3_UUID = StringToUUIDConstexpr("64630238-8772-45F2-B87D-748A83218F04"); +inline constexpr char CHIP_BLE_SERVICE_SHORT_UUID_STR[] = "fff6"; +inline constexpr char CHIP_BLE_SERVICE_LONG_UUID_STR[] = "0000fff6-0000-1000-8000-00805f9b34fb"; +inline constexpr char CHIP_BLE_CHAR_1_UUID_STR[] = "18ee2ef5-263d-4559-959f-4f9c429f9d11"; +inline constexpr char CHIP_BLE_CHAR_2_UUID_STR[] = "18ee2ef5-263d-4559-959f-4f9c429f9d12"; +inline constexpr char CHIP_BLE_CHAR_3_UUID_STR[] = "64630238-8772-45f2-b87d-748a83218f04"; +inline constexpr ChipBleUUID CHIP_BLE_SVC_ID = StringToUUIDConstexpr("0000fff6-0000-1000-8000-00805f9b34fb"); +inline constexpr ChipBleUUID CHIP_BLE_CHAR_1_UUID = StringToUUIDConstexpr("18ee2ef5-263d-4559-959f-4f9c429f9d11"); +inline constexpr ChipBleUUID CHIP_BLE_CHAR_2_UUID = StringToUUIDConstexpr("18ee2ef5-263d-4559-959f-4f9c429f9d12"); +inline constexpr ChipBleUUID CHIP_BLE_CHAR_3_UUID = StringToUUIDConstexpr("64630238-8772-45f2-b87d-748a83218f04"); } /* namespace Ble */ } /* namespace chip */ From 31717b555ac3456e9b1b1baf66c8249c7cb6e13f Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Fri, 31 May 2024 15:22:05 -0400 Subject: [PATCH 2/2] Restyle --- src/ble/BleUUID.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ble/BleUUID.h b/src/ble/BleUUID.h index 74c213fa1ad14f..37e2fdc1180f5e 100644 --- a/src/ble/BleUUID.h +++ b/src/ble/BleUUID.h @@ -98,7 +98,7 @@ constexpr std::pair StringToUUID(const char (&str)[N]) // NOTE: lower-case string seems to be required at least by bluez when // executing g_variant_lookup_value // -// BlueZ API https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/org.bluez.Device.rst +// BlueZ API https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/org.bluez.Device.rst // describes ServiceData as "Keys are the UUIDs in string format" however no description // on actual case required inline constexpr char CHIP_BLE_DESC_SHORT_UUID_STR[] = "2902";