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()
|
||||
lastRxTimestamp = System.currentTimeMillis()
|
||||
watchdogRunning = true
|
||||
debugLogger.info("WATCHDOG_STARTED timeout=${watchdogTimeoutMs}ms")
|
||||
|
||||
watchdogJob = Thread({
|
||||
while (watchdogRunning) {
|
||||
@@ -630,19 +631,21 @@ class BleManager private constructor(private val context: Context) {
|
||||
}
|
||||
} else {
|
||||
logw { "CCCD descriptor not found for RX characteristic" }
|
||||
// No CCCD but still mark ready if characteristics exist
|
||||
handler.post {
|
||||
if (txCharacteristic != null && rxCharacteristic != null) {
|
||||
isServiceReady.value = true
|
||||
startBatteryPolling()
|
||||
startWatchdog()
|
||||
logd { "Service ready (no CCCD)" }
|
||||
}
|
||||
}
|
||||
}
|
||||
} ?: run {
|
||||
// No RX characteristic, mark ready if TX exists
|
||||
handler.post {
|
||||
if (txCharacteristic != null) {
|
||||
isServiceReady.value = true
|
||||
startBatteryPolling()
|
||||
startWatchdog()
|
||||
logd { "Service ready (no RX)" }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user