From 50a8e68cf4a30f088ecb537b1469e1a50ce74ce0 Mon Sep 17 00:00:00 2001 From: jhchun Date: Tue, 21 Apr 2026 09:41:12 +0900 Subject: [PATCH] =?UTF-8?q?BLE=20=EC=9D=B8=EC=A6=9D=20=EC=A0=84=20NUS=20?= =?UTF-8?q?=EB=AA=85=EB=A0=B9=20=EC=8B=A4=ED=96=89=20=EB=B0=A9=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - GAP 연결 시 PROD 모드에서 ble_connection_st 조기 활성화 제거(보안 인증 후 활성화) - nus_data_handler()에 인증 상태 검증 가드 추가(ble_connection_st가 0인 경우 받지 않고 즉시 리턴) --- .../ble_peripheral/ble_app_bladder_patch/main.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/project/ble_peripheral/ble_app_bladder_patch/main.c b/project/ble_peripheral/ble_app_bladder_patch/main.c index a5817a6..0f8846e 100644 --- a/project/ble_peripheral/ble_app_bladder_patch/main.c +++ b/project/ble_peripheral/ble_app_bladder_patch/main.c @@ -573,6 +573,11 @@ static void nus_data_handler(ble_nus_evt_t * p_evt) { if (p_evt->type == BLE_NUS_EVT_RX_DATA) { + if (!ble_connection_st) + { + return; /* Reject command before security is established */ + } + cmd_type_t = CMD_BLE; ble_got_new_data = true; @@ -1048,11 +1053,14 @@ static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context) break; case BLE_GAP_EVT_CONNECTED: - DBG_PRINTF("[BLE] Connected\r\n"); + DBG_PRINTF("[BLE] GAP Connected\r\n"); #if FEATURE_SECURE_CONNECTION - ble_connection_st = 1; - battery_timer_start(); + if (BLE_DEV_MODE) + { + ble_connection_st = 1; + battery_timer_start(); + } #endif m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;