Medius - Native APIConnection

Connection & handshake

Open, find, and handshake

The handshake confirms the device on the serial port is a Medius box and speaks a protocol version you understand: one request, one reply. Open the port and start talking.

  • No baud negotiation.
  • No login.
  • No 115200 startup step or baud-switch command.

Handshake

One round-trip to confirm the box
  1. Open the serial port at 4,000,000 baud (Transport). The box speaks framed binary from the first byte.
  2. Catch the unsolicited hello the box sends on its own (below), or send a QUERY(VERSION) yourself. Both produce the same RESP(VERSION) frame.
  3. Read proto_ver from that reply and check it equals 3.
ReplyMeaning
proto_ver == 3Speaks the protocol these pages describe.
proto_ver != 3Speaks a protocol these pages don't cover; don't assume the commands behave as described.
No replyNot a Medius box, or the port or baud is wrong.
THE REPLY: RESP(VERSION)

The first byte echoes the what selector you asked for (the byte that chose which thing to query), then the protocol and firmware version, the box MAC, and the box name follow. Full detail on the Requests page.

OffsetFieldTypeNotes
0whatu8the selector byte, echoed back; 0x00 = VERSION
1proto_veru8protocol version, expected 3
2fw_majoru8firmware major
3fw_minoru8firmware minor
4fw_patchu8firmware patch
5macu8[6]the box MAC, a stable per-box id
11..nameasciithe box's human-readable name (may be empty), delimited by the frame LEN

The ready hello

Unsolicited RESP(VERSION) on link-up

The box sends one RESP(VERSION) on its own as soon as its serial link is up. Treat it as "box is here and ready" and skip your own QUERY(VERSION).

TriggerWhen it fires
Power-onOnce, as the box boots.
First contactOn the first valid frame after a program opens the port, so a program that connects after the power-on hello still gets one.

The hello carries SEQ=0 since no request prompted it, and its payload is identical to a queried reply.

The medius library does all of this inside open and find: it sends QUERY(VERSION), retries a few times, and checks proto_ver == 3 before handing you a working connection.