Skip to content

Commit f963d45

Browse files
[Tizen] Determine Matter device based on C1 and C2 existence (#34045)
* Do not unnecessary copy buffer handle when posting event * Remove unused variable * Remove unnecessary logs * Use defined value instead of nullptr * Remove unnecessary namespacing * Determine chip device based on C1 and C2 existence * Drop read property from C2 characteristic * Update characteristic names * Restyled by clang-format --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 181d01f commit f963d45

File tree

2 files changed

+54
-89
lines changed

2 files changed

+54
-89
lines changed

src/platform/Tizen/BLEManagerImpl.cpp

+50-83
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,8 @@ struct BLEConnection
9090
{
9191
char * peerAddr;
9292
unsigned int mtu;
93-
bool subscribed;
9493
bt_gatt_h gattCharC1Handle;
9594
bt_gatt_h gattCharC2Handle;
96-
bool isChipDevice;
9795
};
9896

9997
static void __BLEConnectionFree(BLEConnection * conn)
@@ -203,7 +201,7 @@ void BLEManagerImpl::ReadValueRequestedCb(const char * remoteAddress, int reques
203201
GAutoPtr<char> value;
204202

205203
VerifyOrReturn(__GetAttInfo(gattHandle, &uuid.GetReceiver(), &type) == BT_ERROR_NONE,
206-
ChipLogError(DeviceLayer, "Failed to fetch GATT Attribute from GATT handle"));
204+
ChipLogError(DeviceLayer, "Failed to fetch GATT attribute from GATT handle"));
207205
ChipLogProgress(DeviceLayer, "Gatt read requested on %s: uuid=%s", __ConvertAttTypeToStr(type), StringOrNullMarker(uuid.get()));
208206

209207
ret = bt_gatt_get_value(gattHandle, &value.GetReceiver(), &len);
@@ -231,7 +229,7 @@ void BLEManagerImpl::WriteValueRequestedCb(const char * remoteAddress, int reque
231229
VerifyOrReturn(conn != nullptr, ChipLogError(DeviceLayer, "Failed to find connection info"));
232230

233231
VerifyOrReturn(__GetAttInfo(gattHandle, &uuid.GetReceiver(), &type) == BT_ERROR_NONE,
234-
ChipLogError(DeviceLayer, "Failed to fetch GATT Attribute from GATT handle"));
232+
ChipLogError(DeviceLayer, "Failed to fetch GATT attribute from GATT handle"));
235233
ChipLogProgress(DeviceLayer, "Gatt write requested on %s: uuid=%s len=%d", __ConvertAttTypeToStr(type),
236234
StringOrNullMarker(uuid.get()), len);
237235
ChipLogByteSpan(DeviceLayer, ByteSpan(Uint8::from_const_char(value), len));
@@ -243,10 +241,10 @@ void BLEManagerImpl::WriteValueRequestedCb(const char * remoteAddress, int reque
243241
VerifyOrReturn(ret == BT_ERROR_NONE,
244242
ChipLogError(DeviceLayer, "bt_gatt_server_send_response() failed: %s", get_error_message(ret)));
245243

246-
HandleC1CharWriteEvent(conn, Uint8::from_const_char(value), len);
244+
HandleC1CharWrite(conn, Uint8::from_const_char(value), len);
247245
}
248246

249-
void BLEManagerImpl::NotificationStateChangedCb(bool notify, bt_gatt_server_h server, bt_gatt_h charHandle)
247+
void BLEManagerImpl::IndicationStateChangedCb(bool notify, bt_gatt_server_h server, bt_gatt_h charHandle)
250248
{
251249
GAutoPtr<char> uuid;
252250
BLEConnection * conn = nullptr;
@@ -267,9 +265,9 @@ void BLEManagerImpl::NotificationStateChangedCb(bool notify, bt_gatt_server_h se
267265

268266
int ret = __GetAttInfo(charHandle, &uuid.GetReceiver(), &type);
269267
VerifyOrReturn(ret == BT_ERROR_NONE,
270-
ChipLogError(DeviceLayer, "Failed to fetch GATT Attribute from CHAR handle: %s", get_error_message(ret)));
268+
ChipLogError(DeviceLayer, "Failed to fetch GATT attribute from CHAR handle: %s", get_error_message(ret)));
271269

272-
ChipLogProgress(DeviceLayer, "Notification State Changed %d on %s: %s", notify, __ConvertAttTypeToStr(type),
270+
ChipLogProgress(DeviceLayer, "Indication state changed %d on %s: %s", notify, __ConvertAttTypeToStr(type),
273271
StringOrNullMarker(uuid.get()));
274272
NotifyBLESubscribed(conn, notify ? true : false);
275273
}
@@ -286,16 +284,16 @@ void BLEManagerImpl::WriteCompletedCb(int result, bt_gatt_h gattHandle, void * u
286284
sInstance.NotifyHandleWriteComplete(conn);
287285
}
288286

289-
void BLEManagerImpl::CharacteristicNotificationCb(bt_gatt_h characteristic, char * value, int len, void * userData)
287+
void BLEManagerImpl::CharacteristicIndicationCb(bt_gatt_h characteristic, char * value, int len, void * userData)
290288
{
291289
auto conn = static_cast<BLEConnection *>(userData);
292290

293291
VerifyOrReturn(value != nullptr);
294292
VerifyOrReturn(conn != nullptr, ChipLogError(DeviceLayer, "Connection object is invalid"));
295293
VerifyOrReturn(conn->gattCharC2Handle == characteristic, ChipLogError(DeviceLayer, "Gatt characteristic handle did not match"));
296294

297-
ChipLogProgress(DeviceLayer, "Notification Received from CHIP peripheral [%s]", conn->peerAddr);
298-
sInstance.HandleRXCharChanged(conn, Uint8::from_const_char(value), len);
295+
ChipLogProgress(DeviceLayer, "Indication received from CHIP peripheral [%s]", conn->peerAddr);
296+
sInstance.HandleC2CharChanged(conn, Uint8::from_const_char(value), len);
299297
}
300298

301299
void BLEManagerImpl::IndicationConfirmationCb(int result, const char * remoteAddress, bt_gatt_server_h server,
@@ -373,21 +371,6 @@ void BLEManagerImpl::NotifyBLEPeripheralAdvStopComplete(CHIP_ERROR error)
373371
PlatformMgr().PostEventOrDie(&event);
374372
}
375373

376-
void BLEManagerImpl::NotifyBLEWriteReceived(BLE_CONNECTION_OBJECT conId, System::PacketBufferHandle & buf)
377-
{
378-
ChipDeviceEvent event{ .Type = DeviceEventType::kCHIPoBLEWriteReceived,
379-
.CHIPoBLEWriteReceived = { .ConId = conId, .Data = std::move(buf).UnsafeRelease() } };
380-
PlatformMgr().PostEventOrDie(&event);
381-
}
382-
383-
void BLEManagerImpl::NotifyBLENotificationReceived(BLE_CONNECTION_OBJECT conId, System::PacketBufferHandle & buf)
384-
{
385-
ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLEIndicationReceived,
386-
.Platform = {
387-
.BLEIndicationReceived = { .mConnection = conId, .mData = std::move(buf).UnsafeRelease() } } };
388-
PlatformMgr().PostEventOrDie(&event);
389-
}
390-
391374
void BLEManagerImpl::NotifyBLESubscribed(BLE_CONNECTION_OBJECT conId, bool indicationsEnabled)
392375
{
393376
ChipDeviceEvent event{ .Type = indicationsEnabled ? DeviceEventType::kCHIPoBLESubscribe : DeviceEventType::kCHIPoBLEUnsubscribe,
@@ -595,8 +578,8 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer()
595578
ChipLogError(DeviceLayer, "bt_gatt_service_add_characteristic() failed: %s", get_error_message(ret)));
596579

597580
// Create 2nd Characteristic (Client RX Buffer)
598-
ret = bt_gatt_characteristic_create(Ble::CHIP_BLE_CHAR_2_UUID_STR, BT_GATT_PERMISSION_READ,
599-
BT_GATT_PROPERTY_READ | BT_GATT_PROPERTY_INDICATE, nullptr, 0, &char2);
581+
ret = bt_gatt_characteristic_create(Ble::CHIP_BLE_CHAR_2_UUID_STR, BT_GATT_PERMISSION_READ, BT_GATT_PROPERTY_INDICATE, nullptr,
582+
0, &char2);
600583
VerifyOrExit(ret == BT_ERROR_NONE,
601584
ChipLogError(DeviceLayer, "bt_gatt_characteristic_create() failed: %s", get_error_message(ret)));
602585

@@ -613,7 +596,7 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer()
613596
ret = bt_gatt_server_set_characteristic_notification_state_change_cb(
614597
char2,
615598
+[](bool notify, bt_gatt_server_h gattServer, bt_gatt_h charHandle, void * self) {
616-
return reinterpret_cast<BLEManagerImpl *>(self)->NotificationStateChangedCb(notify, gattServer, charHandle);
599+
return reinterpret_cast<BLEManagerImpl *>(self)->IndicationStateChangedCb(notify, gattServer, charHandle);
617600
},
618601
this);
619602
VerifyOrExit(ret == BT_ERROR_NONE,
@@ -641,15 +624,15 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer()
641624
ret = bt_gatt_server_start();
642625
VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_server_start() failed: %s", get_error_message(ret)));
643626

644-
BLEManagerImpl::NotifyBLEPeripheralGATTServerRegisterComplete(CHIP_NO_ERROR);
627+
NotifyBLEPeripheralGATTServerRegisterComplete(CHIP_NO_ERROR);
645628

646629
// Save the Local Peripheral char1 & char2 handles
647630
mGattCharC1Handle = char1;
648631
mGattCharC2Handle = char2;
649632
return CHIP_NO_ERROR;
650633

651634
exit:
652-
BLEManagerImpl::NotifyBLEPeripheralGATTServerRegisterComplete(TizenToChipError(ret));
635+
NotifyBLEPeripheralGATTServerRegisterComplete(TizenToChipError(ret));
653636
return TizenToChipError(ret);
654637
}
655638

@@ -718,7 +701,7 @@ CHIP_ERROR BLEManagerImpl::StartBLEAdvertising()
718701
VerifyOrExit(ret == BT_ERROR_NONE,
719702
ChipLogError(DeviceLayer, "bt_adapter_le_set_advertising_device_name() failed: %s", get_error_message(ret)));
720703

721-
BLEManagerImpl::NotifyBLEPeripheralAdvConfiguredComplete(CHIP_NO_ERROR);
704+
NotifyBLEPeripheralAdvConfiguredComplete(CHIP_NO_ERROR);
722705

723706
ret = bt_adapter_le_start_advertising_new(
724707
mAdvertiser,
@@ -734,7 +717,7 @@ CHIP_ERROR BLEManagerImpl::StartBLEAdvertising()
734717

735718
exit:
736719
err = ret != BT_ERROR_NONE ? TizenToChipError(ret) : err;
737-
BLEManagerImpl::NotifyBLEPeripheralAdvStartComplete(err);
720+
NotifyBLEPeripheralAdvStartComplete(err);
738721
return err;
739722
}
740723

@@ -750,7 +733,7 @@ CHIP_ERROR BLEManagerImpl::StopBLEAdvertising()
750733
return CHIP_NO_ERROR;
751734

752735
exit:
753-
BLEManagerImpl::NotifyBLEPeripheralAdvStopComplete(TizenToChipError(ret));
736+
NotifyBLEPeripheralAdvStopComplete(TizenToChipError(ret));
754737
return TizenToChipError(ret);
755738
}
756739

@@ -762,7 +745,7 @@ static bool __GattClientForeachCharCb(int total, int index, bt_gatt_h charHandle
762745

763746
int ret = __GetAttInfo(charHandle, &uuid.GetReceiver(), &type);
764747
VerifyOrExit(ret == BT_ERROR_NONE,
765-
ChipLogError(DeviceLayer, "Failed to fetch GATT Attribute from CHAR handle: %s", get_error_message(ret)));
748+
ChipLogError(DeviceLayer, "Failed to fetch GATT attribute from CHAR handle: %s", get_error_message(ret)));
766749

767750
if (strcasecmp(uuid.get(), Ble::CHIP_BLE_CHAR_1_UUID_STR) == 0)
768751
{
@@ -785,18 +768,18 @@ static bool __GattClientForeachServiceCb(int total, int index, bt_gatt_h svcHand
785768
bt_gatt_type_e type;
786769
GAutoPtr<char> uuid;
787770
auto conn = static_cast<BLEConnection *>(data);
788-
ChipLogProgress(DeviceLayer, "__GattClientForeachServiceCb");
789771

790772
int ret = __GetAttInfo(svcHandle, &uuid.GetReceiver(), &type);
791773
VerifyOrExit(ret == BT_ERROR_NONE,
792-
ChipLogError(DeviceLayer, "Failed to fetch GATT Attribute from SVC handle: %s", get_error_message(ret)));
774+
ChipLogError(DeviceLayer, "Failed to fetch GATT attribute from SVC handle: %s", get_error_message(ret)));
793775

794776
if (strcasecmp(uuid.get(), chip::Ble::CHIP_BLE_SERVICE_LONG_UUID_STR) == 0)
795777
{
796778
ChipLogProgress(DeviceLayer, "CHIP Service UUID Found [%s]", StringOrNullMarker(uuid.get()));
797779

798-
if (bt_gatt_service_foreach_characteristics(svcHandle, __GattClientForeachCharCb, conn) == BT_ERROR_NONE)
799-
conn->isChipDevice = true;
780+
ret = bt_gatt_service_foreach_characteristics(svcHandle, __GattClientForeachCharCb, conn);
781+
VerifyOrExit(ret == BT_ERROR_NONE,
782+
ChipLogError(DeviceLayer, "Failed to browse GATT service characteristics: %s", get_error_message(ret)));
800783

801784
/* Got CHIP Device, no need to process further service */
802785
return false;
@@ -809,10 +792,11 @@ static bool __GattClientForeachServiceCb(int total, int index, bt_gatt_h svcHand
809792

810793
bool BLEManagerImpl::IsDeviceChipPeripheral(BLE_CONNECTION_OBJECT conId)
811794
{
812-
int ret;
813-
if ((ret = bt_gatt_client_foreach_services(mGattClient, __GattClientForeachServiceCb, conId)) != BT_ERROR_NONE)
814-
ChipLogError(DeviceLayer, "Failed to browse GATT services: %s", get_error_message(ret));
815-
return (conId->isChipDevice ? true : false);
795+
int ret = bt_gatt_client_foreach_services(mGattClient, __GattClientForeachServiceCb, conId);
796+
VerifyOrReturnValue(ret == BT_ERROR_NONE, false,
797+
ChipLogError(DeviceLayer, "Failed to browse GATT services: %s", get_error_message(ret)));
798+
// If C1 and C2 characteristics were found, then it is a CHIP peripheral device.
799+
return conId->gattCharC1Handle != nullptr && conId->gattCharC2Handle != nullptr;
816800
}
817801

818802
void BLEManagerImpl::AddConnectionData(const char * remoteAddr)
@@ -849,8 +833,6 @@ void BLEManagerImpl::AddConnectionData(const char * remoteAddr)
849833
}
850834
else
851835
{
852-
/* Local Device is BLE Peripheral Role, assume remote is CHIP Central */
853-
conn->isChipDevice = true;
854836

855837
/* Save own gatt handles */
856838
conn->gattCharC1Handle = mGattCharC1Handle;
@@ -873,48 +855,37 @@ void BLEManagerImpl::RemoveConnectionData(const char * remoteAddr)
873855
VerifyOrReturn(conn != nullptr,
874856
ChipLogError(DeviceLayer, "Connection does not exist for [%s]", StringOrNullMarker(remoteAddr)));
875857

876-
BLEManagerImpl::NotifyBLEDisconnection(conn);
858+
NotifyBLEDisconnection(conn);
877859
g_hash_table_remove(mConnectionMap, remoteAddr);
878860

879861
ChipLogProgress(DeviceLayer, "Connection Removed");
880862
}
881863

882-
void BLEManagerImpl::HandleC1CharWriteEvent(BLE_CONNECTION_OBJECT conId, const uint8_t * value, size_t len)
864+
void BLEManagerImpl::HandleC1CharWrite(BLE_CONNECTION_OBJECT conId, const uint8_t * value, size_t len)
883865
{
884-
CHIP_ERROR err = CHIP_NO_ERROR;
885-
System::PacketBufferHandle buf;
866+
System::PacketBufferHandle buf(System::PacketBufferHandle::NewWithData(value, len));
867+
VerifyOrReturn(!buf.IsNull(), ChipLogError(DeviceLayer, "Failed to allocate packet buffer in %s", __func__));
886868

887869
ChipLogProgress(DeviceLayer, "Write request received for CHIPoBLE Client TX characteristic (data len %u)",
888870
static_cast<unsigned int>(len));
889-
// Copy the data to a packet buffer.
890-
buf = System::PacketBufferHandle::NewWithData(value, len);
891-
VerifyOrExit(!buf.IsNull(), err = CHIP_ERROR_NO_MEMORY);
892-
NotifyBLEWriteReceived(conId, buf);
893-
return;
894-
exit:
895-
if (err != CHIP_NO_ERROR)
896-
{
897-
ChipLogError(DeviceLayer, "HandleC1CharWriteEvent() failed: %s", ErrorStr(err));
898-
}
871+
872+
ChipDeviceEvent event{ .Type = DeviceEventType::kCHIPoBLEWriteReceived,
873+
.CHIPoBLEWriteReceived = { .ConId = conId, .Data = std::move(buf).UnsafeRelease() } };
874+
PlatformMgr().PostEventOrDie(&event);
899875
}
900876

901-
void BLEManagerImpl::HandleRXCharChanged(BLE_CONNECTION_OBJECT conId, const uint8_t * value, size_t len)
877+
void BLEManagerImpl::HandleC2CharChanged(BLE_CONNECTION_OBJECT conId, const uint8_t * value, size_t len)
902878
{
903-
CHIP_ERROR err = CHIP_NO_ERROR;
904-
System::PacketBufferHandle buf;
879+
System::PacketBufferHandle buf(System::PacketBufferHandle::NewWithData(value, len));
880+
VerifyOrReturn(!buf.IsNull(), ChipLogError(DeviceLayer, "Failed to allocate packet buffer in %s", __func__));
905881

906882
ChipLogProgress(DeviceLayer, "Notification received on CHIPoBLE Client RX characteristic (data len %u)",
907883
static_cast<unsigned int>(len));
908-
// Copy the data to a packet buffer.
909-
buf = System::PacketBufferHandle::NewWithData(value, len);
910-
VerifyOrExit(!buf.IsNull(), err = CHIP_ERROR_NO_MEMORY);
911-
NotifyBLENotificationReceived(conId, buf);
912-
return;
913-
exit:
914-
if (err != CHIP_NO_ERROR)
915-
{
916-
ChipLogError(DeviceLayer, "HandleRXCharChanged() failed: %s", ErrorStr(err));
917-
}
884+
885+
ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformTizenBLEIndicationReceived,
886+
.Platform = {
887+
.BLEIndicationReceived = { .mConnection = conId, .mData = std::move(buf).UnsafeRelease() } } };
888+
PlatformMgr().PostEventOrDie(&event);
918889
}
919890

920891
void BLEManagerImpl::HandleConnectionEvent(bool connected, const char * remoteAddress)
@@ -1194,7 +1165,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event)
11941165

11951166
uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const
11961167
{
1197-
return (conId != nullptr) ? static_cast<uint16_t>(conId->mtu) : 0;
1168+
return (conId != BLE_CONNECTION_UNINITIALIZED) ? static_cast<uint16_t>(conId->mtu) : 0;
11981169
}
11991170

12001171
bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId,
@@ -1204,7 +1175,7 @@ bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const
12041175

12051176
ChipLogProgress(DeviceLayer, "SubscribeCharacteristic");
12061177

1207-
VerifyOrExit(conId != nullptr, ChipLogError(DeviceLayer, "Invalid Connection"));
1178+
VerifyOrExit(conId != BLE_CONNECTION_UNINITIALIZED, ChipLogError(DeviceLayer, "Invalid Connection"));
12081179
VerifyOrExit(Ble::UUIDsMatch(svcId, &Ble::CHIP_BLE_SVC_ID),
12091180
ChipLogError(DeviceLayer, "SubscribeCharacteristic() called with invalid service ID"));
12101181
VerifyOrExit(Ble::UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_2_UUID),
@@ -1213,7 +1184,7 @@ bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const
12131184

12141185
ChipLogProgress(DeviceLayer, "Sending Notification Enable Request to CHIP Peripheral: %s", conId->peerAddr);
12151186

1216-
ret = bt_gatt_client_set_characteristic_value_changed_cb(conId->gattCharC2Handle, CharacteristicNotificationCb, conId);
1187+
ret = bt_gatt_client_set_characteristic_value_changed_cb(conId->gattCharC2Handle, CharacteristicIndicationCb, conId);
12171188
VerifyOrExit(
12181189
ret == BT_ERROR_NONE,
12191190
ChipLogError(DeviceLayer, "bt_gatt_client_set_characteristic_value_changed_cb() failed: %s", get_error_message(ret)));
@@ -1232,7 +1203,7 @@ bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, cons
12321203

12331204
ChipLogProgress(DeviceLayer, "UnSubscribeCharacteristic");
12341205

1235-
VerifyOrExit(conId != nullptr, ChipLogError(DeviceLayer, "Invalid Connection"));
1206+
VerifyOrExit(conId != BLE_CONNECTION_UNINITIALIZED, ChipLogError(DeviceLayer, "Invalid Connection"));
12361207
VerifyOrExit(Ble::UUIDsMatch(svcId, &Ble::CHIP_BLE_SVC_ID),
12371208
ChipLogError(DeviceLayer, "UnSubscribeCharacteristic() called with invalid service ID"));
12381209
VerifyOrExit(Ble::UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_2_UUID),
@@ -1260,7 +1231,7 @@ bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId)
12601231
ChipLogProgress(DeviceLayer, "Close BLE Connection");
12611232

