Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
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.
Methods
public abstract byte[] transact(byte[] block, int timeout)
throws IOException | Sends one command block and returns the peripheral’s answer. |
Method details
transact
public abstract byte[] transact(byte[] block, int timeout)
throws IOExceptionSends one command block and returns the peripheral’s answer.
Parameters
blockbyte[]- the address byte (with the command in its low three bits) and the data, without the checksum
timeoutint- 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