Ejemplo n.º 1
0
        public List <SNetSignalTransEventArgs> AnalysisSignal <T>(object sender, object msg, IList <T> infos)
        {
            var result  = new List <SNetSignalTransEventArgs>();
            var secsMsg = msg as CxHsmsMessage;

            try
            {
                var list = secsMsg.rootNode as CxSecsIINodeList;

                for (int idx = 0; idx < list.Data.Count; idx++)
                {
                    var ea = new SNetSignalTransEventArgs();
                    ea.Sender = sender;
                    var data = list.Data[idx] as CxSecsIINodeASCII;
                    if (data.Data.Count <= 0)
                    {
                        continue;
                    }

                    ea.Data = new List <double>();
                    ea.Data.Add(double.Parse(data.GetString()));

                    //this.OnDataTrigger(ea);
                    result.Add(ea);
                }
                return(result);
            }
            catch (Exception ex) { CtkLog.Write(ex); }

            return(null);
        }
Ejemplo n.º 2
0
        public List <SNetSignalTransEventArgs> AnalysisSignal <T>(object sender, object msg, IList <T> infos)
        {
            var result = new List <SNetSignalTransEventArgs>();

            var line = msg as string;

            var ea = new SNetSignalTransEventArgs();

            ea.Sender = sender;
            var args = line.Split(new char[] { '\0', ' ' });

            ea.Data = new List <double>();

            UInt32 val = 0;

            for (int idx = 0; idx < args.Length; idx++)
            {
                var arg = args[idx];


                if (args[idx] == "-respData" || args[idx] == "-resp_data")
                {
                    continue;
                }
                else if (args[idx] == "-svid" || args[idx] == "-channel")
                {
                    idx++;
                    if (args.Length <= idx)
                    {
                        continue;
                    }

                    if (UInt32.TryParse(args[idx], out val))
                    {
                        ea.Svid = val;
                    }
                    continue;
                }
                else if (args[idx] == "-data")
                {
                    idx = ReadData(args, idx, ea.Data);
                    continue;
                }
            }

            result.Add(ea);
            return(result);
        }