/// <summary> /// Updates the Properties used in Report1Data. /// </summary> /// <param name="data">The Wallbox data.</param> public void Refresh(WallboxData data) { if (data != null) { ID = data.Report2.ID; State = data.Report2.State; Error1 = data.Report2.Error1; Error2 = data.Report2.Error2; Plug = data.Report2.Plug; AuthON = data.Report2.AuthON; AuthRequired = data.Report2.AuthReq; EnableSystem = data.Report2.EnableSys; EnableUser = data.Report2.EnableUser; MaxCurrent = data.Report2.MaxCurr / 1000.0; DutyCycle = data.Report2.MaxCurrPercent / 10.0; CurrentHW = data.Report2.CurrHW / 1000.0; CurrentUser = data.Report2.CurrUser / 1000.0; CurrentFS = data.Report2.CurrFS / 1000.0; TimeoutFS = data.Report2.TmoFS; CurrentTimer = data.Report2.CurrTimer / 1000.0; TimeoutCT = data.Report2.TmoCT; SetEnergy = data.Report2.Setenergy / 10000.0; Output = data.Report2.Output; Input = data.Report2.Input; Serial = data.Report2.Serial; Seconds = data.Report2.Sec; } Status = data?.Status ?? Uncertain; }
/// <summary> /// Updates the Properties used in Report1Data. /// </summary> /// <param name="data">The Wallbox data.</param> public void Refresh(WallboxData data) { if (data != null) { ID = data.Report1.ID; Product = data.Report1.Product; Serial = data.Report1.Serial; Firmware = data.Report1.Firmware; ComModule = (ComModulePresent)data.Report1.ComModule; Backend = (BackendPresent)data.Report1.Backend; TimeQ = data.Report1.TimeQ; DIPSwitch = (DipSwitches)Convert.ToInt64(data.Report1.DipSW, 16); Seconds = data.Report1.Sec; } Status = data?.Status ?? Uncertain; }
/// <summary> /// Updates the Properties used in ReportsData. /// </summary> /// <param name="data">The Wallbox data.</param> /// <param name="id">The reports index (100 - 130).</param> public void Refresh(WallboxData data, int id = 100) { if (data != null) { CultureInfo provider = CultureInfo.InvariantCulture; if (id == Wallbox.REPORTS_ID) { ID = data.Report100.ID; SessionID = data.Report100.SessionID; CurrentHW = data.Report100.CurrHW / 1000.0; EnergyConsumption = data.Report100.Estart / 10000.0; EnergyTransferred = data.Report100.Epres / 10000.0; StartedSeconds = data.Report100.StartedSec; EndedSeconds = data.Report100.EndedSec; Started = DateTime.TryParse(data.Report100.Started, out DateTime started) ? started : new DateTime(); Ended = DateTime.TryParse(data.Report100.Ended, out DateTime ended) ? ended : new DateTime(); Reason = data.Report100.Reason; TimeQ = data.Report100.TimeQ; RFID = data.Report100.RFIDclass; Serial = data.Report100.Serial; Seconds = data.Report100.Sec; } else if ((id > Wallbox.REPORTS_ID) && (id <= (Wallbox.MAX_REPORTS + Wallbox.REPORTS_ID))) { int index = id - (Wallbox.REPORTS_ID + 1); ID = data.Reports[index].ID; SessionID = data.Reports[index].SessionID; CurrentHW = data.Reports[index].CurrHW / 1000.0; EnergyConsumption = data.Reports[index].Estart / 10000.0; EnergyTransferred = data.Reports[index].Epres / 10000.0; StartedSeconds = data.Reports[index].StartedSec; EndedSeconds = data.Reports[index].EndedSec; Started = DateTime.TryParse(data.Reports[index].Started, out DateTime started) ? started : new DateTime(); Ended = DateTime.TryParse(data.Reports[index].Ended, out DateTime ended) ? ended : new DateTime(); Reason = data.Reports[index].Reason; TimeQ = data.Reports[index].TimeQ; RFID = data.Reports[index].RFIDclass; Serial = data.Reports[index].Serial; Seconds = data.Reports[index].Sec; } } Status = data?.Status ?? Uncertain; }
/// <summary> /// Updates the Properties used in Report3Data. /// </summary> /// <param name="data">The Wallbox data.</param> public void Refresh(WallboxData data) { if (data != null) { ID = data.Report3.ID; VoltageL1N = data.Report3.U1; VoltageL2N = data.Report3.U2; VoltageL3N = data.Report3.U3; CurrentL1 = data.Report3.I1 / 1000.0; CurrentL2 = data.Report3.I2 / 1000.0; CurrentL3 = data.Report3.I3 / 1000.0; Power = data.Report3.P / 1000000.0; PowerFactor = data.Report3.PF / 10.0; EnergyCharging = data.Report3.Epres / 10000.0; EnergyTotal = data.Report3.Etotal / 10000.0; Serial = data.Report3.Serial; Seconds = data.Report3.Sec; } Status = data?.Status ?? Uncertain; }