Hi Erel,
I get from the Software the following string
M00101P7 = opened in notepad++ it shows DLE STX M00101P7 ETX DLE + a Tab
I am sending, and according to manual
Private CommandCodeStatus As String = "M001"
Private CommandCodePurchase As String = "C000"
Private CommandCodeRefund As String = "C002"
Private CommandVersion As String="01"
Private ResponseCodeOK As String="000"
Private OperatorMessageOK As String = "EM SERVIÇO "
Private OperatorMessageNOK As String = "FORA DE SERVIÇO "
' First Send a ACK
Str2Send=ACK
AStreams.Write(Str2Send.GetBytes("utf8"))
' Then Send the Actual Reply
Str2Send = DLE & STX & CommandCodeStatus & CommandVersion & ResponseCodeOK & OperatorMessageOK & DLE & ETX & LRC
AStreams.Write(Str2Send.GetBytes("utf8"))
The manual states the following:
We will refer to the equipment connected to the Payment Terminal (POS) as the ECR
(Electronic Cash Register).
The program installed in the POS will allow the ECR to send commands that will activate
in the POS the execution of and Client operations. For the Purchase operation, this facility
will avoid in specific environments to introduce manually in the POS a total amount when it
is already in the ECR memory.
The decision on the conclusion of the transaction it is a POS responsibility, even if the
ECR cannot receive the POS confirmation of success. In this case the ECR operator
should act in a way that prevents the repetition of a payment and also finishes the ECR
sale accordingly.
When the POS concludes an Operation, it sends the command response to the ECR. The
printing of the receipt may be done automatically by the POS or be a responsibility of the
ECR, depending on the command parameters. Even when the POS does not print the
receipt, the POS stores it on its memory for subsequent printing using the appropriate
POS function (“Repeat last receipt”), if necessary. In some situations, there is the need for
the client to sign a copy that must be verified by the retailer.
The ECR should be configured in a way that general user interface requirements and
application robustness are guaranteed.
Any ECR supplier that wants to use this facility should be certified by SIBS according to
SIBS regulations.
Other functional interfaces may be considered but should be negotiated on a specific
basis.
2.1.2. Control characters
STX (X’02’)
ETX (X’03’)
ACK (X’06’)
DLE (X’10’)
NAK (X’15’)
2.1.3. Data Characters
From hexadecimal X’00’ to hexadecimal X’FF’
2.2. Message Protocols
2.2.1. Message Structure
The communication between POS and ECR is based in exchange data message with the
following structure:
DLE STX INFO DLE ETX LRC
- DLE//STX: start of message
- DLE//ETX: end of message
- LRC: longitudinal Redundancy Check Character (XOR of all the characters of the
message including DLE//ETX and extra DLE’s included due to the byte stuffing and not
including DLE//STX)
If a DLE happened to occur in the INFO field the Terminal should insert an extra DLE to
refereed DLE in the text (byte stuffing) before transmission.
The receiving hardware must strip off the extra DLE’s after LRC calculation to obtain the
application message.
This format is used in all data messages between the POS and ECR, except on those
consisting in one ASCII control character used for message interchange control (ACK,
NAK):
The POS considers that a message was successfully received when it sends an ACK to
the Terminal. Otherwise it sends a NAK.
The ECR considers that a message was successfully received when it sends an ACK to
the POS. Otherwise it sends a NAK.
ECR POS
(1) request ----------------------------------
|
<-------------------<---------------- ACK
|
POS executes the command with client intervention (eventually) and
under operator control. During this period POS will communicate with
SIBS, or with the client card, in order to perform the operation.
|
(2) <-------------------<---------------- response
|
ACK ----------------->------------------>