Example #1
0
        protected override ParsedData Parse(ParserData parserData)
        {
            string   devEUI   = parserData.GetDevEUI();
            DateTime dateTime = parserData.GetTime();

            decimal batV      = parserData.GetPayloadValue("BatV").AsDecimal();
            var     keyValues = new List <ParsedData.KeyValue>()
            {
                new ParsedData.KeyValue("BatV", batV),
                new ParsedData.KeyValue("BatPrc", (batV - 3.40m) / 0.60m * 100),
                new ParsedData.KeyValue("RSSI", parserData.GetRSSI()),
            };

            return(new ParsedData(devEUI, dateTime, keyValues));
        }
Example #2
0
        protected override ParsedData Parse(ParserData parserData)
        {
            string   devEUI   = parserData.GetDevEUI();
            DateTime dateTime = parserData.GetTime();

            var keyValues = new List <ParsedData.KeyValue>()
            {
                new ParsedData.KeyValue("BatV", parserData.GetPayloadValue("BatV").AsDecimal()),
                new ParsedData.KeyValue("Air.Temperature", parserData.GetPayloadValue("TempC_SHT").AsDecimal()),
                new ParsedData.KeyValue("Air.Humidity", parserData.GetPayloadValue("Hum_SHT").AsDecimal()),
                new ParsedData.KeyValue("RSSI", parserData.GetRSSI()),
            };

            if (parserData.TryGetPayloadValue("TempC_DS", out ParserValue parserValue) && !parserValue.IsNull())
            {
                keyValues.Add(new ParsedData.KeyValue("Soil.Temperature", parserValue.AsDecimal()));
            }

            return(new ParsedData(devEUI, dateTime, keyValues));
        }