Пример #1
0
 /// <summary>
 /// 获取配置
 /// </summary>
 /// <param name="iAddr">卡ID</param>
 /// <param name="objCardCfg">参数详细信息</param>
 /// <returns></returns>
 public bool GetCfg(int iAddr, ref GlareLedSysDefPub.GasCardCfg objCardCfg)
 {
     ClearOldReadBuf();
     byte[] bBuf = GLLedProtocol.MakeCmdLedGetCfg(iAddr);
     Write(bBuf, 0, bBuf.Length);
     Thread.Sleep(1000);
     byte[] bRead = Read();
     if (bRead == null)
     {
         LogMgr.WriteErrorDefSys("GetCfg RecBuf is Null");
         return(false);
     }
     return(GLLedProtocol.AnalyeseRecGetCfg(bRead, iAddr, ref objCardCfg));
 }
Пример #2
0
 public bool GetLedCfg(int iAddr, ref CardCfgByJson cfg)
 {
     lock (this)
     {
         try
         {
             bool bError = false;
             ClearOldReadBuf();
             GlareLedSysDefPub.GasCardCfg cardcfg = new GlareLedSysDefPub.GasCardCfg();
             byte[] bBuf = GLLedProtocol.MakeCmdLedGetCfg(iAddr);
             Write(bBuf, 0, bBuf.Length);
             LogMgr.WriteInfoDefSys("send to dev:" + BitConverter.ToString(bBuf));
             Thread.Sleep(100);
             byte[] bRead = Read(out bError);
             bool   bRet  = GLLedProtocol.AnalyeseRecGetCfg(bRead, iAddr, ref cardcfg);
             if (bRet)
             {
                 cfg.bDobule       = cardcfg.bDobule;
                 cfg.bShowAppend   = cardcfg.bShowAppend;
                 cfg.iCardDigCount = cardcfg.iCardDigCount;
                 cfg.iCardType     = cardcfg.iCardType;
                 cfg.iFirmVer      = cardcfg.iFirmVer;
                 cfg.iHardVer      = cardcfg.iHardVer;
                 cfg.iID           = cardcfg.iID;
                 cfg.iLight        = cardcfg.iLight;
                 cfg.iScreenCount  = cardcfg.iScreenCount;
                 return(true);
             }
             return(false);
         }
         catch (System.Exception ex)
         {
             LogMgr.WriteInfoDefSys("读写异常" + ex.Message);
             return(false);
         }
     }
 }