コード例 #1
0
        public static void DealRead(byte[] readBuffer)
        {
            int mK = 1;

            try
            {
                //SearchDeviceAddress();//queryinstrument 地址
                while ((mK < readBuffer.Length - 1) && (readBuffer[mK] != 0xFF))
                {
                    mK++;
                }
                switch (readBuffer[mK + 4])
                {
                //C控制命令
                case 0x43:
                {
                }
                break;

                //Rread命令
                case 0x52:
                {
                    // (3)   read系统状态  --- ‘S’ ;
                    if (readBuffer[mK + 5] == 0x53)
                    {
                        SystemState objSystemState = new SystemState();
                        objSystemState.m_strTestType  = ((char)readBuffer[mK + 6]).ToString();
                        objSystemState.m_strTOCValue  = (readBuffer[mK + 7] << 8 + readBuffer[mK + 8]).ToString();
                        objSystemState.m_strTIC_Value = (readBuffer[mK + 9] << 8 + readBuffer[mK + 10]).ToString();
                        objSystemState.m_strCON_Value = (readBuffer[mK + 11] << 8 + readBuffer[mK + 12]).ToString();
                        objSystemState.m_strSampleNum = (readBuffer[mK + 13] << 8 + readBuffer[mK + 14]).ToString();
                        objSystemState.m_strRunStatus = ((char)readBuffer[mK + 15]).ToString();
                        ValueChanged(objSystemState);
                    }
                    //(5)   readsystem parameters  --- ‘P’ ;
                    if (readBuffer[mK + 5] == 0x50)
                    {
                        SystemArgs objSystemArgs = new SystemArgs();
                        objSystemArgs.m_strSampVmax   = (readBuffer[mK + 6] << 8 + readBuffer[mK + 7]).ToString();
                        objSystemArgs.m_strSampTimer  = (readBuffer[mK + 8] << 8 + readBuffer[mK + 9]).ToString();
                        objSystemArgs.m_strChannlSum  = readBuffer[mK + 10].ToString();
                        objSystemArgs.m_strLTests     = readBuffer[mK + 11].ToString();
                        objSystemArgs.m_strLForsake   = readBuffer[mK + 12].ToString();
                        objSystemArgs.m_strLCleartime = (readBuffer[mK + 13] << 8 + readBuffer[mK + 14]).ToString();
                        objSystemArgs.m_strTOCAlarmup = (readBuffer[mK + 15] << 8 + readBuffer[mK + 16]).ToString();
                        objSystemArgs.m_strUSAlarmup  = (readBuffer[mK + 17] << 8 + readBuffer[mK + 18]).ToString();
                        objSystemArgs.m_strStorMode   = ((char)readBuffer[mK + 19]).ToString();
                        objSystemArgs.m_strUvLamp     = (readBuffer[mK + 20] << 8 + readBuffer[mK + 21]).ToString();
                        objSystemArgs.m_strPumpPipe   = (readBuffer[mK + 22] << 8 + readBuffer[mK + 23]).ToString();
                        ValueSystemArgs(objSystemArgs);
                    }
                    //(4)   readtest结果  --- ‘R’ ;
                    if (readBuffer[mK + 5] == 0x52)
                    {
                        dealTestResult(readBuffer, true);
                    }

                    //(6)   read历史记录  --- ‘H’ ;
                    if (readBuffer[mK + 5] == 0x48)
                    {
                        dealTestResult(readBuffer, false);
                    }
                    //(8)   readaudit trail记录  --- ‘A’ ;
                    if (readBuffer[mK + 5] == 0x41)
                    {
                        dealAuditRecord(readBuffer);
                    }
                }
                break;

                //Wwrite命令
                case 0x57:
                {
                    //此处为空白,已经分散到各个控制按钮中
                }
                break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                TOCTest.utils.loghelp.log.Error(ex.Message, ex);
            }
        }
コード例 #2
0
 public static void DelegateSystemArgs(SystemArgs param)
 {
 }