예제 #1
0
 protected override void ConvertAndStore(J1939Message message)
 {
     if (!enforceIncreasedValues || rawValue > value)
     {
         value = valueMetric = rawValue;
         base.ConvertAndStore(message);
     }
 }
예제 #2
0
        public override void Parse(J1939Message message)
        {
            uint temp = 0;

            if (UpdateUint(ref temp, message.data.ToArray(), byteIndex) != 0)
            {
                rawValue = temp;
                ConvertAndStore(message);
            }
        }
예제 #3
0
        public override void Parse(J1939Message message)
        {
            byte b = 0;

            if (UpdateByte(ref b, message.data[byteIndex]) != 0)
            {
                rawValue = b;
                ConvertAndStore(message);
            }
        }
예제 #4
0
        public override void Parse(J1939Message message)
        {
            byte b = 0;

            if (UpdateBits(ref b, message.data[byteIndex], bitIndex, length) != 0)
            {
                rawValue = (uint)(b & bitmask[length]);
                ConvertAndStore(message);
            }
        }
예제 #5
0
 protected virtual void ConvertAndStore(J1939Message message)
 {
     message.CanMessageSegments.Add(
         new J1939MessageSegment()
     {
         PGN           = message.pgn,
         Pid           = spn,
         SourceAddress = message.address,
         RawValue      = this.rawValue,
         StandardValue = this.value,
         MetricValue   = this.valueMetric,
         ParseStatus   = this.ParseStatus,
     });
 }
예제 #6
0
 protected override void ConvertAndStore(J1939Message message)
 {
     if (recipNum != 0.0)
     {
         value       = rawValue * scale + offset;
         valueMetric = (recipNum / value); //right now only instant mpg recent and rolling mpg use this
         value       = valueMetric;        //this only applies to gauges using L/100Km
     }
     else
     {
         value       = rawValue * scale + offset;
         valueMetric = rawValue * metricScale + metricOffset;
     }
     base.ConvertAndStore(message);
     lastRawValue = rawValue;
 }
예제 #7
0
        public override void Parse(J1939Message message)
        {
            byte b = 0;

            if (UpdateByte(ref b, message.data[1]) != 0)
            {
                if (b < 125)
                {
                    rawValue = (uint)(250 - b);
                }
                else
                {
                    rawValue = b;
                }
                ConvertAndStore(message);
            }
        }
예제 #8
0
 /// <summary>
 /// Instantiates a J1939 can message from the raw message, then passes the message to the J1939 parser,
 /// which handles both extraction and parsing
 /// </summary>
 /// <param name="rawMessage"></param>
 /// <param name="e"></param>
 private void ProcessJ1939Data(string rawMessage, VMSCommDataEventArgs e)
 {
     try
     {
         var canMessage = new J1939Message(rawMessage, e.timeStamp);
         if (canMessage.IsValidMessage())
         {
             canMessage.ExtractMessage();
             _J1939Parser.Parse(canMessage);
             PublishNewDataEvent(canMessage);
         }
     }
     catch (Exception ex)
     {
         RaiseVMSEvent?.Invoke(this, new VMSCommDataErrorEventArgs(e, MessageError.UnrecognizedMessage, ex));
         ErrorLogger.GenerateErrorRecord(ex);
     }
 }
예제 #9
0
        public override void Parse(J1939Message message)
        {
            byte b = 0;

            if (UpdateFlag(ref b, message.data[3], 0) != 0)
            {
                if (b == 0)
                {
                    rawValue = 0;   //"Off"
                }
                else
                {
                    rawValue = 1;   //"On"
                }
            }
            if (UpdateFlag(ref b, message.data[3], 2) != 0)
            {
                rawValue = 2;   //"Set"
            }
            ConvertAndStore(message);
        }
예제 #10
0
 public abstract void Parse(J1939Message message);