Clinical: BLE Connected 카드에 Unpair 버튼 추가 — 측정 후 페어링 끊기 편의

PiezoMonitoring의 'Delete' 패턴과 동일: confirm dialog → bleManager.disconnectAndUnbond().
ClinicalHome에 머무르므로 곧바로 BLE 카드가 Not Connected 상태로 전환되어
다음 사람 측정 전에 Connect 버튼 활성화.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-01 17:46:54 +09:00
parent 010e9acfbd
commit c0394f63b7
@@ -84,6 +84,7 @@ fun ClinicalHomeView(appState: AppState) {
mutableStateOf(lastFolder?.let { LabdbUploader.lastError(it) })
}
var uploadBusy by remember { mutableStateOf(false) }
var showUnpairConfirm by remember { mutableStateOf(false) }
// 진입 시 status 자동 확인 (apiKey 있을 때만)
LaunchedEffect(Unit) {
@@ -151,6 +152,10 @@ fun ClinicalHomeView(appState: AppState) {
fontWeight = FontWeight.SemiBold)
}
}
OutlinedButton(
onClick = { showUnpairConfirm = true },
colors = ButtonDefaults.outlinedButtonColors(contentColor = Color(0xFFE53935))
) { Text("Unpair", fontSize = 12.sp) }
} else {
Text("BLE Not Connected", fontWeight = FontWeight.Bold, fontSize = 14.sp,
color = Color(0xFFFF9800), modifier = Modifier.weight(1f))
@@ -441,6 +446,24 @@ fun ClinicalHomeView(appState: AppState) {
Text("저장 위치: Downloads/VesiScan_Sessions/",
fontSize = 10.sp, color = MlSecondaryText)
}
if (showUnpairConfirm) {
AlertDialog(
onDismissRequest = { showUnpairConfirm = false },
title = { Text("Delete pairing?") },
text = { Text("기기 본딩을 삭제하고 연결을 끊습니다. 다음 측정 시 다시 페어링이 필요합니다.") },
confirmButton = {
TextButton(onClick = {
showUnpairConfirm = false
bleManager.disconnectAndUnbond()
Toast.makeText(context, "Unpaired", Toast.LENGTH_SHORT).show()
}) { Text("Delete", color = Color.Red) }
},
dismissButton = {
TextButton(onClick = { showUnpairConfirm = false }) { Text("Cancel") }
}
)
}
}
@Composable