D
Duncan Lyall
Hi
I am currently writing a driver for a chip and pin credit card
terminal in Java. It's all about byte arrays, serial comms and start
and stop bits and it is good fun, however, as most of my experience is
at a much higher level I'm struggling with some of the concepts that
must be familiar to those who do this sort of thing all the time.
I have implemented the data link layer and I'm currently trying to get
my head around the session layer, the protocol at this level defines
two acks ACK1 (0x05 or 0000 0101) and ACK0 (0x06 or 0000 0110)
there are two corresponding control characters whose 0th bits are 0
and 1.
It goes something like this
send first message with control set to 0
expect ACK0
next message is sent with control = 1
expect ACK1
next message set control = 0
expect ACK 0
next message set control = 1
expect ACK 1
etc etc,
An out of sequence ACK is an implied NACK
The documentation is 'concise' to say the least but it does make an
explicit reference to the two ACKs, something along the lines of "the
two ACK characters have been arranged so that there is a two bit
difference between them".
THE QUESTION(S):
What is the significance of the two bit difference in the ACKs ?. Is
there some clever algorithm to keep track of the next expected
ACK/control character ?
I know this is not a Java question per se so if you think it doesn't
belong here please advise a better place to post.
TIA
Duncan Lyall
I am currently writing a driver for a chip and pin credit card
terminal in Java. It's all about byte arrays, serial comms and start
and stop bits and it is good fun, however, as most of my experience is
at a much higher level I'm struggling with some of the concepts that
must be familiar to those who do this sort of thing all the time.
I have implemented the data link layer and I'm currently trying to get
my head around the session layer, the protocol at this level defines
two acks ACK1 (0x05 or 0000 0101) and ACK0 (0x06 or 0000 0110)
there are two corresponding control characters whose 0th bits are 0
and 1.
It goes something like this
send first message with control set to 0
expect ACK0
next message is sent with control = 1
expect ACK1
next message set control = 0
expect ACK 0
next message set control = 1
expect ACK 1
etc etc,
An out of sequence ACK is an implied NACK
The documentation is 'concise' to say the least but it does make an
explicit reference to the two ACKs, something along the lines of "the
two ACK characters have been arranged so that there is a two bit
difference between them".
THE QUESTION(S):
What is the significance of the two bit difference in the ACKs ?. Is
there some clever algorithm to keep track of the next expected
ACK/control character ?
I know this is not a Java question per se so if you think it doesn't
belong here please advise a better place to post.
TIA
Duncan Lyall