Skip to content

Commit e445e8a

Browse files
[Tizen] Allow to pass CHIP error to device event (#33744)
* Create GATT service with short Bluetooth SIG UUID * Do not initialize characteristics with dummy values * Do not keep non-Matter UUIDs in BleUUID.h * Pass CHIP_ERROR to device event * Simplify ChipDeviceEvent initialization * Restyled by clang-format --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 4a8dc73 commit e445e8a

File tree

5 files changed

+75
-93
lines changed

5 files changed

+75
-93
lines changed

src/ble/BleUUID.h

-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ constexpr std::pair<bool, ChipBleUUID> StringToUUID(const char (&str)[N])
101101
// BlueZ API https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/org.bluez.Device.rst
102102
// describes ServiceData as "Keys are the UUIDs in string format" however no description
103103
// on actual case required
104-
inline constexpr char CHIP_BLE_DESC_SHORT_UUID_STR[] = "2902";
105104
inline constexpr char CHIP_BLE_SERVICE_SHORT_UUID_STR[] = "fff6";
106105
inline constexpr char CHIP_BLE_SERVICE_LONG_UUID_STR[] = "0000fff6-0000-1000-8000-00805f9b34fb";
107106
inline constexpr char CHIP_BLE_CHAR_1_UUID_STR[] = "18ee2ef5-263d-4559-959f-4f9c429f9d11";

src/platform/Linux/CHIPDevicePlatformEvent.h

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
#pragma once
2525

26+
#include <lib/core/CHIPError.h>
2627
#include <platform/CHIPDeviceEvent.h>
2728
#include <system/SystemPacketBuffer.h>
2829

src/platform/Tizen/BLEManagerImpl.cpp

+62-77
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ namespace Internal {
7474

7575
namespace {
7676

77+
// Bluetooth SIG defined UUID for Client Characteristic Configuration Descriptor
78+
constexpr const char * kClientCharacteristicConfigurationUUID = "2902";
79+
7780
constexpr System::Clock::Timeout kNewConnectionScanTimeout = System::Clock::Seconds16(20);
7881
constexpr System::Clock::Timeout kConnectTimeout = System::Clock::Seconds16(20);
7982
constexpr System::Clock::Timeout kFastAdvertiseTimeout =
@@ -208,7 +211,10 @@ void BLEManagerImpl::ReadValueRequestedCb(const char * remoteAddress, int reques
208211

209212
ChipLogByteSpan(DeviceLayer, ByteSpan(Uint8::from_const_char(value.get()), len));
210213

211-
ret = bt_gatt_server_send_response(requestId, BT_GATT_REQUEST_TYPE_READ, offset, 0x00, value.get(), len);
214+
char dummyValue[] = "";
215+
// Tizen API does not like NULLs even for zero-length values.
216+
char * valuePtr = value ? value.get() : dummyValue;
217+
ret = bt_gatt_server_send_response(requestId, BT_GATT_REQUEST_TYPE_READ, offset, BT_ATT_ERROR_NONE, valuePtr, len);
212218
VerifyOrReturn(ret == BT_ERROR_NONE,
213219
ChipLogError(DeviceLayer, "bt_gatt_server_send_response() failed: %s", get_error_message(ret)));
214220
}
@@ -233,7 +239,7 @@ void BLEManagerImpl::WriteValueRequestedCb(const char * remoteAddress, int reque
233239
ret = bt_gatt_set_value(gattHandle, value, len);
234240
VerifyOrReturn(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_set_value() failed: %s", get_error_message(ret)));
235241

236-
ret = bt_gatt_server_send_response(requestId, BT_GATT_REQUEST_TYPE_WRITE, offset, 0x00, nullptr, 0);
242+
ret = bt_gatt_server_send_response(requestId, BT_GATT_REQUEST_TYPE_WRITE, offset, BT_ATT_ERROR_NONE, nullptr, 0);
237243
VerifyOrReturn(ret == BT_ERROR_NONE,
238244
ChipLogError(DeviceLayer, "bt_gatt_server_send_response() failed: %s", get_error_message(ret)));
239245

@@ -265,7 +271,7 @@ void BLEManagerImpl::NotificationStateChangedCb(bool notify, bt_gatt_server_h se
265271

266272
ChipLogProgress(DeviceLayer, "Notification State Changed %d on %s: %s", notify, __ConvertAttTypeToStr(type),
267273
StringOrNullMarker(uuid.get()));
268-
NotifyBLESubscribed(notify ? true : false, conn);
274+
NotifyBLESubscribed(conn, notify ? true : false);
269275
}
270276

271277
void BLEManagerImpl::WriteCompletedCb(int result, bt_gatt_h gattHandle, void * userData)
@@ -314,7 +320,7 @@ void BLEManagerImpl::AdvertisingStateChangedCb(int result, bt_advertiser_h adver
314320
if (advState == BT_ADAPTER_LE_ADVERTISING_STARTED)
315321
{
316322
mFlags.Set(Flags::kAdvertising);
317-
NotifyBLEPeripheralAdvStartComplete(true, nullptr);
323+
NotifyBLEPeripheralAdvStartComplete(CHIP_NO_ERROR);
318324
DeviceLayer::SystemLayer().ScheduleLambda([this] {
319325
// Start a timer to make sure that the fast advertising is stopped after specified timeout.
320326
DeviceLayer::SystemLayer().StartTimer(kFastAdvertiseTimeout, HandleAdvertisingTimeout, this);
@@ -323,7 +329,7 @@ void BLEManagerImpl::AdvertisingStateChangedCb(int result, bt_advertiser_h adver
323329
else
324330
{
325331
mFlags.Clear(Flags::kAdvertising);
326-
NotifyBLEPeripheralAdvStopComplete(true, nullptr);
332+
NotifyBLEPeripheralAdvStopComplete(CHIP_NO_ERROR);
327333
DeviceLayer::SystemLayer().ScheduleLambda(
328334
[this] { DeviceLayer::SystemLayer().CancelTimer(HandleAdvertisingTimeout, this); });
329335
}
@@ -338,89 +344,73 @@ void BLEManagerImpl::AdvertisingStateChangedCb(int result, bt_advertiser_h adver
338344
}
339345

340346
// ====== Private Functions.
341-
void BLEManagerImpl::NotifyBLEPeripheralGATTServerRegisterComplete(bool aIsSuccess, void * apAppstate)
347+
348+
void BLEManagerImpl::NotifyBLEPeripheralGATTServerRegisterComplete(CHIP_ERROR error)
342349
{
343-
ChipDeviceEvent event;
344-
event.Type = DeviceEventType::kPlatformTizenBLEPeripheralGATTServerRegisterComplete;
345-
event.Platform.BLEPeripheralGATTServerRegisterComplete.mIsSuccess = aIsSuccess;
346-
event.Platform.BLEPeripheralGATTServerRegisterComplete.mpAppstate = apAppstate;
350+
ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLEPeripheralGATTServerRegisterComplete,
351+
.Platform = { .BLEPeripheralGATTServerRegisterComplete = { .mError = error } } };
347352
PlatformMgr().PostEventOrDie(&event);
348353
}
349354

350-
void BLEManagerImpl::NotifyBLEPeripheralAdvConfiguredComplete(bool aIsSuccess, void * apAppstate)
355+
void BLEManagerImpl::NotifyBLEPeripheralAdvConfiguredComplete(CHIP_ERROR error)
351356
{
352-
ChipDeviceEvent event;
353-
event.Type = DeviceEventType::kPlatformTizenBLEPeripheralAdvConfiguredComplete;
354-
event.Platform.BLEPeripheralAdvConfiguredComplete.mIsSuccess = aIsSuccess;
355-
event.Platform.BLEPeripheralAdvConfiguredComplete.mpAppstate = apAppstate;
357+
ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLEPeripheralAdvConfiguredComplete,
358+
.Platform = { .BLEPeripheralAdvConfiguredComplete = { .mError = error } } };
356359
PlatformMgr().PostEventOrDie(&event);
357360
}
358361

359-
void BLEManagerImpl::NotifyBLEPeripheralAdvStartComplete(bool aIsSuccess, void * apAppstate)
362+
void BLEManagerImpl::NotifyBLEPeripheralAdvStartComplete(CHIP_ERROR error)
360363
{
361-
ChipDeviceEvent event;
362-
event.Type = DeviceEventType::kPlatformTizenBLEPeripheralAdvStartComplete;
363-
event.Platform.BLEPeripheralAdvStartComplete.mIsSuccess = aIsSuccess;
364-
event.Platform.BLEPeripheralAdvStartComplete.mpAppstate = apAppstate;
364+
ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLEPeripheralAdvStartComplete,
365+
.Platform = { .BLEPeripheralAdvStartComplete = { .mError = error } } };
365366
PlatformMgr().PostEventOrDie(&event);
366367
}
367368

368-
void BLEManagerImpl::NotifyBLEPeripheralAdvStopComplete(bool aIsSuccess, void * apAppstate)
369+
void BLEManagerImpl::NotifyBLEPeripheralAdvStopComplete(CHIP_ERROR error)
369370
{
370-
ChipDeviceEvent event;
371-
event.Type = DeviceEventType::kPlatformTizenBLEPeripheralAdvStopComplete;
372-
event.Platform.BLEPeripheralAdvStopComplete.mIsSuccess = aIsSuccess;
373-
event.Platform.BLEPeripheralAdvStopComplete.mpAppstate = apAppstate;
371+
ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLEPeripheralAdvStopComplete,
372+
.Platform = { .BLEPeripheralAdvStopComplete = { .mError = error } } };
374373
PlatformMgr().PostEventOrDie(&event);
375374
}
376375

377-
void BLEManagerImpl::NotifyBLEWriteReceived(System::PacketBufferHandle & buf, BLE_CONNECTION_OBJECT conId)
376+
void BLEManagerImpl::NotifyBLEWriteReceived(BLE_CONNECTION_OBJECT conId, System::PacketBufferHandle & buf)
378377
{
379-
ChipDeviceEvent event;
380-
event.Type = DeviceEventType::kCHIPoBLEWriteReceived;
381-
event.CHIPoBLEWriteReceived.ConId = conId;
382-
event.CHIPoBLEWriteReceived.Data = std::move(buf).UnsafeRelease();
378+
ChipDeviceEvent event{ .Type = DeviceEventType::kCHIPoBLEWriteReceived,
379+
.CHIPoBLEWriteReceived = { .ConId = conId, .Data = std::move(buf).UnsafeRelease() } };
383380
PlatformMgr().PostEventOrDie(&event);
384381
}
385382

386-
void BLEManagerImpl::NotifyBLENotificationReceived(System::PacketBufferHandle & buf, BLE_CONNECTION_OBJECT conId)
383+
void BLEManagerImpl::NotifyBLENotificationReceived(BLE_CONNECTION_OBJECT conId, System::PacketBufferHandle & buf)
387384
{
388-
ChipDeviceEvent event;
389-
event.Type = DeviceEventType::kPlatformTizenBLEIndicationReceived;
390-
event.Platform.BLEIndicationReceived.mConnection = conId;
391-
event.Platform.BLEIndicationReceived.mData = std::move(buf).UnsafeRelease();
385+
ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLEIndicationReceived,
386+
.Platform = {
387+
.BLEIndicationReceived = { .mConnection = conId, .mData = std::move(buf).UnsafeRelease() } } };
392388
PlatformMgr().PostEventOrDie(&event);
393389
}
394390

395-
void BLEManagerImpl::NotifyBLESubscribed(bool indicationsEnabled, BLE_CONNECTION_OBJECT conId)
391+
void BLEManagerImpl::NotifyBLESubscribed(BLE_CONNECTION_OBJECT conId, bool indicationsEnabled)
396392
{
397-
ChipDeviceEvent event;
398-
event.Type = (indicationsEnabled) ? DeviceEventType::kCHIPoBLESubscribe : DeviceEventType::kCHIPoBLEUnsubscribe;
399-
event.CHIPoBLESubscribe.ConId = conId;
393+
ChipDeviceEvent event{ .Type = indicationsEnabled ? DeviceEventType::kCHIPoBLESubscribe : DeviceEventType::kCHIPoBLEUnsubscribe,
394+
.CHIPoBLESubscribe = { .ConId = conId } };
400395
PlatformMgr().PostEventOrDie(&event);
401396
}
402397

403398
void BLEManagerImpl::NotifyBLEIndicationConfirmation(BLE_CONNECTION_OBJECT conId)
404399
{
405-
ChipDeviceEvent event;
406-
event.Type = DeviceEventType::kCHIPoBLEIndicateConfirm;
407-
event.CHIPoBLEIndicateConfirm.ConId = conId;
400+
ChipDeviceEvent event{ .Type = DeviceEventType::kCHIPoBLEIndicateConfirm, .CHIPoBLEIndicateConfirm = { .ConId = conId } };
408401
PlatformMgr().PostEventOrDie(&event);
409402
}
410403

411404
void BLEManagerImpl::NotifyBLEConnectionEstablished(BLE_CONNECTION_OBJECT conId, CHIP_ERROR error)
412405
{
413-
ChipDeviceEvent event;
414-
event.Type = DeviceEventType::kCHIPoBLEConnectionEstablished;
406+
ChipDeviceEvent event{ .Type = DeviceEventType::kCHIPoBLEConnectionEstablished };
415407
PlatformMgr().PostEventOrDie(&event);
416408
}
417409

418410
void BLEManagerImpl::NotifyBLEDisconnection(BLE_CONNECTION_OBJECT conId, CHIP_ERROR error)
419411
{
420-
ChipDeviceEvent event;
421-
event.Type = DeviceEventType::kCHIPoBLEConnectionError;
422-
event.CHIPoBLEConnectionError.ConId = conId;
423-
event.CHIPoBLEConnectionError.Reason = error;
412+
ChipDeviceEvent event{ .Type = DeviceEventType::kCHIPoBLEConnectionError,
413+
.CHIPoBLEConnectionError = { .ConId = conId, .Reason = error } };
424414
PlatformMgr().PostEventOrDie(&event);
425415
}
426416

@@ -429,9 +419,8 @@ void BLEManagerImpl::NotifyHandleConnectFailed(CHIP_ERROR error)
429419
ChipLogProgress(DeviceLayer, "Connection failed: %" CHIP_ERROR_FORMAT, error.Format());
430420
if (mIsCentral)
431421
{
432-
ChipDeviceEvent event;
433-
event.Type = DeviceEventType::kPlatformTizenBLECentralConnectFailed;
434-
event.Platform.BLECentralConnectFailed.mError = error;
422+
ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLECentralConnectFailed,
423+
.Platform = { .BLECentralConnectFailed = { .mError = error } } };
435424
PlatformMgr().PostEventOrDie(&event);
436425
}
437426
}
@@ -440,27 +429,23 @@ void BLEManagerImpl::NotifyHandleNewConnection(BLE_CONNECTION_OBJECT conId)
440429
{
441430
if (mIsCentral)
442431
{
443-
ChipDeviceEvent event;
444-
event.Type = DeviceEventType::kPlatformTizenBLECentralConnected;
445-
event.Platform.BLECentralConnected.mConnection = conId;
432+
ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLECentralConnected,
433+
.Platform = { .BLECentralConnected = { .mConnection = conId } } };
446434
PlatformMgr().PostEventOrDie(&event);
447435
}
448436
}
449437

450438
void BLEManagerImpl::NotifyHandleWriteComplete(BLE_CONNECTION_OBJECT conId)
451439
{
452-
ChipDeviceEvent event;
453-
event.Type = DeviceEventType::kPlatformTizenBLEWriteComplete;
454-
event.Platform.BLEWriteComplete.mConnection = conId;
440+
ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLEWriteComplete,
441+
.Platform = { .BLEWriteComplete = { .mConnection = conId } } };
455442
PlatformMgr().PostEventOrDie(&event);
456443
}
457444

458445
void BLEManagerImpl::NotifySubscribeOpComplete(BLE_CONNECTION_OBJECT conId, bool isSubscribed)
459446
{
460-
ChipDeviceEvent event;
461-
event.Type = DeviceEventType::kPlatformTizenBLESubscribeOpComplete;
462-
event.Platform.BLESubscribeOpComplete.mConnection = conId;
463-
event.Platform.BLESubscribeOpComplete.mIsSubscribed = isSubscribed;
447+
ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLESubscribeOpComplete,
448+
.Platform = { .BLESubscribeOpComplete = { .mConnection = conId, .mIsSubscribed = isSubscribed } } };
464449
PlatformMgr().PostEventOrDie(&event);
465450
}
466451

