Skip to main content

MDB-RS232 Codec

Talks to vending-machine peripherals on the MDB bus (coin changers, bill validators, cashless readers) through a WEFU MDB-RS232 adapter, or a pin-compatible clone, on a serial port at 9600-8-N-1. The adapter does the real-time MDB polling itself; CycBox sends it commands and reads what it reports.

The link is asymmetric, and the codec handles both directions:

  • Sending: commands go out as raw bytes with no terminator. For example, send 14 01 (cashless READER ENABLE) as hex from a message input. Sent commands show in hex in the message list.
  • Receiving: the adapter prints the MDB bytes as ASCII hex pairs on a \r\n-terminated line, such as 10 01 03. The codec turns each line back into the bytes 0x10 0x01 0x03, so the hex view shows the real MDB data. Lines that are not hex are kept as received. If 4 KiB arrive without a line ending, they are flushed as one raw message.

Each received message is classified in its metadata, so a Lua script can route it. mdb_frame_kind is one of:

  • auto_report: the line starts with a known device address: 08 coin, 10 / 60 cashless 1 / 2, 30 bill, 40 universal satellite device, 68 age verification. These messages also carry mdb_device (the device name) and the value mdb_device_id (the address byte).
  • response: an unaddressed line received right after a command.
  • unknown: anything else.

Configuration reference​

Config IDmdb_codec
Selected byapp_codec = "mdb_codec"
PlatformsLinux, Windows, Android
LicenseFree

WEFU MDB-RS232 serial adapter: raw HEX out, ASCII-hex lines in (parsed to MDB bytes)

This codec has no settings of its own.

Example config​

Default values as they appear in a saved configuration (for example the JSON block at the end of a cycbox/examples/*.lua file). Settings detected at runtime are omitted.

{
"app": {
"app_codec": "mdb_codec"
}
}