fromHealthz static method
- String body
null for anything but an ObservANT camera's /healthz answer, so other hosts show nothing; one that is
not ok still is one, with its problem.
Implementation
static DetectionStatus? fromHealthz(String body) {
final health = ObservantHealth.parse(body);
if (health == null || !health.hasDetection) {
return null;
}
return DetectionStatus(
dark: health.dark,
rotate: health.rotate,
pixelated: health.pixelated,
peers: health.peers,
problem: health.problem,
name: health.name,
inView: health.inView,
classes: health.classes ?? const <String>['cat'],
lastSeen: health.lastSeen,
visits: health.visits,
clip: health.clip,
clips: health.clips,
recent: <Visit>[
for (final visit in health.recent)
Visit(visit.arrived, visit.stayed, visit.className),
],
);
}