示例#1
0
 /// <summary>
 /// 读取油价牌的内容
 /// </summary>
 /// <param name="iAddr"></param>
 /// <param name="objOilVal"></param>
 /// <returns></returns>
 public bool ReadOilVal(int iAddr, ref List <GlareLedSysDefPub.CardGasValEachNumAByte> lstOilVal)
 {
     ClearOldReadBuf();
     byte[] bBuf = GLLedProtocol.MakeCmdLedGetOilVal(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.AnalyeseRecGetOilVal(bRead, iAddr, ref lstOilVal));
 }
 public bool ReadOilVal(int iAddr, ref List <GlareLedSysDefPub.CardGasValEachNumAByte> lstOilVal)
 {
     try
     {
         ClearOldReadBuf();
         bool   bError = false;
         byte[] bBuf   = GLLedProtocol.MakeCmdLedGetOilVal(iAddr);
         Write(bBuf, 0, bBuf.Length);
         Thread.Sleep(1000);
         byte[] bRead = Read(out bError);
         if (bRead != null)
         {
             LogMgr.WriteInfoDefSys("recbuf bytes:" + BitConverter.ToString(bRead));
         }
         return(GLLedProtocol.AnalyeseRecGetOilVal(bRead, iAddr, ref lstOilVal));
     }
     catch (System.Exception ex)
     {
         LogMgr.WriteInfoDefSys("Write Exception" + ex.Message);
         return(false);
     }
 }
 public bool ReadOilValString(int iAddr, ref string strVals)
 {
     lock (this)
     {
         try
         {
             byte[] bBuf = GLLedProtocol.MakeCmdLedGetOilVal(iAddr);
             Write(bBuf, 0, bBuf.Length);
             Thread.Sleep(100);
             bool   bError = false;
             byte[] bRead  = Read(out bError);
             if (bRead != null)
             {
                 LogMgr.WriteInfoDefSys("recbuf bytes:" + BitConverter.ToString(bRead));
             }
             return(GLLedProtocol.AnalyeseRecGetOilValString(bRead, iAddr, ref strVals));
         }
         catch (System.Exception ex)
         {
             LogMgr.WriteInfoDefSys("读写异常" + ex.Message);
             return(false);
         }
     }
 }