Interface MdbBus


public interface MdbBus

The MDB bus as an adapter presents it. MDB runs 9-bit serial at 9600 baud, which an ordinary serial port cannot send, so a vending controller reaches it through an adapter board (USB or UART to MDB). Implement this over your adapter's command set.

The adapter owns the wire: it sets the mode bit on the address byte, appends and checks the checksum, sends ACK, and retransmits on NAK.

  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    transact(byte[] block, int timeout)
    Sends one command block and returns the peripheral's answer.
  • Method Details

    • transact

      byte[] transact(byte[] block, int timeout) throws IOException

      Sends one command block and returns the peripheral's answer.

      Parameters
      • block: the address byte (with the command in its low three bits) and the data, without the checksum

      • timeout: how long to wait, in milliseconds

      Returns

      the answer's data bytes without the checksum; an empty array for a bare ACK; null when the peripheral did not answer

      Throws
      • IOException: when the adapter fails
      Throws:
      IOException