AdsAPI

gass

Level-1
Beiträge
4
Reaktionspunkte
0
Zuviel Werbung?
-> Hier kostenlos registrieren
hello people!

i am trying to implement an ADS library for linux. I would prefer that this library had the same API than the oficial API, implemented by AdsAPI.h and AdsDEF.h .

My main problem now, since i found everything +/- implemented in a libads that i found in this forum, is to understand the way connections are handled.

mainly the portOpen/ portClose functions.

every command must have a new connection?

*pseudo code*
portOpen

send command

receive response

port close
*end pseudo code*

or this has to do with with some connection management inside AdsDLL.dll?

thanks
 
The hole connection is handled by the Tcp/Ip protocol. Ads has no specification to manage the connection.

Only connect to the port 48898 with a Tcp/Ip-Socket and send/receive your commands. You have not to close the connection with every command and open a new port.
 
Zuviel Werbung?
-> Hier kostenlos registrieren
i know that i just have to connect to that port.
my problem is that i have an portOpen and a portClose functions that i don't know what they do.

and, i don't want to open a new connection everytime i want to comunicate to other machines. Or, at least, i think that way.

thanks
 
Gass, I saw you published my older sources and examples elsewhere.
At the moment, I cannot even find them myself :-(
I attach here newer versions of the core files ADS.c and ADS.h.
The new stuff is that they can receive and answer messages a BC9000 sends when programmed to do so.
I just use them in my SCADA/HMI.
I did not compile them to libads.so nor test them with the older examples.

[quote gass]
my problem is that i have an portOpen and a portClose functions that i don't know what they do.

and, i don't want to open a new connection everytime i want to comunicate to other machines. Or, at least, i think that way.
[/quote]
You may have found out that yourself:
If you want to read data continuously, just open the connection once. Then do your read loop.
Close the connection when your program ends.
Try to close and reopen the connection if some error occurs.
 

Anhänge

  • ads.zip
    8,9 KB · Aufrufe: 36
thanks for you answear and code.

i have my source code here:
http://github.com/gass/libads/tree/master

i will provide 2 libraries:
- libads - basically your library (i have changed some code, because it was not working)
- libadsApi - oficial beckhoff ads API compatible library

i will check your source code agains the one i have and check the diferences.
if you are interested, i will keep my code compatible with the one you provided so you can reuse it, or even use the library in your applications without change.

About the connection, my problem is with the ADS API, since it needs an "ADS router". The ads router concentrates all connections from and to the beckhoff hardware so it can only comunicate with it once at a time.

thank you.
 
Zuviel Werbung?
-> Hier kostenlos registrieren
Gass, I did not see your answer before, this is why I did not reply earlier.
When my interface differs from official BECKHOFF API, the reason is this:
After writing Libnodave and after implementing some other PLC interface (e.g. libOpenSRTP, for GE Fanuc), I sought for a "least common denominator". This would allow users to exchange functions from one of these libraries for those from any other in order to make their applications work with another PLC brand/protocol. We may discuss that further if you are interested.
 
Zurück
Oben