帆软使用的第三方框架。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

218 lines
9.7 KiB

package Sense4;
import com.sun.jna.Native;
import com.sun.jna.Structure;
import com.sun.jna.ptr.IntByReference;
import java.util.ArrayList;
import java.util.List;
public interface Sense32 extends com.sun.jna.Library
{
Sense32 instance = (Sense32) Native.loadLibrary("EL", Sense32.class);
public static final int S4_USER_PIN = 0x000000a1;
public static final int S4_DEV_PIN = 0x000000a2;
public static final int S4_AUTHEN_PIN = 0x000000a3;
public static final int S4_CREATE_NEW = 0x000000a5;
public static final int S4_UPDATE_FILE = 0x000000a6;
// #define S4_EXE_FILE 0x00000008 /** executable file of virtual machine*/
public static final byte S4_EXE_FILE = 0x00000008;
public static final byte S4_DATA_FILE = 0x00000009;
public static final int S4_FILE_EXIST = 0x00006a80;
// #define S4_LED_DOWN 0x00000008 /** LED down*/
public static final int S4_LED_DOWN = 0x00000008;
// #define S4_LED_WINK 0x00000028 /** LED wink*/
public static final int S4_LED_WINK = 0x00000028;
public static final int S4_GET_SERIAL_NUMBER = 0x00000026;
// #define S4_EXCLUSIZE_MODE 0 /** exclusive mode*/
// #define S4_SHARE_MODE 1 /** sharable mode*/
public static final int S4_EXCLUSIZE_MODE = 0x00000000;
public static final int S4_SHARE_MODE = 0x00000001;
// #define S4_CREATE_ROOT_DIR 0x000000ab /** create root directory*/
public static final int S4_CREATE_ROOT_DIR = 0x000000ab;
public static class RTC_TIME_T extends Structure
{
public byte second; /* second (0-59) */
public byte minute; /* minute (0-59) */
public byte hour; /* hour (0-23) */
public byte day; /* day of month (1-31) */
public byte week; /* day of week (0-6, sunday is 0) */
public byte month; /* month (0-11) */
public short year; /* year (0- 138, 1900 - 2038) */
protected List<String> getFieldOrder() {
List<String> list = new ArrayList<String>();
list.add("second");
list.add("minute");
list.add("hour");
list.add("day");
list.add("week");
list.add("month");
list.add("year");
return list;
}
}
public static class SENSE4_CONTEXT extends Structure {
public int dwIndex; /** device index; index begins at zero*/
public int dwVersion; /** device version*/
public int hLock; /** device handle*/
public byte[] reserve = new byte[12*2]; /** reserved*/
public byte[] bAtr = new byte[56]; /** ATR*/
public byte[] bID = new byte[8]; /** device ID*/
public int dwAtrLen; /** ATR length*/
protected List<String> getFieldOrder() {
List<String> list = new ArrayList<String>();
list.add("dwIndex");
list.add("dwVersion");
list.add("hLock");
list.add("reserve");
list.add("bAtr");
list.add("bID");
list.add("dwAtrLen");
return list;
}
}
/** Netlock Module infomation definition*/
// typedef struct _S4MODULEINFO {
// WORD wModuleID; /* Module ID*/
// WORD wLicenseCount; /* License Count */
// } S4MODULEINFO;
public static class S4MODULEINFO extends Structure {
public short wModuleID;
public short wLicenseCount;
protected List<String> getFieldOrder() {
List<String> list = new ArrayList<String>();
list.add("wModuleID");
list.add("wLicenseCount");
return list;
}
}
// typedef struct _S4NETCONFIG {
// DWORD dwLicenseMode; /* License Mode */
// DWORD dwModuleCount; /* Module Count */
// S4MODULEINFO ModuleInfo[16]; /* Module detail infomation */
// } S4NETCONFIG;
public static class S4NETCONFIG extends Structure {
public int dwLicenseMode;
public int dwModuleCount;
public S4MODULEINFO[] ModuleInfo = new S4MODULEINFO[16];
protected List<String> getFieldOrder() {
List<String> list = new ArrayList<String>();
list.add("dwLicenseMode");
list.add("dwModuleCount");
list.add("ModuleInfo");
return list;
}
}
// S4CREATEDIRINFO structure definition
// typedef struct _S4CREATEDIRINFO {
// DWORD dwS4CreateDirInfoSize; /* size of the structure*/
// BYTE szAtr[8]; /* ATR information */
// S4NETCONFIG NetConfig; /* netlock config infomation */
// } S4CREATEDIRINFO;
public static class S4CREATEDIRINFO extends Structure {
public int dwS4CreateDirInfoSize;
public byte[] szAtr = new byte[8];
public S4NETCONFIG NetConfig;
protected List<String> getFieldOrder() {
List<String> list = new ArrayList<String>();
list.add("dwS4CreateDirInfoSize");
list.add("szAtr");
list.add("NetConfig");
return list;
}
}
// typedef struct _S4OPENINFO {
// DWORD dwS4OpenInfoSize; /* size of the structure*/
// DWORD dwShareMode; /* share mode*/
// } S4OPENINFO;
public static class S4OPENINFO extends Structure {
public int dwS4OpenInfoSize;
public int dwShareMode;
protected List<String> getFieldOrder() {
List<String> list = new ArrayList<String>();
list.add("dwS4OpenInfoSize");
list.add("dwShareMode");
return list;
}
}
public int S4Enum(SENSE4_CONTEXT ctx, IntByReference pSize);
public int S4Open(SENSE4_CONTEXT ctx);
// DWORD WINAPI S4Control(
// IN SENSE4_CONTEXT *pS4Ctx,
// IN DWORD dwCtlCode,
// IN VOID *pInBuffer,
// IN DWORD dwInBufferLen,
// OUT VOID *pOutBuffer,
// IN DWORD dwOutBufferLen,
// OUT DWORD *pdwBytesReturned
// );
public int S4Control(
SENSE4_CONTEXT ctx,
int dwCtlCode,
byte[] pInBuffer,
int dwInBufferLen,
byte[] pOutBuffer,
int dwOutBufferLen,
IntByReference pdwBytesReturned
);
public int S4ChangeDir(SENSE4_CONTEXT ctx, String dir);
//
public int S4EraseDir(SENSE4_CONTEXT ctx, String dir);
public int S4VerifyPin(SENSE4_CONTEXT ctx, String passwd, int passwdLen, int type);
public int S4WriteFile(SENSE4_CONTEXT ctx,
String lpszFileID,
int dwOffset,
byte lpBuffer[],
int dwBufferSize,
int dwFileSize,
IntByReference pdwBytesWritten,
int dwFlags,
byte bFileType);
public int S4Execute(SENSE4_CONTEXT ctx, String fileID, byte[] inputBuf, int inputSize, byte[] outputBuf, int outputSize, IntByReference pSize);
public int S4Close(SENSE4_CONTEXT ctx);
// DWORD WINAPI S4CreateDirEx(
// IN SENSE4_CONTEXT *pS4Ctx,
// IN LPCSTR lpszDirID,
// IN DWORD dwDirSize,
// IN DWORD dwFlags,
// IN S4CREATEDIRINFO *pCreateDirInfo
// );
public int S4CreateDirEx(
SENSE4_CONTEXT ctx,
String lpszDirID,
int dwDirSize,
int dwFlags,
S4CREATEDIRINFO pCreateDirInfo
);
// DWORD WINAPI S4OpenEx(
// IN OUT SENSE4_CONTEXT *pS4Ctx,
// IN S4OPENINFO *pS4OpenInfo
// );
public int S4OpenEx(SENSE4_CONTEXT ctx, S4OPENINFO pS4OpenInfo);
}