client/models/server: wire event_count from SUB 08 event index into connect()

- DeviceInfo.event_count: Optional[int] = None  (new field in models.py)
- connect() now calls proto.read_event_index() after compliance config and
  stores the decoded count in device_info.event_count
- _serialise_device_info() exposes event_count in /device/info and /device/events
  JSON responses

event_count is decoded from uint32 BE at offset +3 of the 88-byte F7 payload
(🔶 inferred — needs live device confirmation against a multi-event device).
Any ProtocolError from the index read is caught and logged; event_count stays
None rather than failing the whole connect().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Brian Harrison
2026-04-02 02:00:37 -04:00
parent 870a10365e
commit 6eecd0c1d1
3 changed files with 14 additions and 1 deletions

View File

@@ -145,6 +145,7 @@ def _serialise_device_info(info: DeviceInfo) -> dict:
"dsp_version": info.dsp_version,
"manufacturer": info.manufacturer,
"model": info.model,
"event_count": info.event_count,
"compliance_config": _serialise_compliance_config(info.compliance_config),
}