Recent

Author Topic: OPC client with Lazarus  (Read 59081 times)

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: OPC client with Lazarus
« Reply #15 on: June 05, 2020, 11:21:58 pm »
I have created pascal wrapper to open source http://open62541.org
I am so happy :D :P :D. THANK YOU!!!

1) Do you plan to include some examples other then client example inside of open62541.pas?
2) Do you intend to put your wrapper in some repository like github so others can contribute?
3) Is your wrapper for official open62541 v1.0?
4) Did you test it only on win32? Have you tried it on win64, linux, or even arm?
5) I was able to find 64 bit version of libopen62541.dll on official site, and libwinpthread-1.dll inside of http://win-builds.org/1.5.0/packages/windows_64/winpthreads-v3.3.0-2-x86_64-w64-mingw32.txz. Could you tell me where should I look for 64 bit libgcc_s_sjlj-1.dll?

Sorry for so many questions  :-[
« Last Edit: June 05, 2020, 11:37:40 pm by avra »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: OPC client with Lazarus
« Reply #16 on: June 05, 2020, 11:41:41 pm »
Quote
Could you tell me where should I look for 64 bit libgcc_s_sjlj-1.dll?

Afaik, you may find it in FPC/3.3.1/bin/x86_64-win64/
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: OPC client with Lazarus
« Reply #17 on: June 05, 2020, 11:47:04 pm »
Quote
Could you tell me where should I look for 64 bit libgcc_s_sjlj-1.dll?

Afaik, you may find it in FPC/3.3.1/bin/x86_64-win64/
Thanks! I hope it's a match.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: OPC client with Lazarus
« Reply #18 on: June 05, 2020, 11:59:07 pm »
Quote
I hope it's a match.

You may also download + install last version of mingw-w64, libgcc_s_sjlj-1.dll is included.

http://mingw-w64.org/doku.php/download
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: OPC client with Lazarus
« Reply #19 on: June 06, 2020, 12:08:28 am »
You may also download + install last version of mingw-w64, libgcc_s_sjlj-1.dll is included.

http://mingw-w64.org/doku.php/download
I didn't want exe setup so I ended up at win-builds.org looking for plain DLLs - but got lost in all those txz files where I could find only DLL needed for threading.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Fred vS

  • Hero Member
  • *****
  • Posts: 3158
    • StrumPract is the musicians best friend
Re: OPC client with Lazarus
« Reply #20 on: June 06, 2020, 12:11:34 am »
Quote
I didn't want exe setup so I ended up at win-builds.org looking for plain DLLs - but got lost in all those txz files where I could find only DLL needed for threading.

Is the attachment of my previous post not working?
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: OPC client with Lazarus
« Reply #21 on: June 06, 2020, 01:03:11 am »
Quote
I didn't want exe setup so I ended up at win-builds.org looking for plain DLLs - but got lost in all those txz files where I could find only DLL needed for threading.

Is the attachment of my previous post not working?
Your attachment is more preferred then setup exe. I didn't test it yet.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

LacaK

  • Hero Member
  • *****
  • Posts: 691
Re: OPC client with Lazarus
« Reply #22 on: June 08, 2020, 07:39:20 am »
1) Do you plan to include some examples other then client example inside of open62541.pas?
Yes I can, no problem ... I will inform when it happens

2) Do you intend to put your wrapper in some repository like github so others can contribute?
No, I have no account on github and I have no free time to maintain it in long term. I created this wrapper as I neded it for one of my work projects (so only subset of API is translated). On other side I provide it as freeware (public doman) so anybody interested can do it.

3) Is your wrapper for official open62541 v1.0?
I think that yes. I created it in April 2020 from github sources so this time 1.0 was already released

4) Did you test it only on win32? Have you tried it on win64, linux, or even arm?
Only on Win32, I can test it also on Win64

