The PLC has two EtherCAT master devices. If I have the NetIds I can scan the devices from the EtherCAT master and set them in OP state if needed (some maschine or whatever were disconnected).
I can get the devices from a master NetId using the library Tc2_EtherCAT and FBs like ST_EcSlaveState, FB_EcGetAllSlaveAddr, FB_EcGetAllSlaveStates...
Its possible to get the local NetId thanks to the FB FB_GetLocalAmsNetId. However I have two. Any Ideas?
At the moment I write it somewhere and it will be read it. I would like to skip this step. In case that the PLC is replaced or for new ones.