@@ -90,10 +90,8 @@ struct BLEConnection
90
90
{
91
91
char * peerAddr;
92
92
unsigned int mtu;
93
- bool subscribed;
94
93
bt_gatt_h gattCharC1Handle;
95
94
bt_gatt_h gattCharC2Handle;
96
- bool isChipDevice;
97
95
};
98
96
99
97
static void __BLEConnectionFree (BLEConnection * conn)
@@ -203,7 +201,7 @@ void BLEManagerImpl::ReadValueRequestedCb(const char * remoteAddress, int reques
203
201
GAutoPtr<char > value;
204
202
205
203
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" ));
207
205
ChipLogProgress (DeviceLayer, " Gatt read requested on %s: uuid=%s" , __ConvertAttTypeToStr (type), StringOrNullMarker (uuid.get ()));
208
206
209
207
ret = bt_gatt_get_value (gattHandle, &value.GetReceiver (), &len);
@@ -231,7 +229,7 @@ void BLEManagerImpl::WriteValueRequestedCb(const char * remoteAddress, int reque
231
229
VerifyOrReturn (conn != nullptr , ChipLogError (DeviceLayer, " Failed to find connection info" ));
232
230
233
231
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" ));
235
233
ChipLogProgress (DeviceLayer, " Gatt write requested on %s: uuid=%s len=%d" , __ConvertAttTypeToStr (type),
236
234
StringOrNullMarker (uuid.get ()), len);
237
235
ChipLogByteSpan (DeviceLayer, ByteSpan (Uint8::from_const_char (value), len));
@@ -243,10 +241,10 @@ void BLEManagerImpl::WriteValueRequestedCb(const char * remoteAddress, int reque
243
241
VerifyOrReturn (ret == BT_ERROR_NONE,
244
242
ChipLogError (DeviceLayer, " bt_gatt_server_send_response() failed: %s" , get_error_message (ret)));
245
243
246
- HandleC1CharWriteEvent (conn, Uint8::from_const_char (value), len);
244
+ HandleC1CharWrite (conn, Uint8::from_const_char (value), len);
247
245
}
248
246
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)
250
248
{
251
249
GAutoPtr<char > uuid;
252
250
BLEConnection * conn = nullptr ;
@@ -267,9 +265,9 @@ void BLEManagerImpl::NotificationStateChangedCb(bool notify, bt_gatt_server_h se
267
265
268
266
int ret = __GetAttInfo (charHandle, &uuid.GetReceiver (), &type);
269
267
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)));
271
269
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),
273
271
StringOrNullMarker (uuid.get ()));
274
272
NotifyBLESubscribed (conn, notify ? true : false );
275
273
}
@@ -286,16 +284,16 @@ void BLEManagerImpl::WriteCompletedCb(int result, bt_gatt_h gattHandle, void * u
286
284
sInstance .NotifyHandleWriteComplete (conn);
287
285
}
288
286
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)
290
288
{
291
289
auto conn = static_cast <BLEConnection *>(userData);
292
290
293
291
VerifyOrReturn (value != nullptr );
294
292
VerifyOrReturn (conn != nullptr , ChipLogError (DeviceLayer, " Connection object is invalid" ));
295
293
VerifyOrReturn (conn->gattCharC2Handle == characteristic, ChipLogError (DeviceLayer, " Gatt characteristic handle did not match" ));
296
294
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);
299
297
}
300
298
301
299
void BLEManagerImpl::IndicationConfirmationCb (int result, const char * remoteAddress, bt_gatt_server_h server,
@@ -373,21 +371,6 @@ void BLEManagerImpl::NotifyBLEPeripheralAdvStopComplete(CHIP_ERROR error)
373
371
PlatformMgr ().PostEventOrDie (&event);
374
372
}
375
373
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
-
391
374
void BLEManagerImpl::NotifyBLESubscribed (BLE_CONNECTION_OBJECT conId, bool indicationsEnabled)
392
375
{
393
376
ChipDeviceEvent event{ .Type = indicationsEnabled ? DeviceEventType::kCHIPoBLESubscribe : DeviceEventType::kCHIPoBLEUnsubscribe ,
@@ -595,8 +578,8 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer()
595
578
ChipLogError (DeviceLayer, " bt_gatt_service_add_characteristic() failed: %s" , get_error_message (ret)));
596
579
597
580
// 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);
600
583
VerifyOrExit (ret == BT_ERROR_NONE,
601
584
ChipLogError (DeviceLayer, " bt_gatt_characteristic_create() failed: %s" , get_error_message (ret)));
602
585
@@ -613,7 +596,7 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer()
613
596
ret = bt_gatt_server_set_characteristic_notification_state_change_cb (
614
597
char2,
615
598
+[](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);
617
600
},
618
601
this );
619
602
VerifyOrExit (ret == BT_ERROR_NONE,
@@ -641,15 +624,15 @@ CHIP_ERROR BLEManagerImpl::RegisterGATTServer()
641
624
ret = bt_gatt_server_start ();
642
625
VerifyOrExit (ret == BT_ERROR_NONE, ChipLogError (DeviceLayer, " bt_gatt_server_start() failed: %s" , get_error_message (ret)));
643
626
644
- BLEManagerImpl:: NotifyBLEPeripheralGATTServerRegisterComplete (CHIP_NO_ERROR);
627
+ NotifyBLEPeripheralGATTServerRegisterComplete (CHIP_NO_ERROR);
645
628
646
629
// Save the Local Peripheral char1 & char2 handles
647
630
mGattCharC1Handle = char1;
648
631
mGattCharC2Handle = char2;
649
632
return CHIP_NO_ERROR;
650
633
651
634
exit :
652
- BLEManagerImpl:: NotifyBLEPeripheralGATTServerRegisterComplete (TizenToChipError (ret));
635
+ NotifyBLEPeripheralGATTServerRegisterComplete (TizenToChipError (ret));
653
636
return TizenToChipError (ret);
654
637
}
655
638
@@ -718,7 +701,7 @@ CHIP_ERROR BLEManagerImpl::StartBLEAdvertising()
718
701
VerifyOrExit (ret == BT_ERROR_NONE,
719
702
ChipLogError (DeviceLayer, " bt_adapter_le_set_advertising_device_name() failed: %s" , get_error_message (ret)));
720
703
721
- BLEManagerImpl:: NotifyBLEPeripheralAdvConfiguredComplete (CHIP_NO_ERROR);
704
+ NotifyBLEPeripheralAdvConfiguredComplete (CHIP_NO_ERROR);
722
705
723
706
ret = bt_adapter_le_start_advertising_new (
724
707
mAdvertiser ,
@@ -734,7 +717,7 @@ CHIP_ERROR BLEManagerImpl::StartBLEAdvertising()
734
717
735
718
exit :
736
719
err = ret != BT_ERROR_NONE ? TizenToChipError (ret) : err;
737
- BLEManagerImpl:: NotifyBLEPeripheralAdvStartComplete (err);
720
+ NotifyBLEPeripheralAdvStartComplete (err);
738
721
return err;
739
722
}
740
723
@@ -750,7 +733,7 @@ CHIP_ERROR BLEManagerImpl::StopBLEAdvertising()
750
733
return CHIP_NO_ERROR;
751
734
752
735
exit :
753
- BLEManagerImpl:: NotifyBLEPeripheralAdvStopComplete (TizenToChipError (ret));
736
+ NotifyBLEPeripheralAdvStopComplete (TizenToChipError (ret));
754
737
return TizenToChipError (ret);
755
738
}
756
739
@@ -762,7 +745,7 @@ static bool __GattClientForeachCharCb(int total, int index, bt_gatt_h charHandle
762
745
763
746
int ret = __GetAttInfo (charHandle, &uuid.GetReceiver (), &type);
764
747
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)));
766
749
767
750
if (strcasecmp (uuid.get (), Ble::CHIP_BLE_CHAR_1_UUID_STR) == 0 )
768
751
{
@@ -785,18 +768,18 @@ static bool __GattClientForeachServiceCb(int total, int index, bt_gatt_h svcHand
785
768
bt_gatt_type_e type;
786
769
GAutoPtr<char > uuid;
787
770
auto conn = static_cast <BLEConnection *>(data);
788
- ChipLogProgress (DeviceLayer, " __GattClientForeachServiceCb" );
789
771
790
772
int ret = __GetAttInfo (svcHandle, &uuid.GetReceiver (), &type);
791
773
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)));
793
775
794
776
if (strcasecmp (uuid.get (), chip::Ble::CHIP_BLE_SERVICE_LONG_UUID_STR) == 0 )
795
777
{
796
778
ChipLogProgress (DeviceLayer, " CHIP Service UUID Found [%s]" , StringOrNullMarker (uuid.get ()));
797
779
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)));
800
783
801
784
/* Got CHIP Device, no need to process further service */
802
785
return false ;
@@ -809,10 +792,11 @@ static bool __GattClientForeachServiceCb(int total, int index, bt_gatt_h svcHand
809
792
810
793
bool BLEManagerImpl::IsDeviceChipPeripheral (BLE_CONNECTION_OBJECT conId)
811
794
{
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 ;
816
800
}
817
801
818
802
void BLEManagerImpl::AddConnectionData (const char * remoteAddr)
@@ -849,8 +833,6 @@ void BLEManagerImpl::AddConnectionData(const char * remoteAddr)
849
833
}
850
834
else
851
835
{
852
- /* Local Device is BLE Peripheral Role, assume remote is CHIP Central */
853
- conn->isChipDevice = true ;
854
836
855
837
/* Save own gatt handles */
856
838
conn->gattCharC1Handle = mGattCharC1Handle ;
@@ -873,48 +855,37 @@ void BLEManagerImpl::RemoveConnectionData(const char * remoteAddr)
873
855
VerifyOrReturn (conn != nullptr ,
874
856
ChipLogError (DeviceLayer, " Connection does not exist for [%s]" , StringOrNullMarker (remoteAddr)));
875
857
876
- BLEManagerImpl:: NotifyBLEDisconnection (conn);
858
+ NotifyBLEDisconnection (conn);
877
859
g_hash_table_remove (mConnectionMap , remoteAddr);
878
860
879
861
ChipLogProgress (DeviceLayer, " Connection Removed" );
880
862
}
881
863
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)
883
865
{
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__)) ;
886
868
887
869
ChipLogProgress (DeviceLayer, " Write request received for CHIPoBLE Client TX characteristic (data len %u)" ,
888
870
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);
899
875
}
900
876
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)
902
878
{
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__)) ;
905
881
906
882
ChipLogProgress (DeviceLayer, " Notification received on CHIPoBLE Client RX characteristic (data len %u)" ,
907
883
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);
918
889
}
919
890
920
891
void BLEManagerImpl::HandleConnectionEvent (bool connected, const char * remoteAddress)
@@ -1194,7 +1165,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event)
1194
1165
1195
1166
uint16_t BLEManagerImpl::GetMTU (BLE_CONNECTION_OBJECT conId) const
1196
1167
{
1197
- return (conId != nullptr ) ? static_cast <uint16_t >(conId->mtu ) : 0 ;
1168
+ return (conId != BLE_CONNECTION_UNINITIALIZED ) ? static_cast <uint16_t >(conId->mtu ) : 0 ;
1198
1169
}
1199
1170
1200
1171
bool BLEManagerImpl::SubscribeCharacteristic (BLE_CONNECTION_OBJECT conId, const Ble::ChipBleUUID * svcId,
@@ -1204,7 +1175,7 @@ bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const
1204
1175
1205
1176
ChipLogProgress (DeviceLayer, " SubscribeCharacteristic" );
1206
1177
1207
- VerifyOrExit (conId != nullptr , ChipLogError (DeviceLayer, " Invalid Connection" ));
1178
+ VerifyOrExit (conId != BLE_CONNECTION_UNINITIALIZED , ChipLogError (DeviceLayer, " Invalid Connection" ));
1208
1179
VerifyOrExit (Ble::UUIDsMatch (svcId, &Ble::CHIP_BLE_SVC_ID),
1209
1180
ChipLogError (DeviceLayer, " SubscribeCharacteristic() called with invalid service ID" ));
1210
1181
VerifyOrExit (Ble::UUIDsMatch (charId, &Ble::CHIP_BLE_CHAR_2_UUID),
@@ -1213,7 +1184,7 @@ bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const
1213
1184
1214
1185
ChipLogProgress (DeviceLayer, " Sending Notification Enable Request to CHIP Peripheral: %s" , conId->peerAddr );
1215
1186
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);
1217
1188
VerifyOrExit (
1218
1189
ret == BT_ERROR_NONE,
1219
1190
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
1232
1203
1233
1204
ChipLogProgress (DeviceLayer, " UnSubscribeCharacteristic" );
1234
1205
1235
- VerifyOrExit (conId != nullptr , ChipLogError (DeviceLayer, " Invalid Connection" ));
1206
+ VerifyOrExit (conId != BLE_CONNECTION_UNINITIALIZED , ChipLogError (DeviceLayer, " Invalid Connection" ));
1236
1207
VerifyOrExit (Ble::UUIDsMatch (svcId, &Ble::CHIP_BLE_SVC_ID),
1237
1208
ChipLogError (DeviceLayer, " UnSubscribeCharacteristic() called with invalid service ID" ));
1238
1209
VerifyOrExit (Ble::UUIDsMatch (charId, &Ble::CHIP_BLE_CHAR_2_UUID),
@@ -1260,7 +1231,7 @@ bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId)
1260
1231
ChipLogProgress (DeviceLayer, " Close BLE Connection" );
1261
1232
1262
1233
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" ));
1264
1235
1265
1236
ChipLogProgress (DeviceLayer, " Send GATT disconnect to [%s]" , conId->peerAddr );
1266
1237
ret = bt_gatt_disconnect (conId->peerAddr );
@@ -1278,10 +1249,8 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const Ble::Chip
1278
1249
{
1279
1250
int ret;
1280
1251
1281
- ChipLogProgress (DeviceLayer, " SendIndication" );
1282
-
1283
1252
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" ));
1285
1254
1286
1255
ret = bt_gatt_set_value (mGattCharC2Handle , Uint8::to_const_char (pBuf->Start ()), pBuf->DataLength ());
1287
1256
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
1311
1280
{
1312
1281
int ret;
1313
1282
1314
- ChipLogProgress (DeviceLayer, " SendWriteRequest" );
1315
-
1316
- VerifyOrExit (conId != nullptr , ChipLogError (DeviceLayer, " Invalid Connection" ));
1283
+ VerifyOrExit (conId != BLE_CONNECTION_UNINITIALIZED, ChipLogError (DeviceLayer, " Invalid Connection" ));
1317
1284
VerifyOrExit (Ble::UUIDsMatch (svcId, &Ble::CHIP_BLE_SVC_ID),
1318
1285
ChipLogError (DeviceLayer, " SendWriteRequest() called with invalid service ID" ));
1319
1286
VerifyOrExit (Ble::UUIDsMatch (charId, &Ble::CHIP_BLE_CHAR_1_UUID),
0 commit comments