Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CSA-CP]ble connection parameters negociation #91

Merged
merged 1 commit into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/platform/silabs/BLEManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
28 changes: 26 additions & 2 deletions src/platform/silabs/efr32/BLEManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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: {
Expand Down
Loading