Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8fdc153ed5 | |||
| d8ef9bcb41 |
@@ -95,6 +95,14 @@ void ble_security_quick_pm_handler(pm_evt_t const *p_evt)
|
||||
{
|
||||
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)
|
||||
pm_handler_on_pm_evt(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",
|
||||
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) {
|
||||
// Key missing: 재페어링 시도, 실패 시 disconnect로 폴백
|
||||
err_code = pm_conn_secure(p_evt->conn_handle, true);
|
||||
|
||||
@@ -49,7 +49,7 @@ static const led_pattern_t m_patterns[LED_STATE_COUNT] =
|
||||
[LED_STATE_OFF] = { 0, 0, COLOR_NONE, false },
|
||||
[LED_STATE_POWER_ON] = { 2000, 0, COLOR_GREEN, false }, /* 초록 점등 2초 → 유지 */
|
||||
[LED_STATE_POWER_OFF] = { 2000, 0, COLOR_GREEN, false }, /* 초록 점등 2초 → OFF */
|
||||
[LED_STATE_ADVERTISING] = { 1000, 1000, COLOR_GREEN, true }, /* 초록 점멸 1초 */
|
||||
[LED_STATE_ADVERTISING] = { 500, 500, COLOR_GREEN, true }, /* 초록 점멸 1초 */
|
||||
[LED_STATE_DETACH_WARNING] = { 1000, 3000, COLOR_GREEN, true }, /* 초록 1초 on / 3초 off */
|
||||
[LED_STATE_ALIGN_SEARCHING] = { 1000, 1000, COLOR_ORANGE, true }, /* 주황 점멸 1초 */
|
||||
[LED_STATE_ALIGN_COMPLETE] = { 3000, 1000, COLOR_GREEN, true }, /* 초록 3초 on / 1초 off */
|
||||
|
||||
@@ -1016,7 +1016,9 @@ static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
|
||||
#endif
|
||||
|
||||
#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
|
||||
|
||||
switch (p_ble_evt->header.evt_id)
|
||||
@@ -1102,6 +1104,14 @@ static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
|
||||
BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP,
|
||||
NULL, NULL);
|
||||
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
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user