dev 모드 BLE 연결 수정
- dev 모드인 경우 보안 x
This commit is contained in:
@@ -95,6 +95,14 @@ void ble_security_quick_pm_handler(pm_evt_t const *p_evt)
|
|||||||
{
|
{
|
||||||
ret_code_t err_code;
|
ret_code_t err_code;
|
||||||
|
|
||||||
|
// DEV 모드: 보안 실패 이벤트는 SDK 핸들러에 전달하지 않음 (disconnect 방지)
|
||||||
|
if (m_state.dev_mode && p_evt->evt_id == PM_EVT_CONN_SEC_FAILED) {
|
||||||
|
DBG_PRINTF("Security failed: error=%d\r\n",
|
||||||
|
p_evt->params.conn_sec_failed.error);
|
||||||
|
DBG_PRINTF("DEV: Ignoring sec failure, keeping connection\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Call standard handlers (required)
|
// Call standard handlers (required)
|
||||||
pm_handler_on_pm_evt(p_evt);
|
pm_handler_on_pm_evt(p_evt);
|
||||||
pm_handler_flash_clean(p_evt);
|
pm_handler_flash_clean(p_evt);
|
||||||
@@ -113,6 +121,12 @@ void ble_security_quick_pm_handler(pm_evt_t const *p_evt)
|
|||||||
DBG_PRINTF("Security failed: error=%d\r\n",
|
DBG_PRINTF("Security failed: error=%d\r\n",
|
||||||
p_evt->params.conn_sec_failed.error);
|
p_evt->params.conn_sec_failed.error);
|
||||||
|
|
||||||
|
if (m_state.dev_mode) {
|
||||||
|
// DEV 모드: 보안 실패 무시 — 연결 유지
|
||||||
|
DBG_PRINTF("DEV: Ignoring sec failure, keeping connection\r\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (p_evt->params.conn_sec_failed.error == PM_CONN_SEC_ERROR_PIN_OR_KEY_MISSING) {
|
if (p_evt->params.conn_sec_failed.error == PM_CONN_SEC_ERROR_PIN_OR_KEY_MISSING) {
|
||||||
// Key missing: 재페어링 시도, 실패 시 disconnect로 폴백
|
// Key missing: 재페어링 시도, 실패 시 disconnect로 폴백
|
||||||
err_code = pm_conn_secure(p_evt->conn_handle, true);
|
err_code = pm_conn_secure(p_evt->conn_handle, true);
|
||||||
|
|||||||
@@ -1016,7 +1016,9 @@ static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if FEATURE_SECURE_CONNECTION
|
#if FEATURE_SECURE_CONNECTION
|
||||||
pm_handler_secure_on_connection(p_ble_evt);
|
if (!ble_security_is_dev_mode()) {
|
||||||
|
pm_handler_secure_on_connection(p_ble_evt);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (p_ble_evt->header.evt_id)
|
switch (p_ble_evt->header.evt_id)
|
||||||
@@ -1098,10 +1100,18 @@ static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
|
|||||||
|
|
||||||
case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
|
case BLE_GAP_EVT_SEC_PARAMS_REQUEST:
|
||||||
#if !FEATURE_SECURE_CONNECTION
|
#if !FEATURE_SECURE_CONNECTION
|
||||||
err_code = sd_ble_gap_sec_params_reply(m_conn_handle,
|
err_code = sd_ble_gap_sec_params_reply(m_conn_handle,
|
||||||
BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP,
|
BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
APP_ERROR_CHECK(err_code);
|
APP_ERROR_CHECK(err_code);
|
||||||
|
#else
|
||||||
|
if (ble_security_is_dev_mode()) {
|
||||||
|
err_code = sd_ble_gap_sec_params_reply(m_conn_handle,
|
||||||
|
BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP,
|
||||||
|
NULL, NULL);
|
||||||
|
APP_ERROR_CHECK(err_code);
|
||||||
|
DBG_PRINTF("DEV: Rejected security request\r\n");
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user