Open A-ndre-S opened 3 years ago
On localhost you have to use the TwinCAT router. You, would need to link against TcAdsLib.dll not AdsLib.dll. Call meson with an environment variable pointing to the TwinCAT TcAdsDll.dll similar to this: https://github.com/Beckhoff/ADS/blob/0e0f73f709841c8ee3a0c1ff20ebb46165662d9f/.gitlab-ci.yml#L82
Hello, i've build the library with the option -Dtcadsdll_include=c:\TwinCAT\AdsApi\TcAdsDll\Include, that gives the libTcAdsLib.a. Then i've used this library and TcAdsDll.lib in the same WinUI 3 test project (template with the modifications of the post above) but i have AdsPortOpenEx returning 0 and an exception while calling route.SetTimeout(5000); (code 1864 ADSERR_CLIENT_PORTNOTOPEN).
Have i done something wrong? Thank you for your help and patience!
Andres
Hmm, if you don't get a valid port from AdsPortOpenEx() maybe you didn't add a TwinCAT route earlier? If you use TcAdsDll directly, does AdsPortOpenEx() work in that case?
I've added the route earlier and when using a MFC project TcAdsDll works fine. When i try to use WinUI 3 unluckly i get 0 as return value from AdsPortOpen() and AdsPortOpenEx() using directly TcAdsDll, that's why i tryied to use AdsLib library to connect to a plc running in local.
(Following "Create a WinUI 3 desktop app for C++/Win32" in https://docs.microsoft.com/en-us/windows/apps/winui/winui3/get-started-winui3-for-desktop)
Thank you!
See #161 for some tweaks I've done to use this lib more easily with TwinCAT router on Windows build.
Hi, I've tryied to compile and use this library in a C++/WinRT project for using WinUI 3 API. TcAdsDll does not work on this enviroment, giving me 0 when calling AdsPortOpen. I've followed the example provided with this repo and i get it working when i run the app in my developing PC connected to a Beckhoff IPC running a PLC project. Here is the code:
When i try to run the app on the IPC itself i cannot make it working: i can create succesfully the AdsDevice "route" object (following the example) but i get Error 1861 at every call i make. The changes for the code are on the lines
I also tryed to set the remoteIpV4 to localhost.
Every call i make to interact with route (like route.GetState()) raises an exception giving error 1861.
Is it possible to use this library in a PC running a PLC project? Am i setting something wrong?
Thank you, Andres