@@ -574,7 +559,7 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer()
574559
VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_server_create() failed: %s", get_error_message(ret)));
575560

576561
// Create Service (BTP Service)
577-
ret = bt_gatt_service_create(Ble::CHIP_BLE_SERVICE_LONG_UUID_STR, BT_GATT_SERVICE_TYPE_PRIMARY, &service);
562+
ret = bt_gatt_service_create(Ble::CHIP_BLE_SERVICE_SHORT_UUID_STR, BT_GATT_SERVICE_TYPE_PRIMARY, &service);
578563
VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_service_create() failed: %s", get_error_message(ret)));
579564

580565
// Create 1st Characteristic (Client TX Buffer)
@@ -583,7 +568,7 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer()
583568
BT_GATT_PROPERTY_WRITE, // Write Request is not coming if we use WITHOUT_RESPONSE property. Let's use WRITE property and
584569
// consider to use WITHOUT_RESPONSE property in the future according to the CHIP Spec 4.16.3.2. BTP
585570
// GATT Service
586-
"CHIPoBLE_C1", strlen("CHIPoBLE_C1"), &char1);
571+
nullptr, 0, &char1);
587572
VerifyOrExit(ret == BT_ERROR_NONE,
588573
ChipLogError(DeviceLayer, "bt_gatt_characteristic_create() failed: %s", get_error_message(ret)));
589574

