//Use a key group to read the card public byte[] ReadData(ReadWriteTypeModeEnum rm, KeyModeEnum km, byte blockNo, byte keyGroupIndex, out byte[] cardSerialData) { //byte readModel = (byte)rm; byte keyModel = (byte)km; cardSerialData = SelectCard(); if (cardSerialData == null) { return(null); } if (CheckReaderKey(keyModel, blockNo, keyGroupIndex)) { byte[] pData = new byte[100]; ulong pDataLen = 0; int r = MasterRDImprot.rf_M1_read(0, blockNo, pData, ref pDataLen); if (r == 0) { byte[] resultData = new byte[pDataLen]; for (int i = 0; i < (int)pDataLen; i++) { resultData[i] = pData[i]; } return(resultData); } } return(null); }
public bool OpenLed(LightColor lc) { byte color = (byte)lc; int r = MasterRDImprot.rf_light(0, color); return(r == 0 ? true : false); }
public byte[] ReadData(KeyModeEnum km, byte blokNo, string keyStr, out byte[] cardSerialData) { // byte readModel = (byte)rm; byte keyModel = (byte)km; byte[] key = GetKeyData(keyStr); byte[] pData = new byte[100]; ulong pdataLen = 0; //Reading card serial number cardSerialData = SelectCard(); if (cardSerialData == null) { return(null); } int r; //check key r = MasterRDImprot.rf_M1_authentication2(0, keyModel, blokNo, key); r = MasterRDImprot.rf_M1_read(0, blokNo, pData, ref pdataLen); if (r == 0) { byte[] rData = new byte[pdataLen]; for (int i = 0; i < (int)pdataLen; i++) { rData[i] = pData[i]; } return(rData); } return(null); }
public bool DownloadKeyToReader(byte blockNo, string keystr) { byte[] key = GetKeyData(keystr); int r = MasterRDImprot.rf_M1_WriteKeyToEE2(0, blockNo, key); if (r == 0) { return(true); } return(false); }
public bool OpenCom(ushort comNo, ushort baud) { try { int r = MasterRDImprot.rf_init_com(comNo, baud); return(r == 0 ? true : false); } catch { throw new Exception("loi5"); } }
public bool CloseCom() { try { int r = MasterRDImprot.rf_ClosePort(); return(r == 0 ? true : false); } catch { throw new Exception("loi6"); } }
//Use key groups to write data public bool WriteData(ReadWriteTypeModeEnum rm, KeyModeEnum km, byte blockNo, byte keyGroupIndex, string pDataStr) { byte readModel = (byte)rm; byte keyModel = (byte)km; SelectCard(); if (CheckReaderKey(keyModel, blockNo, keyGroupIndex)) { byte[] pData = GetWriteData(pDataStr); int r = MasterRDImprot.rf_M1_write(0, blockNo, pData); return(r == 0 ? true : false); } return(false); }
public byte[] SelectCard() { byte[] pData = new byte[10]; byte pdataLen = 0; int r = MasterRDImprot.rf_s70_select(0, pData, ref pdataLen); if (r == 0) { byte[] rData = new byte[pdataLen]; for (int i = 0; i < pdataLen; i++) { rData[i] = pData[i]; } return(rData); } return(null); }
//Use key to write data public bool WriteData(KeyModeEnum km, byte blockNo, string keyStr, string pDataStr) { //byte readModel = (byte)rm; byte keyModel = (byte)km; byte[] key = GetKeyData(keyStr); byte[] pData = GetBlockData(pDataStr); ulong pLen = (ulong)pData.Length; SelectCard(); int r; //Check key r = MasterRDImprot.rf_M1_authentication2(0, keyModel, blockNo, key); r = MasterRDImprot.rf_M1_write(0, blockNo, pData); return(r == 0 ? true : false); }
public bool Beep(int msec) { int r = MasterRDImprot.rf_beep(0, msec); return(r == 0 ? true : false); }
public bool CheckReaderKey(byte keyModel, byte blockNo, byte keyGroupIndex) { int r = MasterRDImprot.rf_M1_authentication1(0, keyModel, blockNo, keyGroupIndex); return(r == 0 ? true : false); }