Skip to content

Commit 093aff8

Browse files
[Linux] Reuse short UUID defined in BLE layer (#36557)
* [Linux] Reuse short UUID defined in BLE layer * Restyled by clang-format --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 13920e5 commit 093aff8

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

src/platform/Linux/BLEManagerImpl.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,8 @@ uint16_t BLEManagerImpl::_NumConnections()
186186

187187
CHIP_ERROR BLEManagerImpl::ConfigureBle(uint32_t aAdapterId, bool aIsCentral)
188188
{
189-
mAdapterId = aAdapterId;
190-
mIsCentral = aIsCentral;
191-
mpBLEAdvUUID = "0xFFF6";
189+
mAdapterId = aAdapterId;
190+
mIsCentral = aIsCentral;
192191
return CHIP_NO_ERROR;
193192
}
194193

@@ -578,7 +577,7 @@ void BLEManagerImpl::DriveBLEState()
578577
// Configure advertising data if it hasn't been done yet.
579578
if (!mFlags.Has(Flags::kAdvertisingConfigured))
580579
{
581-
SuccessOrExit(err = mBLEAdvertisement.Init(mAdapter.get(), mpBLEAdvUUID, mDeviceName));
580+
SuccessOrExit(err = mBLEAdvertisement.Init(mAdapter.get(), Ble::CHIP_BLE_SERVICE_SHORT_UUID_STR, mDeviceName));
582581
mFlags.Set(Flags::kAdvertisingConfigured);
583582
}
584583

src/platform/Linux/BLEManagerImpl.h

-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ class BLEManagerImpl final : public BLEManager,
199199
BluezEndpoint mEndpoint{ mBluezObjectManager };
200200

201201
BluezAdvertisement mBLEAdvertisement{ mEndpoint };
202-
const char * mpBLEAdvUUID = nullptr;
203202

204203
ChipDeviceScanner mDeviceScanner{ mBluezObjectManager };
205204
BLEScanConfig mBLEScanConfig;

src/platform/NuttX/BLEManagerImpl.cpp

+4-5
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#include <type_traits>
3636
#include <utility>
3737

38-
#include <ble/CHIPBleServiceData.h>
38+
#include <ble/Ble.h>
3939
#include <lib/support/CodeUtils.h>
4040
#include <lib/support/SafeInt.h>
4141
#include <platform/CHIPDeviceLayer.h>
@@ -197,9 +197,8 @@ uint16_t BLEManagerImpl::_NumConnections()
197197

198198
CHIP_ERROR BLEManagerImpl::ConfigureBle(uint32_t aAdapterId, bool aIsCentral)
199199
{
200-
mAdapterId = aAdapterId;
201-
mIsCentral = aIsCentral;
202-
mpBLEAdvUUID = "0xFFF6";
200+
mAdapterId = aAdapterId;
201+
mIsCentral = aIsCentral;
203202
return CHIP_NO_ERROR;
204203
}
205204

@@ -587,7 +586,7 @@ void BLEManagerImpl::DriveBLEState()
587586
// Configure advertising data if it hasn't been done yet.
588587
if (!mFlags.Has(Flags::kAdvertisingConfigured))
589588
{
590-
SuccessOrExit(err = mBLEAdvertisement.Init(mEndpoint, mpBLEAdvUUID, mDeviceName));
589+
SuccessOrExit(err = mBLEAdvertisement.Init(mEndpoint, Ble::CHIP_BLE_SERVICE_SHORT_UUID_STR, mDeviceName));
591590
mFlags.Set(Flags::kAdvertisingConfigured);
592591
}
593592

src/platform/NuttX/BLEManagerImpl.h

-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ class BLEManagerImpl final : public BLEManager,
189189
BluezEndpoint mEndpoint;
190190

191191
BluezAdvertisement mBLEAdvertisement;
192-
const char * mpBLEAdvUUID = nullptr;
193192

194193
ChipDeviceScanner mDeviceScanner;
195194
BLEScanConfig mBLEScanConfig;

0 commit comments

Comments
 (0)