@@ -604,8 +589,7 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer()
604589

605590
// Create 2nd Characteristic (Client RX Buffer)
606591
ret = bt_gatt_characteristic_create(Ble::CHIP_BLE_CHAR_2_UUID_STR, BT_GATT_PERMISSION_READ,
607-
BT_GATT_PROPERTY_READ | BT_GATT_PROPERTY_INDICATE, "CHIPoBLE_C2", strlen("CHIPoBLE_C2"),
608-
&char2);
592+
BT_GATT_PROPERTY_READ | BT_GATT_PROPERTY_INDICATE, nullptr, 0, &char2);
609593
VerifyOrExit(ret == BT_ERROR_NONE,
610594
ChipLogError(DeviceLayer, "bt_gatt_characteristic_create() failed: %s", get_error_message(ret)));
611595

@@ -618,6 +602,7 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer()
618602
this);
619603
VerifyOrExit(ret == BT_ERROR_NONE,
620604
ChipLogError(DeviceLayer, "bt_gatt_server_set_read_value_requested_cb() failed: %s", get_error_message(ret)));
605+
621606
ret = bt_gatt_server_set_characteristic_notification_state_change_cb(
622607
char2,
623608
+[](bool notify, bt_gatt_server_h gattServer, bt_gatt_h charHandle, void * self) {
@@ -628,13 +613,14 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer()
628613
ChipLogError(DeviceLayer, "bt_gatt_server_set_characteristic_notification_state_change_cb() failed: %s",
629614
get_error_message(ret)));
630615

631-
// Create CCC Descriptor
632-
ret = bt_gatt_descriptor_create(Ble::CHIP_BLE_DESC_SHORT_UUID_STR, BT_GATT_PERMISSION_READ | BT_GATT_PERMISSION_WRITE,
616+
ret = bt_gatt_descriptor_create(kClientCharacteristicConfigurationUUID, BT_GATT_PERMISSION_READ | BT_GATT_PERMISSION_WRITE,
633617
desc_value, sizeof(desc_value), &desc);
634618
VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_descriptor_create() failed: %s", get_error_message(ret)));
619+
635620
ret = bt_gatt_characteristic_add_descriptor(char2, desc);
636621
VerifyOrExit(ret == BT_ERROR_NONE,
637622
ChipLogError(DeviceLayer, "bt_gatt_characteristic_add_descriptor() failed: %s", get_error_message(ret)));
623+
638624
ret = bt_gatt_service_add_characteristic(service, char2);
639625
VerifyOrExit(ret == BT_ERROR_NONE,
640626
ChipLogError(DeviceLayer, "bt_gatt_service_add_characteristic() failed: %s", get_error_message(ret)));
@@ -648,17 +634,15 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer()
648634
ret = bt_gatt_server_start();
649635
VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_server_start() failed: %s", get_error_message(ret)));
650636

651-
ChipLogDetail(DeviceLayer, "NotifyBLEPeripheralGATTServerRegisterComplete Success");
652-
BLEManagerImpl::NotifyBLEPeripheralGATTServerRegisterComplete(true, nullptr);
637+
BLEManagerImpl::NotifyBLEPeripheralGATTServerRegisterComplete(CHIP_NO_ERROR);
653638

654639
// Save the Local Peripheral char1 & char2 handles
655640
mGattCharC1Handle = char1;
656641
mGattCharC2Handle = char2;
657642
return CHIP_NO_ERROR;
658643

659644
exit:
660-
ChipLogDetail(DeviceLayer, "NotifyBLEPeripheralGATTServerRegisterComplete Failed");
661-
BLEManagerImpl::NotifyBLEPeripheralGATTServerRegisterComplete(false, nullptr);
645+
BLEManagerImpl::NotifyBLEPeripheralGATTServerRegisterComplete(TizenToChipError(ret));
662646
return TizenToChipError(ret);
663647
}
664648

@@ -727,7 +711,7 @@ CHIP_ERROR BLEManagerImpl::StartBLEAdvertising()
727711
VerifyOrExit(ret == BT_ERROR_NONE,
728712
ChipLogError(DeviceLayer, "bt_adapter_le_set_advertising_device_name() failed: %s", get_error_message(ret)));
729713

730-
BLEManagerImpl::NotifyBLEPeripheralAdvConfiguredComplete(true, nullptr);
714+
BLEManagerImpl::NotifyBLEPeripheralAdvConfiguredComplete(CHIP_NO_ERROR);
731715

732716
ret = bt_adapter_le_start_advertising_new(
733717
mAdvertiser,
@@ -742,8 +726,9 @@ CHIP_ERROR BLEManagerImpl::StartBLEAdvertising()
742726
return CHIP_NO_ERROR;
743727

744728
exit:
745-
BLEManagerImpl::NotifyBLEPeripheralAdvStartComplete(false, nullptr);
746-
return ret != BT_ERROR_NONE ? TizenToChipError(ret) : err;
729+
err = ret != BT_ERROR_NONE ? TizenToChipError(ret) : err;
730+
BLEManagerImpl::NotifyBLEPeripheralAdvStartComplete(err);
731+
return err;
747732
}
748733

749734
CHIP_ERROR BLEManagerImpl::StopBLEAdvertising()
@@ -758,7 +743,7 @@ CHIP_ERROR BLEManagerImpl::StopBLEAdvertising()
758743
return CHIP_NO_ERROR;
759744

760745
exit:
761-
BLEManagerImpl::NotifyBLEPeripheralAdvStopComplete(false, nullptr);
746+
BLEManagerImpl::NotifyBLEPeripheralAdvStopComplete(TizenToChipError(ret));
762747
return TizenToChipError(ret);
763748
}
764749

@@ -896,7 +881,7 @@ void BLEManagerImpl::HandleC1CharWriteEvent(BLE_CONNECTION_OBJECT conId, const u
896881
// Copy the data to a packet buffer.
897882
buf = System::PacketBufferHandle::NewWithData(value, len);
898883
VerifyOrExit(!buf.IsNull(), err = CHIP_ERROR_NO_MEMORY);
899-
NotifyBLEWriteReceived(buf, conId);
884+
NotifyBLEWriteReceived(conId, buf);
900885
return;
901886
exit:
902887
if (err != CHIP_NO_ERROR)
@@ -915,7 +900,7 @@ void BLEManagerImpl::HandleRXCharChanged(BLE_CONNECTION_OBJECT conId, const uint
915900
// Copy the data to a packet buffer.
916901
buf = System::PacketBufferHandle::NewWithData(value, len);
917902
VerifyOrExit(!buf.IsNull(), err = CHIP_ERROR_NO_MEMORY);
918-
NotifyBLENotificationReceived(buf, conId);
903+
NotifyBLENotificationReceived(conId, buf);
919904
return;
920905
exit:
921906
if (err != CHIP_NO_ERROR)

0 commit comments

Comments
 (0)