Skip to content

Commit db7bee8

Browse files
[EFR32] Switch support from BLE Notification to Indication (project-chip#21172)
* Remove notification support in BLE manager * Disable notification support in Gatt Server config file
1 parent 8ecce5e commit db7bee8

File tree

4 files changed

+21
-24
lines changed

4 files changed

+21
-24
lines changed

src/platform/EFR32/BLEManagerImpl.cpp

+6-20
Original file line numberDiff line numberDiff line change
@@ -423,12 +423,6 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event)
423423
}
424424
break;
425425

426-
case DeviceEventType::kCHIPoBLENotifyConfirm: {
427-
ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLENotifyConfirm");
428-
HandleTxConfirmationEvent(event->CHIPoBLENotifyConfirm.ConId);
429-
}
430-
break;
431-
432426
default:
433427
ChipLogProgress(DeviceLayer, "_OnPlatformEvent default: event->Type = %d", event->Type);
434428
break;
@@ -479,24 +473,16 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU
479473
sl_status_t ret;
480474
uint16_t cId = (UUIDsMatch(&ChipUUID_CHIPoBLEChar_RX, charId) ? gattdb_CHIPoBLEChar_Rx : gattdb_CHIPoBLEChar_Tx);
481475
uint8_t timerHandle = GetTimerHandle(conId, true);
482-
ChipDeviceEvent event;
483476

484477
VerifyOrExit(((conState != NULL) && (conState->subscribed != 0)), err = CHIP_ERROR_INVALID_ARGUMENT);
485478
VerifyOrExit(timerHandle != kMaxConnections, err = CHIP_ERROR_NO_MEMORY);
486479

487-
// start timer for light notification confirmation. Long delay for spake2 indication
480+
// start timer for light indication confirmation. Long delay for spake2 indication
488481
sl_bt_system_set_lazy_soft_timer(TIMER_S_2_TIMERTICK(6), 0, timerHandle, true);
489482

490-
ret = sl_bt_gatt_server_send_notification(conId, cId, (data->DataLength()), data->Start());
483+
ret = sl_bt_gatt_server_send_indication(conId, cId, (data->DataLength()), data->Start());
491484
err = MapBLEError(ret);
492485

493-
if (err == CHIP_NO_ERROR)
494-
{
495-
event.Type = DeviceEventType::kCHIPoBLENotifyConfirm;
496-
event.CHIPoBLENotifyConfirm.ConId = conId;
497-
err = PlatformMgr().PostEvent(&event);
498-
}
499-
500486
exit:
501487
if (err != CHIP_NO_ERROR)
502488
{
@@ -873,20 +859,20 @@ void BLEManagerImpl::HandleTXCharCCCDWrite(volatile sl_bt_msg_t * evt)
873859
{
874860
CHIP_ERROR err = CHIP_NO_ERROR;
875861
CHIPoBLEConState * bleConnState;
876-
bool isDisabled;
862+
bool isIndicationEnabled = false;
877863
ChipDeviceEvent event;
878864

879865
bleConnState = GetConnectionState(evt->data.evt_gatt_server_user_write_request.connection);
880866
VerifyOrExit(bleConnState != NULL, err = CHIP_ERROR_NO_MEMORY);
881867

882868
// Determine if the client is enabling or disabling notification/indication.
883-
isDisabled = (evt->data.evt_gatt_server_characteristic_status.client_config_flags == sl_bt_gatt_disable);
869+
isIndicationEnabled = (evt->data.evt_gatt_server_characteristic_status.client_config_flags == sl_bt_gatt_indication);
884870

885871
ChipLogProgress(DeviceLayer, "HandleTXcharCCCDWrite - Config Flags value : %d",
886872
evt->data.evt_gatt_server_characteristic_status.client_config_flags);
887-
ChipLogProgress(DeviceLayer, "CHIPoBLE %s received", isDisabled ? "unsubscribe" : "subscribe");
873+
ChipLogProgress(DeviceLayer, "CHIPoBLE %s received", isIndicationEnabled ? "subscribe" : "unsubscribe");
888874

889-
if (!isDisabled)
875+
if (isIndicationEnabled)
890876
{
891877
// If indications are not already enabled for the connection...
892878
if (!bleConnState->subscribed)

src/platform/EFR32/gatt_configuration.btconf src/platform/EFR32/btconf/gatt_configuration.btconf

-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@
8181
<write authenticated="false" bonded="false" encrypted="false"/>
8282
<write_no_response authenticated="false" bonded="false" encrypted="false"/>
8383
<indicate authenticated="false" bonded="false" encrypted="false"/>
84-
<notify authenticated="false" bonded="false" encrypted="false"/>
8584
</properties>
8685
</characteristic>
8786

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<gatt>
2+
<service advertise="false" id="ota" name="Silicon Labs OTA" requirement="mandatory" sourceId="com.silabs.service.ota" type="primary" uuid="1D14D6EE-FD63-4FA1-BFA4-8F47B42119F0">
3+
<informativeText>Abstract: The Silicon Labs OTA Service enables in-place over-the-air firmware update of the device. </informativeText>
4+
<characteristic const="false" id="ota_control" name="Silicon Labs OTA Control" sourceId="com.silabs.characteristic.ota_control" uuid="F7BF3564-FB6D-4E53-88A4-5E37E0326063">
5+
<informativeText>Abstract: Silicon Labs OTA Control. </informativeText>
6+
<value length="1" type="user" variable_length="false"/>
7+
<properties write="true">
8+
<write authenticated="false" bonded="false" encrypted="false"/>
9+
</properties>
10+
</characteristic>
11+
</service>
12+
</gatt>

src/platform/EFR32/gatt_db.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ GATT_DATA(const sli_bt_gattdb_value_t gattdb_attribute_field_28) = { .len = 16,
5555
0x1d,
5656
} };
5757
GATT_DATA(sli_bt_gattdb_attribute_chrvalue_t
58-
gattdb_attribute_field_24) = { .properties = 0x3e,
58+
gattdb_attribute_field_24) = { .properties = 0x2e,
5959
.max_len = 247,
6060
.len = 1,
6161
.data = {
@@ -353,7 +353,7 @@ GATT_DATA(const sli_bt_gattdb_attribute_t gattdb_attributes_map[]) = {
353353
.caps = 0xffff,
354354
.state = 0x00,
355355
.datatype = 0x05,
356-
.characteristic = { .properties = 0x3e, .char_uuid = 0x8001 } },
356+
.characteristic = { .properties = 0x2e, .char_uuid = 0x8001 } },
357357
{ .handle = 0x19,
358358
.uuid = 0x8001,
359359
.permissions = 0x807,
@@ -367,7 +367,7 @@ GATT_DATA(const sli_bt_gattdb_attribute_t gattdb_attributes_map[]) = {
367367
.caps = 0xffff,
368368
.state = 0x00,
369369
.datatype = 0x03,
370-
.configdata = { .flags = 0x03, .clientconfig_index = 0x01 } },
370+
.configdata = { .flags = 0x02, .clientconfig_index = 0x01 } },
371371
{ .handle = 0x1b,
372372
.uuid = 0x0002,
373373
.permissions = 0x801,

0 commit comments

Comments
 (0)