feat(sfm): start/stop monitoring for Series 3 through the same safety layer
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
This commit is contained in:
1 parent
78c3d568d5
commit
ce5d2cb0d6
5 files changed
+332
-106
No files matched your search
@@ -74,10 +74,14 @@ def default_s3_events():
|
||||
|
||||
|
||||
class FakeMiniMateClient(_Base):
|
||||
def __init__(self, serial="BE18193", *, monitoring=False, compliance="default", events=None, **kw):
|
||||
def __init__(self, serial="BE18193", *, monitoring=False, compliance="default", events=None,
|
||||
monitor_states=None, write_error=None, **kw):
|
||||
super().__init__(**kw)
|
||||
self.serial = serial
|
||||
self.monitoring = monitoring
|
||||
self.monitor_states = list(monitor_states) if monitor_states else [monitoring]
|
||||
self.write_error = write_error
|
||||
self.writes: list = []
|
||||
if compliance == "default":
|
||||
compliance = ComplianceConfig(
|
||||
recording_mode=0x01, sample_rate=1024, histogram_interval_sec=300,
|
||||
@@ -103,12 +107,25 @@ class FakeMiniMateClient(_Base):
|
||||
|
||||
def get_monitor_status(self) -> MonitorStatus:
|
||||
self._step("get_monitor_status")
|
||||
state = self.monitor_states.pop(0) if len(self.monitor_states) > 1 else self.monitor_states[0]
|
||||
return MonitorStatus(
|
||||
is_monitoring=self.monitoring, battery_v=6.8,
|
||||
is_monitoring=state, battery_v=6.8,
|
||||
memory_total=983026, memory_free=900000,
|
||||
)
|
||||
|
||||
|
||||
def _write(self, name):
|
||||
self._step(name)
|
||||
self.writes.append(name)
|
||||
if self.write_error is not None:
|
||||
raise self.write_error
|
||||
|
||||
def start_monitoring(self) -> None:
|
||||
self._write("start_monitoring")
|
||||
|
||||
def stop_monitoring(self) -> None:
|
||||
self._write("stop_monitoring")
|
||||
|
||||
def list_event_headers(self):
|
||||
self._step("list_event_headers")
|
||||
out = []
|
||||
|
||||
Reference in new issue
Block a user