12621233
conId = static_cast<BLEConnection *>(g_hash_table_lookup(mConnectionMap, conId->peerAddr));
1263-
VerifyOrExit(conId != nullptr, ChipLogError(DeviceLayer, "Failed to find connection info"));
1234+
VerifyOrExit(conId != BLE_CONNECTION_UNINITIALIZED, ChipLogError(DeviceLayer, "Failed to find connection info"));
12641235

12651236
ChipLogProgress(DeviceLayer, "Send GATT disconnect to [%s]", conId->peerAddr);
12661237
ret = bt_gatt_disconnect(conId->peerAddr);
@@ -1278,10 +1249,8 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::Chip
12781249
{
12791250
int ret;
12801251

1281-
ChipLogProgress(DeviceLayer, "SendIndication");
1282-
12831252
conId = static_cast<BLEConnection *>(g_hash_table_lookup(mConnectionMap, conId->peerAddr));
1284-
VerifyOrExit(conId != nullptr, ChipLogError(DeviceLayer, "Failed to find connection info"));
1253+
VerifyOrExit(conId != BLE_CONNECTION_UNINITIALIZED, ChipLogError(DeviceLayer, "Failed to find connection info"));
12851254

12861255
ret = bt_gatt_set_value(mGattCharC2Handle, Uint8::to_const_char(pBuf->Start()), pBuf->DataLength());
12871256
VerifyOrExit(ret == BT_ERROR_NONE, ChipLogError(DeviceLayer, "bt_gatt_set_value() failed: %s", get_error_message(ret)));
@@ -1311,9 +1280,7 @@ bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::Ch
13111280
{
13121281
int ret;
13131282

1314-
ChipLogProgress(DeviceLayer, "SendWriteRequest");
1315-
1316-
VerifyOrExit(conId != nullptr, ChipLogError(DeviceLayer, "Invalid Connection"));
1283+
VerifyOrExit(conId != BLE_CONNECTION_UNINITIALIZED, ChipLogError(DeviceLayer, "Invalid Connection"));
13171284
VerifyOrExit(Ble::UUIDsMatch(svcId, &Ble::CHIP_BLE_SVC_ID),
13181285
ChipLogError(DeviceLayer, "SendWriteRequest() called with invalid service ID"));
13191286
VerifyOrExit(Ble::UUIDsMatch(charId, &Ble::CHIP_BLE_CHAR_1_UUID),

0 commit comments

Comments
 (0)