Difference between revisions of "Soda Machine/Cashless Device"
(create page with outline of mdb transaction and goals of project) |
(No difference)
|
Revision as of 02:59, 10 January 2017
Creator: |
Contents
[hide]Project overview
The soda machine supports MDB, the Multi Drop Bus. It's used for talking to coin hoppers, bill validators, and, notably, "cashless devices" (that is, card readers). This project is to implement an MDB cashless device so that make shop members are able to pay for soda with their NFC tags directly.
More-or-less high-level overview of payment operations
MDB is a pretty confusing protocol, but I can describe the subset that we will be using, and the flow of "states" within our cashless device. One thing you have to know is that the VMC (vending machine controller) is always POLLing all its peripheral devices on the MDB. The peripherals can't talk unless the VMC has addressed them first.
Startup
- The VMC polls us, and we say we have just finished resetting.
- The VMC sends us its configuration data. We respond with our configuration data.
- The VMC sends us its pricing data (config stage 2). We acknowledge this.
- The VMC keeps polling us and we keep acking to say that we are not dead.
Now we are in the idle state.
User presents payment
- The VMC polls us, and we say that we have a user trying to begin a payment session.
- We can pass an amount of currency as the session begin amount, and the VMC displays it as the amount of credit that has been inserted by the user.
- The VMC tells us the user is trying to buy something that requires a payment of, let's say, 50 cents. We acknowledge this and we run off to verify that the user can afford this 50 cent charge.
- The VMC polls us, and we say that the user's payment is approved.
- If the vend fails, the VMC tells us that. We ack this, refund the payment, and close the payment session.
- If the vend succeeds, the VMC tells us that. We ack this and debit the user 50 cents. The payment session is still open, but the most sensible thing is to do the next step...
- The VMC polls us, and we say that we want to end the payment session.
Now we're in the idle state again.