public bool SendOilContext(int iAddr, IList <string> lstStrings)
 {
     lock (this)
     {
         try
         {
             ClearOldReadBuf();
             bool bError = false;
             IList <GlareLedSysDefPub.CardGasValEachNumAByte> lstOilVals = GLLedProtocol.MakeOilValBytesByString(lstStrings);
             byte[] bBuf = GLLedProtocol.MakeCmdLedSetOilVal(iAddr, lstOilVals);
             Write(bBuf, 0, bBuf.Length);
             LogMgr.WriteInfoDefSys("send bytes:" + BitConverter.ToString(bBuf));
             Thread.Sleep(100);
             byte[] bRead = Read(out bError);
             if (bRead != null)
             {
                 LogMgr.WriteInfoDefSys("recbuf bytes:" + BitConverter.ToString(bRead));
             }
             return(GLLedProtocol.AnalyeseRecSetOilVal(bRead, iAddr));
         }
         catch (System.Exception ex)
         {
             LogMgr.WriteInfoDefSys("Write Execption" + ex.Message);
             return(false);
         }
     }
 }
Example #2
0
        public bool SendOilContext(int iAddr, IList <string> lstStrings)
        {
            ClearOldReadBuf();
            IList <GlareLedSysDefPub.CardGasValEachNumAByte> lstOilVals = GLLedProtocol.MakeOilValBytesByString(lstStrings);

            byte[] bBuf = GLLedProtocol.MakeCmdLedSetOilVal(iAddr, lstOilVals);
            Write(bBuf, 0, bBuf.Length);
            Thread.Sleep(1000);
            byte[] bRead = Read();
            if (bRead == null)
            {
                LogMgr.WriteErrorDefSys("SendOilContext RecBuf is Null");
                return(false);
            }
            return(GLLedProtocol.AnalyeseRecSetOilVal(bRead, iAddr));
        }