Vending Machine/Cashless Device: Difference between revisions

From Nottinghack Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 40: Line 40:
|READER CANCEL||CANCELLED||
|READER CANCEL||CANCELLED||
|- class="highlight"
|- class="highlight"
|VEND REQUEST... VEND CANCEL||VEND DENIED*||
|VEND REQUEST... VEND CANCEL||VEND DENIED||
|-
|- class="highlight"
|VEND REQUEST||VEND DENIED*||
|VEND REQUEST||VEND DENIED||
|-
|- class="highlight"
|VEND REQUEST||VEND APPROVED||VEND SUCCESS*
|VEND REQUEST||VEND APPROVED||VEND SUCCESS
|-
|- class="highlight"
|VEND REQUEST||VEND APPROVED||VEND FAILURE*
|VEND REQUEST||VEND APPROVED||VEND FAILURE
|-
|-
|SESSION COMPLETE||END SESSION||
|SESSION COMPLETE||END SESSION||
|}
|}

Revision as of 19:32, 12 August 2011

The MDB spec already takes into account cashless devices, so we simply have to build a device that conforms to the spec.

Device Level

The specification defines 3 levels of cashless devices, with more more features the higher the level. The Vending Machine (VMC) also has a level, and a device and VMC can only communicate using the highest commonly supported level. As our VMC is only level 1, we only need to implement a level 1 cashless device.

So let's look at what a level 1 device needs to do. Here we will reference commands by their plain English names. For the technical details on these commands, please refer to the specification section 7. For details on how these commands are sent/received by the VMC, refer to secitons 2,3 and 4.


States

A (slightly simplified) diagram of the state machine, with commands sent from/to the VMC in capitals.

The cashless device is basically a state machine with 5 states (7 for level 2 and 3 machines). These states are:

  1. Inactive
  2. Disabled
  3. Enabled
  4. Session Idle
  5. Vend

When turned on, the cashlss device enters state 1. Almost all state transistions are initiated by the VMC, with the exception of 3 -> 4, which is initiated by the cashless device on a valid card read.

If the cashless device receives a command it cannot act upon in its current state, or receives an unexpected command whilst in an uninterruptable state it must ACK(nowledge) the command, then on the next POLL from the VMC, issue a COMMAND OUT OF SEQUENCE response.

The VMC will then respond with a RESET command, putting the reader back to state 1.

Uninterruptable States

During certain command sequences, the VMC should not issue any additional commands to the cashless device. These are the Uninteruptable States. If the VMC does issue any additonal commands during one of thes states, the reader should responds with COMMAND OUT OF SEQUENCE, as noted above.

These states for a level 1 device are:

VMC Command Cashless Device Response Result
SETUP/CONFIGURATlON DATA READER CONFIGURATION DATA
EXPANSION/REQUEST ID PERIPHERAL ID
READER CANCEL CANCELLED
VEND REQUEST... VEND CANCEL VEND DENIED
VEND REQUEST VEND DENIED
VEND REQUEST VEND APPROVED VEND SUCCESS
VEND REQUEST VEND APPROVED VEND FAILURE
SESSION COMPLETE END SESSION