claim method
Marks deviceId as driven by this process, unless another live session holds it (that claim stays theirs); best effort, since a claim only guards against accidents.
Implementation
void claim(String deviceId, {String? app}) {
CallProgress.checkAlive();
if (heldByOther(deviceId) != null) return;
try {
Directory(dir).createSync(recursive: true);
_file(deviceId).writeAsStringSync(jsonEncode({
'pid': ownPid,
'since': DateTime.now().toIso8601String(),
if (app != null) 'app': app,
}));
} on Object {
// an unwritable home only loses the guard
}
}