|
|
|
|
#include <jni.h>
|
|
|
|
|
|
|
|
|
|
// Der folgende ifdef-Block zeigt die Standardl<64>sung zur Erstellung von Makros, die das Exportieren
|
|
|
|
|
// aus einer DLL vereinfachen. Alle Dateien in dieser DLL wurden mit dem in der Befehlszeile definierten
|
|
|
|
|
// Symbol ADSTOJAVA_EXPORTS kompiliert. Dieses Symbol sollte f<>r kein Projekt definiert werden, das
|
|
|
|
|
// diese DLL verwendet. Auf diese Weise betrachtet jedes andere Projekt, dessen Quellcodedateien diese Datei
|
|
|
|
|
// einbeziehen, ADSTOJAVA_API-Funktionen als aus einer DLL importiert, w<>hrend diese DLL mit diesem
|
|
|
|
|
// Makro definierte Symbole als exportiert betrachtet.
|
|
|
|
|
/*
|
|
|
|
|
#ifdef ADSTOJAVA_EXPORTS
|
|
|
|
|
#define ADSTOJAVA_API __declspec(dllexport)
|
|
|
|
|
#else
|
|
|
|
|
#define ADSTOJAVA_API __declspec(dllimport)
|
|
|
|
|
#endif
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
#ifndef _Included_AdsToJava
|
|
|
|
|
#define _Included_AdsToJava
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
*/
|
|
|
|
|
extern "C" {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//AdsGetDllVersion
|
|
|
|
|
JNIEXPORT jlong JNICALL Java_de_beckhoff_jni_tcads_AdsCallDllFunction_callDllAdsGetDllVersion
|
|
|
|
|
(JNIEnv *env, jobject obj, jobject lResultDllVersion);
|
|
|
|
|
//JNIEXPORT jobject JNICALL Java_de_beckhoff_jni_tcads_AdsCallDllFunction_callDllAdsGetDllVersion
|
|
|
|
|
// (JNIEnv *env, jobject obj);
|
|
|
|
|
|
|
|
|
|
//AdsPortOpen
|
|
|
|
|
JNIEXPORT jlong JNICALL Java_de_beckhoff_jni_tcads_AdsCallDllFunction_callDllAdsPortOpen
|
|
|
|
|
(JNIEnv *env, jobject obj);
|
|
|
|
|
|
|
|
|
|
//AdsPortClose
|
|
|
|
|
JNIEXPORT jlong JNICALL Java_de_beckhoff_jni_tcads_AdsCallDllFunction_callDllAdsPortClose
|
|
|
|
|
(JNIEnv *env, jobject obj);
|
|
|
|
|
|
|
|
|
|
//AdsGetLocalAddressn
|
|
|
|
|
JNIEXPORT jlong JNICALL Java_de_beckhoff_jni_tcads_AdsCallDllFunction_callDllAdsGetLocalAddressn
|
|
|
|
|
(JNIEnv *env, jobject obj, jobject lj_AmsAddr);
|
|
|
|
|
|
|
|
|
|
//AdsSyncReadReq
|
|
|
|
|
JNIEXPORT jlong JNICALL Java_de_beckhoff_jni_tcads_AdsCallDllFunction_callDllAdsSyncReadReq
|
|
|
|
|
(JNIEnv *env, jobject obj,
|
|
|
|
|
jobject lj_AmsAddr, // Ams address of ADS server
|
|
|
|
|
jlong lj_indexGroup, // index group in ADS server interface
|
|
|
|
|
jlong lj_indexOffset, // index offset in ADS server interface
|
|
|
|
|
jlong lj_length, // count of bytes to read
|
|
|
|
|
jobject lj_pData); // pointer to the client buffer
|
|
|
|
|
|
|
|
|
|
//AdsSyncWriteReq jbyteArray
|
|
|
|
|
JNIEXPORT jlong JNICALL Java_de_beckhoff_jni_tcads_AdsCallDllFunction_callDllAdsSyncWriteReqArray
|
|
|
|
|
(JNIEnv *env, jobject obj,
|
|
|
|
|
jobject lj_AmsAddr, // Ams address of ADS server
|
|
|
|
|
jlong lj_indexGroup, // index group in ADS server interface
|
|
|
|
|
jlong lj_indexOffset, // index offset in ADS server interface
|
|
|
|
|
jlong lj_length, // count of bytes to read
|
|
|
|
|
jbyteArray lj_pData); // pointer to the client buffer
|
|
|
|
|
|
|
|
|
|
//AdsSyncWriteReq jobject
|
|
|
|
|
JNIEXPORT jlong JNICALL Java_de_beckhoff_jni_tcads_AdsCallDllFunction_callDllAdsSyncWriteReq
|
|
|
|
|
(JNIEnv *env, jobject obj,
|
|
|
|
|
jobject lj_AmsAddr, // Ams address of ADS server
|
|
|
|
|
jlong lj_indexGroup, // index group in ADS server interface
|
|
|
|
|
jlong lj_indexOffset, // index offset in ADS server interface
|
|
|
|
|
jlong lj_length, // count of bytes to read
|
|
|
|
|
jobject lj_pData); // pointer to the client buffer
|
|
|
|
|
|
|
|
|
|
//AdsSyncReadWriteReq
|
|
|
|
|
JNIEXPORT jlong JNICALL Java_de_beckhoff_jni_tcads_AdsCallDllFunction_callDllAdsSyncReadWriteReq
|
|
|
|
|
(JNIEnv *env, jobject obj,
|
|
|
|
|
jobject lj_AmsAddr, // Ams address of ADS server
|
|
|
|
|
jlong lj_indexGroup, // index group in ADS server interface
|
|
|
|
|
jlong lj_indexOffset, // index offset in ADS server interface
|
|
|
|
|
jlong lj_cbReadLength, // count of bytes to read
|
|
|
|
|
jobject lj_pReadData, // pointer to the client buffer
|
|
|
|
|
jlong lj_cbWriteLength, // count of bytes to write
|
|
|
|
|
jobject lj_pWriteData); // pointer to the client buffer
|
|
|
|
|
|
|
|
|
|
//AdsSyncReadStateReq
|
|
|
|
|
JNIEXPORT jlong JNICALL Java_de_beckhoff_jni_tcads_AdsCallDllFunction_callDllAdsSyncReadStateReq
|
|
|
|
|
(JNIEnv *env, jobject obj,
|
|
|
|
|
jobject lj_AmsAddr, // Ams address of ADS server
|
|
|
|
|
jobject lj_nAdsState, // pointer to client buffer
|
|
|
|
|
jobject lj_nDeviceState); // pointer to the client buffer
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//AdsSyncReadDeviceInfoReq
|
|
|
|
|
JNIEXPORT jlong JNICALL Java_de_beckhoff_jni_tcads_AdsCallDllFunction_callDllAdsSyncReadDeviceInfoReq
|
|
|
|
|
(JNIEnv *env, jobject obj,
|
|
|
|
|
jobject lj_AmsAddr, // Ams address of ADS server
|
|
|
|
|
jobject lj_pDevName, // fixed length string (16 Byte)
|
|
|
|
|
jobject lj_pVersion); // client buffer to store server version
|
|
|
|
|
|
|
|
|
|
//AdsSyncWriteControlReq
|
|
|
|
|
JNIEXPORT jlong JNICALL Java_de_beckhoff_jni_tcads_AdsCallDllFunction_callDllAdsSyncWriteControlReq
|
|
|
|
|
(JNIEnv *env, jobject obj,
|
|
|
|
|
jobject lj_AmsAddr, // Ams address of ADS server
|
|
|
|
|
jint lj_adsState, // index group in ADS server interface
|
|
|
|
|
jint lj_deviceState, // index offset in ADS server interface
|
|
|
|
|
jlong lj_length, // count of bytes to write
|
|
|
|
|
jobject lj_pData); // pointer to the client buffer
|
|
|
|
|
|
|
|
|
|
//AdsSyncSetTimeout
|
|
|
|
|
JNIEXPORT jlong JNICALL Java_de_beckhoff_jni_tcads_AdsCallDllFunction_callDllAdsSyncSetTimeout
|
|
|
|
|
(JNIEnv *env, jobject obj,
|
|
|
|
|
jlong lj_nMs); // Set timeout in ms
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//AdsAmsRegisterRouterNotification
|
|
|
|
|
JNIEXPORT jlong JNICALL Java_de_beckhoff_jni_tcads_AdsCallDllFunction_callDllAdsAmsRegisterRouterNotification
|
|
|
|
|
(JNIEnv *env, jobject obj);
|
|
|
|
|
|
|
|
|
|
//AdsAmsUnRegisterRouterNotification
|
|
|
|
|
JNIEXPORT jlong JNICALL Java_de_beckhoff_jni_tcads_AdsCallDllFunction_callDllAdsAmsUnRegisterRouterNotification
|
|
|
|
|
(JNIEnv *env, jobject obj);
|
|
|
|
|
|
|
|
|
|
//AdsSyncAddDeviceNotificationReq
|
|
|
|
|
JNIEXPORT jlong JNICALL Java_de_beckhoff_jni_tcads_AdsCallDllFunction_callDllAdsSyncAddDeviceNotificationReq
|
|
|
|
|
(JNIEnv *env, jobject obj,
|
|
|
|
|
jobject lj_pAddr, // Ams address of ADS server
|
|
|
|
|
jlong lj_indexGroup, // index group in ADS server interface
|
|
|
|
|
jlong lj_indexOffset, // index offset in ADS server interface
|
|
|
|
|
jobject lj_pNoteAttrib, // attributes of notification request
|
|
|
|
|
//PAdsNotificationFunc pNoteFunc, // address of notification callback
|
|
|
|
|
jlong lj_hUser, // user handle
|
|
|
|
|
jobject lj_pNotification); // pointer to notification handle (return value)
|
|
|
|
|
|
|
|
|
|
//AdsSyncDelDeviceNotificationReq
|
|
|
|
|
JNIEXPORT jlong JNICALL Java_de_beckhoff_jni_tcads_AdsCallDllFunction_callDllAdsSyncDelDeviceNotificationReq
|
|
|
|
|
(JNIEnv *env, jobject obj,
|
|
|
|
|
jobject lj_pAddr, // Ams address of ADS server
|
|
|
|
|
jobject lj_hNotification); // notification handle
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//callDllAdsDoInitCallbacks
|
|
|
|
|
JNIEXPORT jlong JNICALL Java_de_beckhoff_jni_tcads_AdsCallDllFunction_callDllDoInitCallbacks
|
|
|
|
|
(JNIEnv *env, jobject obj, jobject aSinkObj);
|
|
|
|
|
|
|
|
|
|
//AdsDoInitDll
|
|
|
|
|
JNIEXPORT jlong JNICALL Java_de_beckhoff_jni_tcads_AdsCallDllFunction_callDllDoInitDll
|
|
|
|
|
(JNIEnv *env, jobject obj);
|
|
|
|
|
|
|
|
|
|
//AdsDoWhenUnloadDll
|
|
|
|
|
JNIEXPORT jlong JNICALL Java_de_beckhoff_jni_tcads_AdsCallDllFunction_callDllDoWhenUnloadDll
|
|
|
|
|
(JNIEnv *env, jobject obj);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
*/
|