public void Parse(CanMessage canMessage)
        {
            var j1939Message = (canMessage as J1939Message);

            //Parse the data if it is available in the map of standard parsers
            if (PGNMap.ContainsKey(j1939Message.pgn) && PGNMap[j1939Message.pgn] != null)
            {
                foreach (TSPNDatum datum in PGNMap[j1939Message.pgn])
                {
                    datum.Parse(j1939Message);
                }
            }
            //Add a single empty J1939MessageSegment, with ParseStatus left at NotParsed. These messages should either
            //be dropped or handled by an AvcancedParser
            else
            {
                j1939Message.CanMessageSegments.Add(
                    new J1939MessageSegment()
                {
                    Pid           = ushort.MaxValue,
                    PGN           = j1939Message.pgn,
                    SourceAddress = j1939Message.address,
                    RawData       = j1939Message.data.ToList(),
                    RawValue      = 1,
                    StandardValue = 1,
                    MetricValue   = 1,
                    ParseStatus   = ParseStatus.NotParsed,
                });
            }
        }
Beispiel #2
0
 private void PublishNewDataEvent(CanMessage message)
 {
     foreach (var segment in message.CanMessageSegments)
     {
         if (segment.ParseStatus == ParseStatus.Parsed)
         {
             segment.TimeParsed = DateTime.Now;
             var e = new VMSParsedDataEventArgs(segment.Pid, segment);
             RaiseVMSEvent?.Invoke(this, e);
         }
         else
         {
             PublishUnparsedData(segment);
         }
     }
 }
Beispiel #3
0
        public void Parse(CanMessage canMessage)
        {
            J1708Message j1708Message = (canMessage as J1708Message);

            foreach (CanMessageSegment segment in canMessage.CanMessageSegments)
            {
                if (J1708ParseMethodMap.ContainsKey(segment.Pid))
                {
                    J1708ParseMethodMap[segment.Pid].ParseMethod(segment, J1708ParseMethodMap[segment.Pid]);
                }
                else
                {
                    CreateUnsupportedResponse(segment);
                }
            }
        }