MDB protocol (multidrop bus) - C# serialport communication
Asked Answered
S

1

6

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?

Strenta answered 26/9, 2016 at 7:13 Comment(1)
what device are you using to send and receive mdb commands?Wasteland
K
1

The EVA-DTS standard is its own separate standard.

  • MDB-ICP is a communication protocol.
  • EVA-DTS is a data format standard.

MDB optionally (keyword optionally) uses/integrates EVA-DTS data, which is what its asking for here.

EVA-DTS data is human readable values in ascii text/numbers separated by asterixes in a defined order and length. Each unit of data between an asterisk, is called a data element.

Z9 in options 1&2, refers to data element DA701, where if you look in Appendix A of the EVA-DTS-6.2.2 standard, the DA701 has the element name "Cashless1 user group number", which is of data type N0 meaning a number without any implied decimal points, a minimum length of 1 digit and a maximum of 13. In MDB, isn't sent as an ASCII string of characters like "15", instead, you use hexadeximal numerical representations, so usergroup 15 would be 0x0F. The usergroup if not using it,you can just put 0x01 for everyone. Its used to group people, with different price tables, giving different prices to different people. Not sure if thats a MDB feature, but any VMC could implement it if not. All optional.

Z9 you can look up yourself

Z8, First two Most Significant bits are used to indicate if it was a vend card paying (as in credit card, or any real form of cashless payment). the rest of the digits it depends on the vend. you use one of the 4 options (read appendix A section 1.1 of the DTS standard to get definitions of what they mean and which ones are appropriate in that situations. Depending on the option used (1, 2, 3, or 4) that decides what Z9 & Z10 are, like option 3 says z9 would be 0x00 and Z10 would become a percentage (since z8 would describe a percentage discount given), while if u pick option one, Z10 instead contains the value of DTS element LA101.

Hope that's not too wordy or incoherent. good luck too, we're competitors.

Kitchen answered 27/5, 2019 at 0:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.