beckhoff — 6.12 ADS sum command: fetch and release multiple handles

Samples: TcJavaToAds notification); if (err != 0) { System.out.println("Error: Remove notification: 0x" + Long.toHexString(err)); } // Delete listener callObject.removeListenerCallbackAdsState(listener); //Close communication err = AdsCallDllFunction.adsPortClose(); if (err != 0) { System.out.println("Error: Close Communication: 0x" + Long.toHexString(err)); } } catch (Exception ex) { System.out.println(ex.getMessage()); } } } Implementation of the CallbackListenerAdsState interface:

import de.beckhoff.jni.tcads.AdsNotificationHeader; import de.beckhoff.jni.tcads.AmsAddr; import de.beckhoff.jni.tcads.CallbackListenerAdsState; public class AdsListener implements CallbackListenerAdsState { // Callback function @Override public void onEvent(AmsAddr addr, AdsNotificationHeader notification, long user) { System.out.println("Symboltabelle hat sich geaendert!"); } } 6.12 ADS sum command: fetch and release multiple handles This sample shows how to fetch and release many handles using the ADS sum command. Set up as AdsSyncReadWriteRequest, it serves as a container in which the subcommands are transported. System requirements:

TwinCAT v2.11 Build >= 1550 Unpack the sample program 'ADS sum command: fetch and release multiple handles': https:// infosys.beckhoff.com/content/1033/tcjavatoads/Resources/12475105675/.zip To execute the *.jar sample, the command 'java -classpath "Sample12.jar;[path to TcJavaToAds.jar] Main' must be executed in the console in the correct directory (example path: "C:TwinCAT\Ads Api\AdsToJava\*"). For this, java must be entered in the environment variables.

Fetch handles import java.nio.ByteBuffer; import java.nio.ByteOrder; import de.beckhoff.jni.Convert; import de.beckhoff.jni.JNIByteBuffer; import de.beckhoff.jni.tcads.AdsCallDllFunction; import de.beckhoff.jni.tcads.AmsAddr; public class Main { private static final String VAR_NAME1 = ".bVar01"; TX1000 48 Version: 1.1