Exemple #1
0
        /// <summary>
        /// 处理完整包数据
        /// </summary>
        public void DealComData()
        {
            string        txtres = "";
            string        res    = "";
            List <String> value  = new List <string>();

            for (int i = 0; i < m_lstPackData.Count; i++)
            {
                PackData pd = m_lstPackData[i];
                switch (m_lstPackData[i].m_Head.DataCommand)
                {
                case 128:
                    res = DealCmd.DealGetSignal(pd);
                    if (res != string.Empty)
                    {
                        channelNum = GetChannel(res);
                    }
                    //txtSignalInfo += "Commond 128  信号类型:" + pd.m_SignalType + ";内容:" + res + Environment.NewLine;
                    break;

                case 123:
                    res     = DealCmd.DealTransferDataSignal(pd);
                    txtres += "Commond 123  信号类型:" + pd.m_SignalType + ";信号名称:" + res + Environment.NewLine;
                    break;

                case 124:
                    res = DealCmd.DealSerialData(pd);
                    string[] sArray = res.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);

                    int j = 0;
                    foreach (var p in channelNum)
                    {
                        ChannelData channeldata = new ChannelData()
                        {
                            channel = p,
                            data    = sArray[j]
                        };
                        channelList.Add(channeldata);
                        j++;
                    }
                    break;

                case 125:
                    res     = DealCmd.DealStatData(pd);
                    txtres += "Commond 125Stat  信号数:" + pd.m_SignalCount + ";数据:" + res + Environment.NewLine;
                    break;

                case 126:
                    res     = DealCmd.DealBlockData(pd);
                    txtres += "Commond 126Block  信号字符串长度:" + pd.m_SignalNameLength + ";信号名:" + pd.m_SignalName
                              + ";一个数据中包含几个float:" + pd.m_YCount + ";数据量:" + pd.m_DataCount + ";数据:" + res + Environment.NewLine;
                    break;
                }
            }
            m_lstPackData.Clear();
            if (channelList != null)
            {
                HandleGetData(channelList);
            }
        }
Exemple #2
0
 private void GetSignalInfo()
 {
     s.Send(DealCmd.GetCmdGetSerialSignal());
     s.Send(DealCmd.GetCmdGetBlockSignal());
     s.Send(DealCmd.GetCmdGetStatSignal());
 }