Newer
Older
SensorHub / SensorHub.Servers / JsonFormat / DataJson.cs
root on 17 Sep 2021 2 KB first commit
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SensorHub.Servers.JsonFormat
{
    public class DataJson : JsonBody
    {
        [JsonProperty("cell", DefaultValueHandling = DefaultValueHandling.Ignore)]
        [DefaultValue(-1)]
        public int cell { get; set; }   //电量

        [JsonProperty("pci", DefaultValueHandling = DefaultValueHandling.Ignore)]
        [DefaultValue(null)]
        public int? pci { get; set; }   //主小区物理小区号PCI,范围: 0 – 503

        [JsonProperty("rsrp", DefaultValueHandling = DefaultValueHandling.Ignore)]
        [DefaultValue(null)]
        public int? rsrp { get; set; }

        [JsonProperty("snr", DefaultValueHandling = DefaultValueHandling.Ignore)]
        [DefaultValue(null)]
        public int? snr { get; set; }


        [JsonProperty("datas", DefaultValueHandling = DefaultValueHandling.Ignore)]
        public List<DatasJson> datas { get; set; }   //数据数组
        public string logTime { get; set; }   //记录时间

        [JsonProperty("loopStates", DefaultValueHandling = DefaultValueHandling.Ignore)]
        public List<State> loopStates { get; set; }   //回路状态数组

        public DataJson(string bType, int cell, int? pci, int? rsrp, int? snr, List<DatasJson> datas, string logTime)
            : base(bType)
        {
            this.cell = cell;
            this.pci = pci;
            this.rsrp = rsrp;
            this.snr = snr;
            this.datas = datas;
            this.logTime = logTime;
        }

        public DataJson(string bType, int cell, int? pci, int? rsrp, int? snr, List<DatasJson> datas, string logTime, List<State> loopStates)
            : base(bType)
        {
            this.cell = cell;
            this.pci = pci;
            this.rsrp = rsrp;
            this.snr = snr;
            this.datas = datas;
            this.logTime = logTime;

            this.loopStates = loopStates;
        }

        public DataJson(string bType, int cell, List<DatasJson> datas, string logTime)
            : base(bType)
        {
            this.cell = cell;
            this.datas = datas;
            this.logTime = logTime;
        }
    }
}