import com.sun.jna.*;
import com.sun.jna.platform.*;
import com.sun.jna.platform.win32.WinNT;
import com.sun.jna.win32.*;
import java.util.ArrayList;
public class TestJNA {
public interface MyDrivers extends StdCallLibrary {
MyDrivers INSTANCE1 = (MyDrivers)Native.loadLibrary("D:\\NCR_JNI\\DLL\\CRT_350V3.dll" , MyDrivers.class);
MyDrivers INSTANCE2 = (MyDrivers)Native.loadLibrary("D:\\NCR_JNI\\DLL\\ZT_EPP_API.dll" , MyDrivers.class);
WinNT.HANDLE CRT350ROpen(String port);
int CRT350RClose(WinNT.HANDLE ComHandle);
}
public class DriverProxy
{
WinNT.HANDLE handle;
public String Close(int type)
{
if (type == 1)
{
System.out.println(MyDrivers.INSTANCE1);
int result = MyDrivers.INSTANCE1.CRT350RClose(handle);
System.out.println(result);
}
else if (type == 2)
{
}
return "";
}
public String Open(int type, ArrayList<String> arrayList)
{
if (type == 1)
{
System.out.println(MyDrivers.INSTANCE1);
handle = MyDrivers.INSTANCE1.CRT350ROpen("COM1");
System.out.println(handle);
}
else if (type == 2)
{
}
return "";
}
}
DriverProxy driverProxy = new DriverProxy();
public static void main(String[] args) {
new TestJNA().driverProxy.Open(1, null);
new TestJNA().driverProxy.Close(1);
}
}
import com.sun.jna.platform.*;
import com.sun.jna.platform.win32.WinNT;
import com.sun.jna.win32.*;
import java.util.ArrayList;
public class TestJNA {
public interface MyDrivers extends StdCallLibrary {
MyDrivers INSTANCE1 = (MyDrivers)Native.loadLibrary("D:\\NCR_JNI\\DLL\\CRT_350V3.dll" , MyDrivers.class);
MyDrivers INSTANCE2 = (MyDrivers)Native.loadLibrary("D:\\NCR_JNI\\DLL\\ZT_EPP_API.dll" , MyDrivers.class);
WinNT.HANDLE CRT350ROpen(String port);
int CRT350RClose(WinNT.HANDLE ComHandle);
}
public class DriverProxy
{
WinNT.HANDLE handle;
public String Close(int type)
{
if (type == 1)
{
System.out.println(MyDrivers.INSTANCE1);
int result = MyDrivers.INSTANCE1.CRT350RClose(handle);
System.out.println(result);
}
else if (type == 2)
{
}
return "";
}
public String Open(int type, ArrayList<String> arrayList)
{
if (type == 1)
{
System.out.println(MyDrivers.INSTANCE1);
handle = MyDrivers.INSTANCE1.CRT350ROpen("COM1");
System.out.println(handle);
}
else if (type == 2)
{
}
return "";
}
}
DriverProxy driverProxy = new DriverProxy();
public static void main(String[] args) {
new TestJNA().driverProxy.Open(1, null);
new TestJNA().driverProxy.Close(1);
}
}