Skip to content

Protocols

Five protocols, five ways to say "here are my meters". None of them agreed with each other, so neither does this code. Each lives in its own file under src/morpheus_vlt/protocols/ and has the same shape: handle(bytes) -> bytes. Bytes in, bytes out, no opinions about transport.

Protocol CLI name Style Buffers partial input? State it reads
Unidesa / Cirsa unidesa, cirsa Binary, XOR55 checksum The request handler counters
SAS sas Binary, BCD meters, CRC-16/KERMIT No, one request per read meters
VDAI vdai ASCII printout Yes, until a line feed meters
RFranco rfranco ASCII lines Yes, until CR or LF meters
DEX / UCS dex DLE framed blocks, CRC-16/ARC Yes none, a file

Faked versus real

What's real, as in byte for byte what the readers expect:

  • Frame layouts, field offsets, reply lengths.
  • Checksums and CRCs. The readers that check them will be satisfied.
  • The command/reply flow, including handshakes, key prompts and retransmits.

What's faked:

  • Anything electrical. No 9-bit serial for SAS, no RS-485 turnaround timing, no baud rate.
  • Machine behavior. Meters only change when you change them (AFT on SAS is the one exception). No reels spin. Nobody wins. Very relaxing.
  • Commands the readers never send get a reply of the right size and very little effort.

Conventions on these pages

  • Hex bytes are written 0x0F in prose and 0F in dumps.
  • Byte dumps were generated by running the simulator, not typed by hand. Typing hex by hand is how you end up writing a simulator to check your hex.
  • "Reader" means the legacy reader scripts the simulators are built to satisfy. When the reader and the spec disagree, the simulator sides with the reader. It's the one that has to work on Monday.