public static CalibData readCalibJson(string fileName) { using (StreamReader r = new StreamReader(fileName)) { var json = r.ReadToEnd(); CalibData deserializedSettings = JsonConvert.DeserializeObject <CalibData>(json); return(deserializedSettings); } }
public Dev(int chipId, int devId, BME680Intf intf, int memPage, int ambTemp, CalibData calib, TphSett tphSett, GasSett gasSett, int powerMode, int newFields, int infoMsg, int comRslt) { this.ChipId = chipId; this.DevId = devId; this.Intf = intf; this.MemPage = memPage; this.AmbTemp = ambTemp; this.Calib = calib; this.TphSett = tphSett; this.GasSett = gasSett; this.PowerMode = powerMode; this.NewFields = newFields; this.InfoMsg = infoMsg; this.ComRslt = comRslt; }
private void SensorInit(string Id, string state, string Desc, float PingInterval) { if (Id.Length > Sensor.IdLength) { MessageBox.Show("Sensor ID length cannot be greater than " + Sensor.IdLength, "SensorEmulator", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.Id = Id.PadLeft(Sensor.IdLength, ' '); this.State = (StateEnum)Enum.Parse(typeof(StateEnum), state); this.Desc = (Desc == null) ? "(None)" : Desc; this.PingInterval = (PingInterval < 0) ? 5 : PingInterval; // Default ping period of 5 min this.NextExpectedMsg = SensorMsg.CommandTag.None; this.LastMsgSent = null; this.LastReading = -1; this.LastReadingTime = DateTime.MinValue; // Default date value, meaning uninitialized this.CalibParameters = new CalibData(); }