BLE 연결 파라미터 협상 복구
- 연결 5초 후 15 ms connection interval 요청 - Latency 0, supervision timeout 10 s 설정 요청 - 목표 파라미터 미적용 시 30초 간격으로 최대 3회 재요청 - Central이 최종 적용 여부 결정 - 요청 실패 또는 미적용 시에도 연결은 유지 * 연결 직후에는 pairing/security/초기 GATT 처리 때문에 요청이 무시되거나 늦게 반영될 수 있음 * 첫 요청 타이밍에 폰 상태가 안 좋아서 preferred 값이 안 먹을 수 있음 * 일정 시간 뒤 다시 요청하면 그때는 받아질 가능성이 있음 * 실패해도 연결을 끊지 않으므로 리스크가 크지 않음
This commit is contained in:
@@ -525,6 +525,7 @@ static void connected(struct bt_conn *conn, uint8_t err)
|
|||||||
|
|
||||||
conn_param_update_attempts = 0U;
|
conn_param_update_attempts = 0U;
|
||||||
last_rx_conn_param_update_ms = 0;
|
last_rx_conn_param_update_ms = 0;
|
||||||
|
k_work_schedule(&conn_param_update_work, K_MSEC(BLE_CONN_PARAM_FIRST_DELAY_MS));
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_BT_SMP)
|
#if IS_ENABLED(CONFIG_BT_SMP)
|
||||||
err = bt_conn_set_security(conn, BLE_REQUIRED_SECURITY_LEVEL);
|
err = bt_conn_set_security(conn, BLE_REQUIRED_SECURITY_LEVEL);
|
||||||
@@ -596,6 +597,11 @@ static void le_param_updated(struct bt_conn *conn, uint16_t interval,
|
|||||||
{
|
{
|
||||||
k_work_cancel_delayable(&conn_param_update_work);
|
k_work_cancel_delayable(&conn_param_update_work);
|
||||||
}
|
}
|
||||||
|
else if (conn_param_update_attempts < BLE_CONN_PARAM_MAX_ATTEMPTS)
|
||||||
|
{
|
||||||
|
k_work_schedule(&conn_param_update_work,
|
||||||
|
K_MSEC(BLE_CONN_PARAM_RETRY_INTERVAL_MS));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if IS_ENABLED(CONFIG_BT_SMP)
|
#if IS_ENABLED(CONFIG_BT_SMP)
|
||||||
|
|||||||
Reference in New Issue
Block a user