Skip to content

Commit 2331332

Browse files
committed
Remove strings from tizen and linux platform
1 parent d09c41e commit 2331332

File tree

5 files changed

+12
-27
lines changed

5 files changed

+12
-27
lines changed

src/platform/Linux/bluez/BluezConnection.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ CHIP_ERROR BluezConnection::Init(const BluezEndpoint & aEndpoint)
9494
if (service != nullptr)
9595
{
9696
if ((BluezIsServiceOnDevice(service, mDevice.get())) == TRUE &&
97-
(strcmp(bluez_gatt_service1_get_uuid(service), CHIP_BLE_UUID_SERVICE_STRING) == 0))
97+
(strcmp(bluez_gatt_service1_get_uuid(service), Ble::CHIP_BLE_SERVICE_LONG_UUID_STR) == 0))
9898
{
9999
mService.reset(service);
100100
break;
@@ -111,18 +111,18 @@ CHIP_ERROR BluezConnection::Init(const BluezEndpoint & aEndpoint)
111111
if (char1 != nullptr)
112112
{
113113
if ((BluezIsCharOnService(char1, mService.get()) == TRUE) &&
114-
(strcmp(bluez_gatt_characteristic1_get_uuid(char1), CHIP_PLAT_BLE_UUID_C1_STRING) == 0))
114+
(strcmp(bluez_gatt_characteristic1_get_uuid(char1), Ble::CHIP_BLE_CHAR_1_UUID_STR) == 0))
115115
{
116116
mC1.reset(char1);
117117
}
118118
else if ((BluezIsCharOnService(char1, mService.get()) == TRUE) &&
119-
(strcmp(bluez_gatt_characteristic1_get_uuid(char1), CHIP_PLAT_BLE_UUID_C2_STRING) == 0))
119+
(strcmp(bluez_gatt_characteristic1_get_uuid(char1), Ble::CHIP_BLE_CHAR_2_UUID_STR) == 0))
120120
{
121121
mC2.reset(char1);
122122
}
123123
#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING
124124
else if ((BluezIsCharOnService(char1, mService.get()) == TRUE) &&
125-
(strcmp(bluez_gatt_characteristic1_get_uuid(char1), CHIP_PLAT_BLE_UUID_C3_STRING) == 0))
125+
(strcmp(bluez_gatt_characteristic1_get_uuid(char1), Ble::CHIP_BLE_CHAR_3_UUID_STR) == 0))
126126
{
127127
mC3.reset(char1);
128128
}

src/platform/Linux/bluez/BluezEndpoint.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -438,10 +438,10 @@ void BluezEndpoint::SetupGattService()
438438
static const char * const c3_flags[] = { "read", nullptr };
439439
#endif
440440

441-
mService.reset(CreateGattService(CHIP_BLE_UUID_SERVICE_SHORT_STRING));
441+
mService.reset(CreateGattService(Ble::CHIP_BLE_SERVICE_SHORT_UUID_STR));
442442

