DFU(SMP) 전환 시 10분 타임아웃 추가
- SMP UUID로 광고 시 일반 NUS 스캔이 불가능 - DFU가 시작되지 못한 채 방치되는 경우 대비
This commit is contained in:
+12
-3
@@ -406,7 +406,8 @@ static void adv_timeout_handler(struct k_work *work)
|
||||
{
|
||||
ARG_UNUSED(work);
|
||||
|
||||
if (!ble_connection_st && !advertising_unlimited && !dfu_advertising_mode)
|
||||
// 미연결 상태에서만 발동하므로 DFU 광고도 동일하게 10분 후 종료(연결 중이면 발동 안 함)
|
||||
if (!ble_connection_st && !advertising_unlimited)
|
||||
{
|
||||
DBG_PRINTF("[BLE] Advertising timeout\r\n");
|
||||
(void)ble_advertising_stop();
|
||||
@@ -558,7 +559,15 @@ static void disconnected(struct bt_conn *conn, uint8_t reason)
|
||||
}
|
||||
|
||||
ble_connection_st = false;
|
||||
advertising_unlimited = ble_disconnect_reason_uses_unlimited_adv(reason);
|
||||
if (dfu_advertising_mode)
|
||||
{
|
||||
// DFU 광고는 미연결 10분 타임아웃 적용
|
||||
advertising_unlimited = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
advertising_unlimited = ble_disconnect_reason_uses_unlimited_adv(reason);
|
||||
}
|
||||
DBG_CORE("[BLE] Disconnected reason=0x%02x adv=%s\r\n",
|
||||
reason,
|
||||
advertising_unlimited ? "unlimited" : "10min");
|
||||
@@ -747,7 +756,7 @@ int ble_advertising_start(void)
|
||||
}
|
||||
|
||||
k_work_cancel_delayable(&adv_timeout_work);
|
||||
if (!advertising_unlimited && !dfu_advertising_mode)
|
||||
if (!advertising_unlimited) // DFU 광고 포함, 미연결 10분 시 전원 OFF
|
||||
{
|
||||
k_work_schedule(&adv_timeout_work, K_MSEC(APP_ADV_DURATION * 10));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user