cremalink.ecam.answers module

Dispatch and parse machine answer (0xD0) frames.

Every 0xD0 blob echoes the request id at byte[2] and the request’s flag at byte[3] — response routing keys on that echo, never on the property the blob arrived under (APK b1()/L() dispatcher rule).

Special answer ids: 0x90 param-write ack, 0x95 param list, 0xA1/0xA2 6-byte <id:2B><u32> records, 0xA9 profile-select ack, 0xE1 sync-timeout/request-abort (the app retries after ~100 ms).

cremalink.ecam.answers.answer_flag(frame: bytes | bytearray) → int[source]

The echoed request flag — byte[3] of the 0xD0 blob.

cremalink.ecam.answers.answer_id(frame: bytes | bytearray) → int[source]

The echoed request id — byte[2] of the 0xD0 blob.

cremalink.ecam.answers.decode_a2_page(frame: bytes | bytearray) → list[tuple[int, int]][source]

0xA2/0xA1 statistics page → [(id, raw_u32), …].

Records are 6 bytes <id:2B> <u32:4B> starting at payload offset 2 (APK h.u parser); trailing partial records are ignored.

cremalink.ecam.answers.is_sync_timeout(frame: bytes | bytearray) → bool[source]

0xE1 — machine reports busy/sync-timeout; abort the pending read.

Tolerant by design: a blob that does not parse cannot be an abort.

cremalink.ecam.answers.parse_a9_ack(frame: bytes | bytearray) → tuple[int, bool][source]

0xA9 profile-select ack → (profile, ok) — <prof> <ok=00>.

cremalink.ecam.answers.parse_simple_ack(frame: bytes | bytearray) → tuple[int, bool][source]

Generic <ok:1B> ack — used by 0x83/0xA5/0xAB/0xB9/ 0xBB/0xE2 answers. Returns (answer_id, ok).

cremalink.ecam.answers.parse_write_ack(frame: bytes | bytearray) → tuple[int, bool][source]

0x90 ack → (param_id, ok) — payload <param:2B> <ok:1B>.

Ack byte 0x00 means the write committed (b==0 ⇒ success per the APK dispatcher).