443443
// C1 characteristic
444-
mC1.reset(CreateGattCharacteristic(mService.get(), "c1", CHIP_PLAT_BLE_UUID_C1_STRING, c1_flags));
444+
mC1.reset(CreateGattCharacteristic(mService.get(), "c1", Ble::CHIP_BLE_CHAR_1_UUID_STR, c1_flags));
445445
g_signal_connect(mC1.get(), "handle-read-value",
446446
G_CALLBACK(+[](BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInv, GVariant * aOpt,
447447
BluezEndpoint * self) { return self->BluezCharacteristicReadValue(aChar, aInv, aOpt); }),
@@ -455,7 +455,7 @@ void BluezEndpoint::SetupGattService()
455455
g_signal_connect(mC1.get(), "handle-confirm", G_CALLBACK(BluezCharacteristicConfirmError), nullptr);
456456

457457
// C2 characteristic
458-
mC2.reset(CreateGattCharacteristic(mService.get(), "c2", CHIP_PLAT_BLE_UUID_C2_STRING, c2_flags));
458+
mC2.reset(CreateGattCharacteristic(mService.get(), "c2", Ble::CHIP_BLE_CHAR_2_UUID_STR, c2_flags));
459459
g_signal_connect(mC2.get(), "handle-read-value",
460460
G_CALLBACK(+[](BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInv, GVariant * aOpt,
461461
BluezEndpoint * self) { return self->BluezCharacteristicReadValue(aChar, aInv, aOpt); }),
@@ -478,7 +478,7 @@ void BluezEndpoint::SetupGattService()
478478
#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING
479479
ChipLogDetail(DeviceLayer, "CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING is TRUE");
480480
// Additional data characteristics
481-
mC3.reset(CreateGattCharacteristic(mService.get(), "c3", CHIP_PLAT_BLE_UUID_C3_STRING, c3_flags));
481+
mC3.reset(CreateGattCharacteristic(mService.get(), "c3", Ble::CHIP_BLE_CHAR_3_UUID_STR, c3_flags));
482482
g_signal_connect(mC3.get(), "handle-read-value",
483483
G_CALLBACK(+[](BluezGattCharacteristic1 * aChar, GDBusMethodInvocation * aInv, GVariant * aOpt,
484484
BluezEndpoint * self) { return self->BluezCharacteristicReadValue(aChar, aInv, aOpt); }),

src/platform/Linux/bluez/ChipDeviceScanner.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ bool BluezGetChipDeviceInfo(BluezDevice1 & aDevice, chip::Ble::ChipBLEDeviceIden
4242
GVariant * serviceData = bluez_device1_get_service_data(&aDevice);
4343
VerifyOrReturnError(serviceData != nullptr, false);
4444

45-
GAutoPtr<GVariant> dataValue(g_variant_lookup_value(serviceData, CHIP_BLE_UUID_SERVICE_STRING, nullptr));
45+
GAutoPtr<GVariant> dataValue(g_variant_lookup_value(serviceData, Ble::CHIP_BLE_SERVICE_LONG_UUID_STR, nullptr));
4646
VerifyOrReturnError(dataValue != nullptr, false);
4747

4848
size_t dataLen = 0;

src/platform/Linux/bluez/Types.h

-12
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,6 @@ namespace Internal {
110110
#define ADVERTISING_INTERFACE BLUEZ_INTERFACE ".LEAdvertisement1"
111111
#define DEVICE_INTERFACE BLUEZ_INTERFACE ".Device1"
112112

113-
#define CHIP_PLAT_BLE_UUID_C1_STRING "18ee2ef5-263d-4559-959f-4f9c429f9d11"
114-
#define CHIP_PLAT_BLE_UUID_C2_STRING "18ee2ef5-263d-4559-959f-4f9c429f9d12"
115-
#define CHIP_PLAT_BLE_UUID_C3_STRING "64630238-8772-45F2-B87D-748A83218F04"
116-
117-
#define CHIP_BLE_BASE_SERVICE_UUID_STRING "-0000-1000-8000-00805f9b34fb"
118-
#define CHIP_BLE_SERVICE_PREFIX_LENGTH 8
119-
#define CHIP_BLE_BASE_SERVICE_PREFIX "0000"
120-
#define CHIP_BLE_UUID_SERVICE_SHORT_STRING "fff6"
121-
122-
#define CHIP_BLE_UUID_SERVICE_STRING \
123-
CHIP_BLE_BASE_SERVICE_PREFIX CHIP_BLE_UUID_SERVICE_SHORT_STRING CHIP_BLE_BASE_SERVICE_UUID_STRING
124-
125113
#define BLUEZ_ADV_TYPE_FLAGS 0x01
126114
#define BLUEZ_ADV_TYPE_SERVICE_DATA 0x16
127115

src/platform/Tizen/ChipDeviceScanner.cpp

+3-6
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <bluetooth.h>
3131
#include <bluetooth_internal.h>
3232

33+
#include <ble/BleUUID.h>
3334
#include <lib/support/CodeUtils.h>
3435
#include <lib/support/Span.h>
3536
#include <lib/support/logging/CHIPLogging.h>
@@ -40,10 +41,6 @@ namespace chip {
4041
namespace DeviceLayer {
4142
namespace Internal {
4243

43-
// CHIPoBLE UUID strings
44-
const char chip_service_uuid[] = "0000FFF6-0000-1000-8000-00805F9B34FB";
45-
const char chip_service_uuid_short[] = "FFF6";
46-
4744
ChipDeviceScanner::ChipDeviceScanner(ChipDeviceScannerDelegate * delegate) : mDelegate(delegate) {}
4845

4946
ChipDeviceScanner::~ChipDeviceScanner()
@@ -100,8 +97,8 @@ static bool __IsChipThingDevice(bt_adapter_le_device_scan_result_info_s * info,
10097
{
10198
for (int i = 0; i < count; i++)
10299
{
103-
if (g_strcmp0(dataList[i].service_uuid, chip_service_uuid) == 0 ||
104-
g_strcmp0(dataList[i].service_uuid, chip_service_uuid_short) == 0)
100+
if (g_strcmp0(dataList[i].service_uuid, chip::Ble::CHIP_BLE_CHAR_1_UUID_STR) == 0 ||
101+
g_strcmp0(dataList[i].service_uuid, chip::Ble::CHIP_BLE_SERVICE_SHORT_UUID_STR) == 0)
105102
{
106103
ChipLogProgress(DeviceLayer, "CHIP Thing Device Found! [Service Data UUID] = %s", dataList[i].service_uuid);
107104
// Print full Service Data

0 commit comments

Comments
 (0)