diff --git a/src/platform/silabs/BLEManagerImpl.h b/src/platform/silabs/BLEManagerImpl.h index 214fef8559..9919e8a091 100644 --- a/src/platform/silabs/BLEManagerImpl.h +++ b/src/platform/silabs/BLEManagerImpl.h @@ -68,6 +68,7 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla int32_t SendBLEAdvertisementCommand(void); #else void HandleConnectEvent(volatile sl_bt_msg_t * evt); + void HandleConnectParams(volatile sl_bt_msg_t * evt); void HandleConnectionCloseEvent(volatile sl_bt_msg_t * evt); void HandleWriteEvent(volatile sl_bt_msg_t * evt); void UpdateMtu(volatile sl_bt_msg_t * evt); diff --git a/src/platform/silabs/efr32/BLEManagerImpl.cpp b/src/platform/silabs/efr32/BLEManagerImpl.cpp index ef553bffa1..1f8704896f 100644 --- a/src/platform/silabs/efr32/BLEManagerImpl.cpp +++ b/src/platform/silabs/efr32/BLEManagerImpl.cpp @@ -674,6 +674,21 @@ void BLEManagerImpl::HandleConnectEvent(volatile sl_bt_msg_t * evt) PlatformMgr().ScheduleWork(DriveBLEState, 0); } +void BLEManagerImpl::HandleConnectParams(volatile sl_bt_msg_t * evt) +{ + sl_bt_evt_connection_parameters_t * con_param_evt = (sl_bt_evt_connection_parameters_t *) &(evt->data); + + if (con_param_evt->timeout < BLE_CONFIG_TIMEOUT) + { + ChipLogProgress(DeviceLayer, "Request to increase the connection timeout from %d to %d", con_param_evt->timeout, + BLE_CONFIG_TIMEOUT); + sl_bt_connection_set_parameters(con_param_evt->connection, BLE_CONFIG_MIN_INTERVAL, BLE_CONFIG_MAX_INTERVAL, + BLE_CONFIG_LATENCY, BLE_CONFIG_TIMEOUT, BLE_CONFIG_MIN_CE_LENGTH, BLE_CONFIG_MAX_CE_LENGTH); + } + + PlatformMgr().ScheduleWork(DriveBLEState, 0); +} + void BLEManagerImpl::HandleConnectionCloseEvent(volatile sl_bt_msg_t * evt) { sl_bt_evt_connection_closed_t * conn_evt = (sl_bt_evt_connection_closed_t *) &(evt->data); @@ -1061,11 +1076,20 @@ extern "C" void sl_bt_on_event(sl_bt_msg_t * evt) } break; case sl_bt_evt_connection_parameters_id: { - // ChipLogProgress(DeviceLayer, "Connection parameter ID received"); + ChipLogProgress(DeviceLayer, "Connection parameter ID received - i:%d, l:%d, t:%d, sm:%d", + evt->data.evt_connection_parameters.interval, evt->data.evt_connection_parameters.latency, + evt->data.evt_connection_parameters.timeout, evt->data.evt_connection_parameters.security_mode); + chip::DeviceLayer::Internal::BLEMgrImpl().HandleConnectParams(evt); } break; case sl_bt_evt_connection_phy_status_id: { - // ChipLogProgress(DeviceLayer, "PHY update procedure is completed"); + ChipLogProgress(DeviceLayer, "Connection phy status ID received - phy:%d", evt->data.evt_connection_phy_status.phy); + } + break; + case sl_bt_evt_connection_data_length_id: { + ChipLogProgress(DeviceLayer, "Connection data length ID received - txL:%d, txT:%d, rxL:%d, rxL:%d", + evt->data.evt_connection_data_length.tx_data_len, evt->data.evt_connection_data_length.tx_time_us, + evt->data.evt_connection_data_length.rx_data_len, evt->data.evt_connection_data_length.rx_time_us); } break; case sl_bt_evt_connection_closed_id: {