private static void GetConfig(int comHandle) { byte[] pTxFrame; byte[] pRxFrame; HFREADER_CONFIG config; string cfg; pTxFrame = new byte[0x400]; pRxFrame = new byte[0x400]; config = new HFREADER_CONFIG(); Trace.WriteLine("hfReaderGetConfig"); int retc = protocol.hfReaderGetConfig(comHandle, 0x0000, 0x0001, ref config, pTxFrame, pRxFrame); cfg = string.Format("workMode={0}," + "readerAddr={1}," + " cmdMode={2}," + " afiCtrl={3}," + " uidSendMode={4}," + " tagStatus={5}," + " baudrate={6}," + " beepStatus={7}," + " afi={8}," , config.workMode , config.readerAddr , config.cmdMode , config.afiCtrl , config.uidSendMode , config.tagStatus , config.baudrate , config.beepStatus , config.afi); Trace.WriteLine("hfReaderGetConfig ret:" + retc.ToString() + ", config:" + cfg.ToString()); }
private static void SetConfig(int comHandle) { byte[] pTxFrame; byte[] pRxFrame; HFREADER_CONFIG config; string cfg; config = new HFREADER_CONFIG(); pTxFrame = new byte[0x400]; pRxFrame = new byte[0x400]; config.afi = 0; config.afiCtrl = protocol.HFREADER_CFG_AFI_DISABLE; config.baudrate = protocol.HFREADER_CFG_BAUDRATE38400; config.beepStatus = protocol.HFREADER_CFG_BUZZER_ENABLE; config.cmdMode = protocol.HFREADER_CFG_INVENTORY_TRIGGER; config.readerAddr = 0x0001; config.tagStatus = protocol.HFREADER_CFG_QUERY_DISABLE; config.uidSendMode = protocol.HFREADER_CFG_UID_POSITIVE; config.workMode = protocol.HFREADER_CFG_WM_INVENTORY | (protocol.HFREADER_CFG_TYPE_ISO14443A << 4); cfg = string.Format("workMode={0}," + "readerAddr={1}," + " cmdMode={2}," + " afiCtrl={3}," + " uidSendMode={4}," + " tagStatus={5}," + " baudrate={6}," + " beepStatus={7}," + " afi={8}," , config.workMode , config.readerAddr , config.cmdMode , config.afiCtrl , config.uidSendMode , config.tagStatus , config.baudrate , config.beepStatus , config.afi); Trace.WriteLine("hfReaderSetConfig config:" + cfg.ToString()); int retsetconfig = protocol.hfReaderSetConfig(comHandle, 0, 1, ref config, pTxFrame, pRxFrame); Trace.WriteLine("hfReaderSetConfig ret:" + retsetconfig.ToString() + ", config:" + cfg.ToString()); }
public static extern int hfReaderSetConfig(int h, ushort srcAddr, ushort targetAddr, ref HFREADER_CONFIG pConfig, byte[] pTxFrame, byte[] pRxFrame);