public override CardReaderResponseCode MakeCard(CardMetaInfo metaInfo) { byte[] results = new byte[255]; // open port int ret = ZJWX_GasInitPort((int)this.Port, (int)this.Baudrate, results); if (ret == -1) { return(CardReaderResponseCode.CommError); } string resultsStr = System.Text.Encoding.Default.GetString(results).Trim('\0'); int dev = getDevNo(resultsStr); // make card ret = ZJWX_GasMakeCard(dev, ((ZJWXCardMetaInfo)metaInfo).WatchType, ((ZJWXCardMetaInfo)metaInfo).CardType, ((ZJWXCardMetaInfo)metaInfo).CardNo, results); if (ret == -1) { return(CardReaderResponseCode.CardError); } // close port ret = ZJWX_GasExitPort(dev); // we don't care if there's closing error since writing is already done return(CardReaderResponseCode.Success); }
public override CardReaderResponseCode MakeCard(CardMetaInfo metaInfo) { EnnewMetaInfo meta = (EnnewMetaInfo)metaInfo; int result = WriteNewCard((short)this.Port, this.Baudrate, meta.Klx, meta.Kzt, Encoding.Default.GetBytes(meta.Kh), Encoding.Default.GetBytes(meta.Tm), meta.Ql, (short)meta.Cs, meta.Ljgql, (short)meta.Bkcs, meta.Ljyql); if (result >= 0) { return(CardReaderResponseCode.Success); } else { EventLog.WriteEntry(ConfigurationManager.AppSettings["LogSource"], "Operation failed. Result: " + result.ToString(), EventLogEntryType.Error); return(CardReaderResponseCode.WriteError); } }
public abstract CardReaderResponseCode MakeCard(CardMetaInfo metaInfo);
public override CardReaderResponseCode MakeCard(CardMetaInfo metaInfo) { throw new NotImplementedException(); }