fix: watchdog 누락 경로 수정 + 시작 로그 추가
- CCCD 없는 경로(no CCCD, no RX)에서도 startWatchdog() + startBatteryPolling() 호출 - watchdog 시작 시 WATCHDOG_STARTED 로그 기록 (실제 동작 확인용) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -361,6 +361,7 @@ class BleManager private constructor(private val context: Context) {
|
|||||||
stopWatchdog()
|
stopWatchdog()
|
||||||
lastRxTimestamp = System.currentTimeMillis()
|
lastRxTimestamp = System.currentTimeMillis()
|
||||||
watchdogRunning = true
|
watchdogRunning = true
|
||||||
|
debugLogger.info("WATCHDOG_STARTED timeout=${watchdogTimeoutMs}ms")
|
||||||
|
|
||||||
watchdogJob = Thread({
|
watchdogJob = Thread({
|
||||||
while (watchdogRunning) {
|
while (watchdogRunning) {
|
||||||
@@ -630,19 +631,21 @@ class BleManager private constructor(private val context: Context) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logw { "CCCD descriptor not found for RX characteristic" }
|
logw { "CCCD descriptor not found for RX characteristic" }
|
||||||
// No CCCD but still mark ready if characteristics exist
|
|
||||||
handler.post {
|
handler.post {
|
||||||
if (txCharacteristic != null && rxCharacteristic != null) {
|
if (txCharacteristic != null && rxCharacteristic != null) {
|
||||||
isServiceReady.value = true
|
isServiceReady.value = true
|
||||||
|
startBatteryPolling()
|
||||||
|
startWatchdog()
|
||||||
logd { "Service ready (no CCCD)" }
|
logd { "Service ready (no CCCD)" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} ?: run {
|
} ?: run {
|
||||||
// No RX characteristic, mark ready if TX exists
|
|
||||||
handler.post {
|
handler.post {
|
||||||
if (txCharacteristic != null) {
|
if (txCharacteristic != null) {
|
||||||
isServiceReady.value = true
|
isServiceReady.value = true
|
||||||
|
startBatteryPolling()
|
||||||
|
startWatchdog()
|
||||||
logd { "Service ready (no RX)" }
|
logd { "Service ready (no RX)" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user