B:BD[
3.2705] → [
3.2705:3202]
B:BD[
3.3202] → [
2.196:301]
∅:D[
2.301] → [
3.3202:3263]
B:BD[
3.3202] → [
3.3202:3263]
B:BD[
3.3298] → [
3.3298:3498]
B:BD[
3.3498] → [
2.302:348]
if *is_unlock.lock().unwrap() != LockState::Locked {
est_time = Instant::now();
} else {
log::info!("0 {}", lock_time - est_time.elapsed().as_secs());
}
});
thread::spawn(move || {
let is_unlock = std::sync::Arc::clone(&is_unlock2);
if *is_unlock.lock().unwrap() == LockState::Locked && confirm_key() {
*is_unlock.lock().unwrap() = LockState::Unlocked(UnlockedState::Key);
println!("1 3");
std::fs::remove_file("/tmp/kilit").unwrap_or_default();
thread::sleep(Duration::from_secs(40 * 60));
*is_unlock.lock().unwrap() == LockState::Locked;
est_time = Instant::now();
log::info!("0 {}", lock_time - est_time.elapsed().as_secs());
}
})
.join()
.unwrap();
LockState::Unlocked(unlock) => match unlock {
UnlockedState::Usb(serial) => {
log::info!("1 0");
let devices = get_devices();
if !devices.iter().any(|d| &d.get_serial() == serial) {
lock_state = LockState::Locked;
}
}
UnlockedState::Key => {
log::info!("1 1");
thread::sleep(Duration::from_secs(60 * 40));
}
},
}