5) I was able to find 64 bit version of libopen62541.dll on official site, and libwinpthread-1.dll inside of http://win-builds.org/1.5.0/packages/windows_64/winpthreads-v3.3.0-2-x86_64-w64-mingw32.txz. Could you tell me where should I look for 64 bit libgcc_s_sjlj-1.dll?
Already answered ;-) I remember that searching for win32 libraries was also for me complicated job ...
« Last Edit: June 08, 2020, 07:42:56 am by LacaK »

LacaK

  • Hero Member
  • *****
  • Posts: 691
Re: OPC client with Lazarus
« Reply #23 on: June 08, 2020, 12:36:30 pm »
I have added demo application and Win64 DLLs: http://lacak.users.sourceforge.net/
(Win64 application works, but when closing - UA_Client_delete(client) is called - something goes wrong ...)
« Last Edit: June 09, 2020, 08:36:15 am by LacaK »

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: OPC client with Lazarus
« Reply #24 on: June 10, 2020, 02:52:11 pm »
I have added demo application and Win64 DLLs: http://lacak.users.sourceforge.net/
Thank you for the effort. It is really appreciated.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

henk86

  • New member
  • *
  • Posts: 8
Re: OPC client with Lazarus
« Reply #25 on: June 15, 2020, 07:02:38 pm »
Nice work,

I tried the example and connecting works. But read and write are not working for me. I used for the node id a string like this:

"ns=4;s=|var|CODESYS Control for Raspberry Pi SL.Application.PLC_PRG.iCounter"

Do you have any suggestions?



LacaK

  • Hero Member
  • *****
  • Posts: 691
Re: OPC client with Lazarus
« Reply #26 on: June 16, 2020, 07:06:08 am »
You must type or select nameSpace index 4 from combobox beside "Namespace:" then in "Node Id:" edit box write name of variable probably in your case "|var|CODESYS Control for Raspberry Pi SL.Application.PLC_PRG.iCounter"

henk86

  • New member
  • *
  • Posts: 8
Re: OPC client with Lazarus
« Reply #27 on: June 16, 2020, 06:12:49 pm »
Thank you that worked.
Now I'm going to figure out how to translate a int16 value correctly.

Riodev

  • Newbie
  • Posts: 2
Re: OPC client with Lazarus
« Reply #28 on: June 20, 2020, 10:29:30 pm »
I have created pascal wrapper to open source http://open62541.org.
You can look at http://lacak.users.sourceforge.net/ for headers and Windows DLL

There are also implementations of other industrial communication protocols like Modbus TCP or EtherNet/IP


Code: Pascal  [Select][+][-]
  1.   scert.LoadFromFile(ExtractFilePath(Application.ExeName)+'server_cert.der');
  2.   kcert.LoadFromFile(ExtractFilePath(Application.ExeName)+'server_key.der');
  3.   certificate := _UA_STRING(PAnsiChar(scert.Text));
  4.   privateKey := _UA_STRING(PAnsiChar(kcert.Text));
  5.  
  6.   UA_ClientConfig_setDefault(conf);
  7.   conf^.securityMode:= UA_MESSAGESECURITYMODE_SIGNANDENCRYPT;
  8.  
  9.   UA_ClientConfig_setDefaultEncryption(conf, certificate, privateKey, nil, 0, nil,0);

I have a problem function UA_ClientConfig_setDefaultEncryption Access violation error

Please publish working example code for securityMode SIGNANDENCRYPT

thank
« Last Edit: June 20, 2020, 10:45:48 pm by Riodev »

LacaK

  • Hero Member
  • *****
  • Posts: 691
Re: OPC client with Lazarus
« Reply #29 on: June 22, 2020, 07:19:37 am »
Hello,
if you use bundled DLLs, which I took from pre-compiled v.1.0 DLLs, which were released https://github.com/open62541/open62541/releases/tag/v1.0
then they does not support SIGN and SIGN&ENCRYPT as they were compiled without UA_ENABLE_ENCRYPTION

 

TinyPortal © 2005-2018