Example #1
0
 protected virtual void AddCounterPayload(Mini07ParseModel model, CounterGroup group)
 {
     model.Payloads.Add(new CounterWithSourcePayload
     {
         InternalNr   = Parser.ParseByte(),
         Value        = Parser.ParseUInt32(),
         PrimaryMeter = group.PrimaryMeterCounters,
         Source       = group.CounterSource
     });
 }
Example #2
0
        protected override void AddCounterPayload(Mini07ParseModel model, CounterGroup group)
        {
            byte number = Reader.ReadByte();

            model.Payloads.Add(new R21CounterPayload
            {
                InternalNr = number & 0x7F,
                // Bit 7 (0x80) indicates if the counter value is valid (0) / invalid (1)
                IsValid      = (number & 0x80) == 0x00,
                Value        = Reader.ReadUInt32(),
                PrimaryMeter = group.PrimaryMeterCounters,
                Source       = group.CounterSource
            });
        }
Example #3
0
        protected override void ParseCounters(Mini07ParseModel model)
        {
            Logger.LogDebug("Nr of countergroups: {nrOfCounters}", model.PayloadIndicator.NrOfCounters);
            int i = 0;

            // Total number of counters
            while (i < model.PayloadIndicator.NrOfCounters)
            {
                try
                {
                    // Grouped per CounterGroup
                    var group = new CounterGroup(Parser.ParseByte());
                    for (var c = 0; c < group.NbrOfCounters; c++)
                    {
                        AddCounterPayload(model, group);
                        i++;
                    }
                }
                catch (Exception ex)
                {
                    throw new Exception(String.Format("Parsing counter payload (payload {0} of {1})", i + 1, model.PayloadIndicator.NrOfCounters), ex);
                }
            }
        }