// Java Demo for ADU devices
class AduJava {
public native int displayVersion();
public native int OpenAduDevice(int iTimeout);
public native int WriteAduDevice(int hDevice,
String jBuffer,
int nNumberOfBytesToWrite,
int iTimeout);
public native String ReadAduDevice(int hDevice,
int nNumberOfBytesToRead,
int iTimeout);
public native void CloseAduDevice(int hDevice);
static {
System.loadLibrary("AduJava");
}
public static void main(String[] args) {
int iVersion;
int iThousands;
int iHundreds;
int iTens;
int iUnits;
int iBytes = 0;
int handle;
int iRC;
AduJava me = new AduJava();
iVersion = me.displayVersion();
iThousands = iVersion / 1000;
iHundreds = iVersion / 100 - iThousands*10;
iTens = iVersion / 10 - iThousands*100 - iHundreds*10;
iUnits = iVersion - iThousands*1000 - iHundreds*100 - iTens*10;
System.out.println("Mainline sees version: " +
iThousands + "." +
iHundreds + "." +
iTens + "." +
iUnits);
handle = me.OpenAduDevice(500);
iRC = me.WriteAduDevice(handle, "mk0", 3, 500);
iRC = me.WriteAduDevice(handle, "mk1", 3, 500);
if (args.length > 0)
{
iRC = me.WriteAduDevice(handle, args[0], args[0].length(), 500);
}
iRC = me.WriteAduDevice(handle, "rpk", 3, 500);
String sResponse = me.ReadAduDevice(handle, 4, 500);
System.out.println("Mainline sees response: " + sResponse);
me.CloseAduDevice(handle);
}
}
AduJava Help File Version 1.0.0.0
Copyright 2005 Ontrak Control Systems Inc.
|