1

I try to create some code to realize zvt-protocol in delphi. For connecting to the terminal I use ether TIDTCPClient or a comport-component by turbopack. Both can connect to ingenico terminal IPP480. It is showing a textline "a32de" for 2 seconds. I don't know why!

I can send several commandlines described in zvt-documentation, but nothing has be shown or doing by the terminal.

procedure TForm1.Button1Click(Sender: TObject);
var
  lSBefehl : String;
begin
  lSBefehl := '';

  IdTCPClient1.Host := eip.IPAddress; // IP des EC-Cash-Gerätes
  IdTCPClient1.Port := eport.IntValue;


  if not IdTCPClient1.Connected then begin
      IdTCPClient1.Connect; //that is working!
  end;
  if not IdTCPClient1.Connected then begin
      ShowMessage('not connected!');
  end;

  lSBefehl := Chr(6)+Chr(0)+Chr(6)+Chr(209)+Chr(255); //Nothing!

  IdTCPClient1.SendCmd(lSBefehl);
end;

Is there are testing-Tool for byte-sequences for zvt? Or do you know a solution for the right order of byte sequences?

Best reqards Christian

Chris
  • 121
  • 1
  • 9
  • If the terminal is expecting a sequence of bytes, don't use a string to send the data, use an array of bytes. If you're using a version of Delphi that is Delphi 2009 or later, using a string means there's 2 bytes for each character you're adding. Sending an array of bytes means you'll also need to use the Write method of the IOHandler. It might help to provide links to the specification for the terminal, so that others may know what data it is expecting – Dave Nottage Aug 02 '17 at 22:05
  • Thank you very much. I am using Delphi Tokyo. Would you please post a piece of code? – Chris Aug 03 '17 at 05:10
  • A `string` is designed to hold characters (which make up a string). If you're not holding characters, don't use a string; use an array of Byte. Clearly, you're not using a string, because you've used single byte values including `Chr(0)` and two Chr(6) values, all of which are non-printable. Stop using strings to hold binary data, and use the proper byte array instead. String is for arrays of character values, not binary data. Learn the difference. You don't use a pasta strainer to carry water for your plants, because it's the wrong tool. So is using a string to try to hold binary data. – Ken White Aug 03 '17 at 12:29

3 Answers3

1

You can try to use the idTcpClient.IOHandler.WriteDirect or idTcpClient.IOHandler.Write procedures.

procedure TForm1.Button1Click(Sender: TObject);
var 
    wBuf         : TIdBytes;
begin
    ...
    SetLength(wBuf, 5);
    wBuf[1] := $06;
    wBuf[2] := $00;
    wBuf[3] := $06;
    wBuf[4] := $D1;
    wBuf[5] := $FF;
    ...
    if (IdTCPClient.Connected) then begin
        try
          idTcpClient.IOHandler.WriteDirect(wBuf);
        except
          on e: exception do begin
            showmessage('Error :'+ e.message)
          end;
        end;
      end;
    ...
    end;
live2
  • 3,771
  • 2
  • 37
  • 46
Tamas
  • 106
  • 1
  • 6
  • Hey, thats great and I get a reaction on my terminal device. Thank you very much! But do you have an understandable guide about the correct byte order? I can not really transfer a cashvalue to the device. – Chris Aug 08 '17 at 13:30
  • Sorry, I use a different device not a terminal. I just try to show how can you use it, but I don't know this terminal. I used your code :-) "lSBefehl := Chr(6)+..." – Tamas Aug 09 '17 at 09:43
  • I guess the zvt protocol is always the same? I can not get my terminal showing any data. If I use a test tool of zvt I can transfer data. With a serial siffing tool I tried to get out the order of bytes but tring this order of bytes in my application, it did not work. Any ideas? – Chris Aug 16 '17 at 21:07
  • Try to use Wireshark to find out which data is sending when you are using the test tool and try to reproduce.Do you have any documentation from this terminal communication? – Tamas Aug 18 '17 at 09:42
0

The official ZVT documentation has a set of trace files that contain bytes sent to the terminal and bytes received from the terminal. I found these to be helpful when developing our own ZVT implementation.

Marc Balmer
  • 1,780
  • 1
  • 11
  • 18
0

The answer is probably too late but we have faced the same problem that there are not many examples in the ZVT area. In the meantime, we have published a test software on GitHub with which the most important functions can be tested. There are also some examples of byte sequences in the unit tests. You can find our project here https://github.com/Portalum/Portalum.Zvt

Tino Hager
  • 898
  • 7
  • 23