sdf fix
This commit is contained in:
parent
ff59a4fe30
commit
3646cce811
@ -34,7 +34,6 @@ public abstract class JnaSdfAdaptor implements SdfApiAdapter {
|
|||||||
protected final SdfLibrary sdfLibrary;
|
protected final SdfLibrary sdfLibrary;
|
||||||
|
|
||||||
protected abstract int getAlgId(AlgId alg);
|
protected abstract int getAlgId(AlgId alg);
|
||||||
protected abstract void checkRes(int res);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String openDevice() {
|
public String openDevice() {
|
||||||
|
@ -30,6 +30,7 @@ public class SunyardJnaSdfAdaptor extends JnaSdfAdaptor {
|
|||||||
|
|
||||||
private final String ip;
|
private final String ip;
|
||||||
private final Integer port;
|
private final Integer port;
|
||||||
|
private String libName;
|
||||||
private final Integer connTimeout;
|
private final Integer connTimeout;
|
||||||
private final Integer dealTimeout;
|
private final Integer dealTimeout;
|
||||||
|
|
||||||
@ -72,13 +73,14 @@ public class SunyardJnaSdfAdaptor extends JnaSdfAdaptor {
|
|||||||
));
|
));
|
||||||
this.ip = ip;
|
this.ip = ip;
|
||||||
this.port = port;
|
this.port = port;
|
||||||
|
this.libName = libName;
|
||||||
this.connTimeout = connTimeout;
|
this.connTimeout = connTimeout;
|
||||||
this.dealTimeout = dealTimeout;
|
this.dealTimeout = dealTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String openDevice() {
|
public String openDevice() {
|
||||||
SunyardSdfLibrary sunyardSdfLibrary = (SunyardSdfLibrary) sdfLibrary;
|
SunyardSdfLibrary sunyardSdfLibrary = SDF_LIB_MAP.computeIfAbsent(libName, k -> Native.load(libName, SunyardSdfLibrary.class));
|
||||||
PointerByReference phDeviceHandle = new PointerByReference();
|
PointerByReference phDeviceHandle = new PointerByReference();
|
||||||
sunyardSdfLibrary.SDF_OpenDevice(phDeviceHandle, safeStringBytes(ip), port, connTimeout, dealTimeout, 0);
|
sunyardSdfLibrary.SDF_OpenDevice(phDeviceHandle, safeStringBytes(ip), port, connTimeout, dealTimeout, 0);
|
||||||
String key = UUID.randomUUID().toString();
|
String key = UUID.randomUUID().toString();
|
||||||
@ -91,10 +93,6 @@ public class SunyardJnaSdfAdaptor extends JnaSdfAdaptor {
|
|||||||
return SunyardAlgId.valueOf(alg.name()).getValue();
|
return SunyardAlgId.valueOf(alg.name()).getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void checkRes(int res) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static byte[] safeStringBytes(String str) {
|
public static byte[] safeStringBytes(String str) {
|
||||||
if (null == str || str.isEmpty()) {
|
if (null == str || str.isEmpty()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user