public bool SetLedCfg(int iAddr, CardCfgByJson cfg)
        {
            lock (this)
            {
                try
                {
                    ClearOldReadBuf();
                    bool bError = false;
                    GlareLedSysDefPub.GasCardCfg cardcfg = new GlareLedSysDefPub.GasCardCfg();
                    cardcfg.bDobule       = cfg.bDobule;
                    cardcfg.bShowAppend   = cfg.bShowAppend;
                    cardcfg.iCardDigCount = cfg.iCardDigCount;
                    cardcfg.iCardType     = cfg.iCardType;
                    cardcfg.iFirmVer      = cfg.iFirmVer;
                    cardcfg.iHardVer      = cfg.iHardVer;
                    cardcfg.iID           = cfg.iID;
                    cardcfg.iLight        = cfg.iLight;
                    cardcfg.iScreenCount  = cfg.iScreenCount;

                    byte[] bBuf = GLLedProtocol.MakeCmdLedSetCfg(iAddr, cardcfg);
                    Write(bBuf, 0, bBuf.Length);
                    Thread.Sleep(100);
                    byte[] bRead = Read(out bError);
                    return(GLLedProtocol.AnalyeseRecSetCardCfg(bRead, iAddr));
                }
                catch (System.Exception ex)
                {
                    LogMgr.WriteInfoDefSys("读写异常" + ex.Message);
                    return(false);
                }
            }
        }
示例#2
0
 /// <summary>
 /// 读取时间
 /// </summary>
 public bool ReadTime(int iAddr, ref DateTime dtRead)
 {
     ClearOldReadBuf();
     byte[] bBuf = TimeTempProtocol.MakeGetTime(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.AnalyeseRecSetCardCfg(bRead, iAddr));
 }
示例#3
0
 /// <summary>
 /// 设置卡的参数
 /// </summary>
 /// <param name="iAddr">卡ID</param>
 /// <param name="objCardCfg">参数</param>
 /// <returns></returns>
 public bool SetCfg(int iAddr, GlareLedSysDefPub.GasCardCfg objCardCfg)
 {
     ClearOldReadBuf();
     byte[] bBuf = GLLedProtocol.MakeCmdLedSetCfg(iAddr, objCardCfg);
     Write(bBuf, 0, bBuf.Length);
     Thread.Sleep(1000);
     byte[] bRead = Read();
     if (bRead == null)
     {
         LogMgr.WriteErrorDefSys("GetCfg RecBuf is Null");
         return(false);
     }
     return(GLLedProtocol.AnalyeseRecSetCardCfg(bRead, iAddr));
 }