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