I am in the process of developing a MDB software in C# as a payment reader media that communicates with a vending machine through MDB protocol. Currently everything works OK and i am able to communicate with the vending machine. The communication is like expected after reading the MDB protocol but i am having trouble understanding some commands/respones...
I just have one question regarding a response i should send back to the vending machine that may be really stupid, but i really don't understand how it should be sent.
As shown in the MDB protocol, when i get a POLL from the MDB machine and the state of the reader (my computer) is "Session Idle", i can then send a "Begin Session" command to the vending machine. The commands are sent in bytes over serial port and are shown as HEX or Binary in the MDB protocoll. The BEGIN SESSION command should contain the following:
Z1 Begin Session Z2-Z3 Funds Available Z4-Z7 Payment media ID Z8 Payment Type Z9-Z10 Payment Data
I understand Z1-Z7 because of good examples in the MDB protocol, but i am having trouble understanding Z8-Z10 (payment type and payment data).. The examples are not self explained in my head..
The MDB protocol says the following: """""""""""""""""""""""""""""""""""""""""""""""""""""""" Z8 : Type of payment: 00xxxxxxb = normal vend card (refer EVA-DTS Standard, Appendix A.1.1 Definitions) x1xxxxxxb = test media 1xxxxxxxb = free vend card xx000000b -0 VMC default prices xx000001b -1 User Group (Z9 = EVA-DTS Element DA701) Price list number (Z10 = EVA-DTS Element LA101)* xx000010b -2 User Group (Z9 = EVA-DTS Element DA701) Discount group index (Z10 = EVA-DTS Element MA403) xx000011b -3 Discount percentage factor (Z9=00, Z10 = 0 to 100**, report as positive value in EVA-DTS Element MA404) xx000100b -4 Surcharge percentage factor (Z9=00, Z10 = 0 to 100**, report as negative value in EVA-DTS Element MA404) * User Group is a segmentation of all authorized users. It allows selective cost allocation. A User Group usually has no direct relation to a price list. Price Lists are tables of prices. Each Price List contains an individual price for each product. Discount Group indicates the Price List on which the Percentage Factor will be applied. If the User Group, the Price List or Discount Group is unknown by the VMC, the normal prices are used (Z8 is defaulted to 00h). Minimum value for Z9 and Z10 is 0. ** Percentages are expressed in binary (00 to 64h) Note: These functions may NOT be supported by all VMCs. Z9-Z10 : Payment data as defined above """"""""""""""""""""""""""""""""""""""""""""""""""""""""
Can somebody please tell me how Z8 and Z9-Z10 should be sent to the vending machine. Now i have been sending (in hex): "0x02 (Z8), 0x10 (Z9) and 0x10 (Z10)" which is just a wild guess and it is working. Don't really know why but its probably not correct.
How should Z8 and Z9-Z10 be sent?