Exemple #1
0
        /// <summary>
        /// 09 78 07 0AADE9F4 09 80 00001100B6F30000C401B2018A13E8000000B100  50 09 00  3B443A000000007A
        /// </summary>
        /// <param name="model"></param>
        private void ParseSoladin(MiniParseModel model)
        {
            try
            {
                if (model == null)
                {
                    throw new ArgumentNullException("model");
                }

                var source = Reader.ReadToEnd();
                if (string.IsNullOrEmpty(source))
                {
                    _logger.LogTrace("Nothing to parse (empty string), measurementTime: {measurementTime}", model.MeasurementTime);
                    return;
                }
                var value = source.Substring(40, 6);
                model.Payloads.Add(new CounterPayload
                {
                    InternalNr = 120,
                    Value      = Read24bits(value)
                });
            }
            catch (Exception ex)
            {
                throw new Exception("Parsing soladin", ex);
            }
        }
Exemple #2
0
 private void ParseDeviceSettings(MiniParseModel model)
 {
     try
     {
         var setting = (DeviceSettingType)Reader.ReadByte();
         foreach (var item in DeviceSettingsPayload.GetDeviceSettings(BaseParseResult.ProtocolNr, setting, Reader).ToList())
         {
             model.Payloads.Add(item);
         }
     }
     catch (Exception ex)
     {
         throw new Exception("Parsing device settings", ex);
     }
 }
Exemple #3
0
 private void ParseClientStatuses(MiniParseModel model)
 {
     try
     {
         // qplat-74: clientstatus R32
         byte NbrOfClientStatussen = Reader.ReadByte();
         _logger.LogDebug("Nr of client statuses: {nbrOfClientStatussen}", NbrOfClientStatussen);
         for (byte client = 0; client < NbrOfClientStatussen; client++)
         {
             var clientId = BaseParseResult.ProtocolNr >= MiniR21.ProtocolVersion ? Reader.ReadByte() : client;
             model.Payloads.Add(new ClientStatusPayload(model.MeasurementTime, clientId, Reader.ReadByte(), BaseParseResult.ProtocolNr));
         }
     }
     catch (Exception ex)
     {
         throw new Exception("Parsing client statussen", ex);
     }
 }
Exemple #4
0
        private void ParseSmartMeter(MiniParseModel model)
        {
            try
            {
                if (model == null)
                {
                    throw new ArgumentNullException("model");
                }

                var source  = Reader.ReadToEnd();
                var strings = source.Split(':');
                if (string.IsNullOrEmpty(source))
                {
                    _logger.LogTrace("Nothing to parse (empty string), measurementTime: {measurementTime}", model.MeasurementTime);
                    return;
                }
                AddCounterPayload(model.Payloads, 181, strings.FirstOrDefault(s => s.Contains("1.8.1")), true);
                AddCounterPayload(model.Payloads, 182, strings.FirstOrDefault(s => s.Contains("1.8.2")), true);
                AddCounterPayload(model.Payloads, 281, strings.FirstOrDefault(s => s.Contains("2.8.1")), true);
                AddCounterPayload(model.Payloads, 282, strings.FirstOrDefault(s => s.Contains("2.8.2")), true);
                var raw =
                    strings.Where(
                        s =>
                        s.Contains("24.2.1)(m3)") || s.Contains("24.2.0)(m3)")).ToList();
                // Check on DSMR message for gas:
                if (raw.Count == 0)
                {
                    raw =
                        strings.Where(
                            s =>
                            s.Contains("*m3")).ToList();
                }
                AddCounterPayload(model.Payloads, 2421, raw, false);
            }
            catch (Exception ex)
            {
                throw new Exception("Parsing smart meter", ex);
            }
        }