コード例 #1
0
ファイル: TCPPort.cs プロジェクト: vincecoming/TheFitGasMgr
 /// <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));
 }
コード例 #2
0
 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);
     }
 }