int deviceId = 0;
int resourceId=RES_ID;
byte[] readerBytes = AStringUtilities.StringToBytesWithFinalNull(host);
int status = win32Mp300ComDll.OpenCommunication(readerBytes);
if (RET_OK != status)
throw new MP300Exception("Fail to establish communication with " + host, status);
status = win32Mp300ComDll.MPOS_OpenResource(resourceId, couplerId, OVERRIDE);
if (RET_OK != status)
throw new MP300Exception("Fail to establish communication with " + host, status);
status = win32Mp300ComDll.MPS_ResetHard(couplerId);
if (RET_OK != status) throw new MP300Exception("Fail to establish communication with " + host, status);
SCardSetVdd(deviceId,couplerId,5000);
status = win32Mp300ComDll.MPS_CardDetect(couplerId);
GenericTerminal.State out;
switch (status) {
case RET_OK:
out = GenericTerminal.State.CARD_PRESENT;
break;
case CRET_ABSENT:
out = GenericTerminal.State.CARD_ABSENT;
break;
default:
throw new MP300Exception("MPS_CardDetect failed", status);
}
System.out.println(out);
win32Mp300ComDll.CloseCommunication();
}