Files
laatzen/Common/Hardware/WaterMeter/Genesis/GenesisFile/MeterLutUpdate.cs
T

877 lines
31 KiB
C#

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using Logic.ProductionToProductMapper.Cordonel;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore.Consts;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile.Consts;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore.Consts;
using Xylem.Common.Utils.Crc16Ccitt;
using Xylem.Common.Utils.ProcessExec;
using Xylem.Common.Utils.ProcessExec.EventArguments;
namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile
{
/// <summary>
/// Meter lookup table for metrology update procedure
/// </summary>
public class MeterLutUpdate : IProcessState
{
#region Variables
/// <summary>
/// Port scan result event for message dispatcher to caller
/// </summary>
public event EventHandler<ProcessExecEventArgs> OnProcessUpdate;
//disk and name of lookup file
private const String StrLutMeterFileName = "1\\mettbl";
//disk and name of lookup file
private const String StrLutBackupMeterFileName = "1\\mettbl_b";
// identifier for Genesis lookup table
private const String StrLutFileId = "GEN_LUT\0";
private const Int32 IndexLutFileId = 0;
private const UInt32 LengthLutFileId = 8;
// data length, calculated from version field to the end of the data section
private const Int32 IndexDataLength = 8;
private const Int32 LengthDataLength = 4;
// CCITT-CRC-16 , calculated from version field to the end of the data section
private const Int32 IndexCrc = 12;
private const UInt32 LengthCrc = 2;
// version
private const Int32 IndexVersion = 14;
private const Int32 LengthVersion = 2;
// meter size as enumeration
private const Int32 IndexMeterSize = 16;
// header size of file
private const UInt32 LutFileHeaderLength =
LengthLutFileId + LengthDataLength + LengthCrc + LengthVersion;
// data size of file
private const Int32 LutFileDataLength = 730;
// LUT file entire file size
private const UInt32 SizeLutFile = LutFileHeaderLength + LutFileDataLength;
// process display message
private const String StrProcessLut = "Processing metrology lookup table";
//trigger update retries
private const Int32 RegisterWriteRetries = 0;
//update reties for files
private const Int32 FileWriteRetries = 0;
//retry of entire update procedure
private const Int32 UpdateProcedureRetries = 0;
//threshold to increase the file write timing
private const Int32 IncreaseTimeoutUpdateProcedureRetries = 4;
private Int32 _updateProcedureRetryCtr;
private GenesisMeter _genesisMeter;
private MeterFile _meterFile;
// Text for caller to inform about actual process being carried out
private String _actualOperation;
private LutUpdateState _lutUpdateState;
private LutUpdateState _lutBackupUpdateState;
// Look up table file
public MeterLutFile LutFile;
// list of names of installed meter files on drive 1
private List<String> _meterFilesDrive1;
// number of operations for over all access
private const Int32 NumberOfOperations = 11;
private Int32 _operationCtr;
// error message for display of error reason
public String ErrorMessage;
/// <summary>
/// Register subset needed to adjust for update performance content before update
/// </summary>
private readonly Dictionary<String, Byte[]> _registersBeforeUpdate = new Dictionary<String, Byte[]>();
/// <summary>
/// Register to restore after update
/// </summary>
private Dictionary<String, Byte[]> _registersAfterUpdate = new Dictionary<String, Byte[]>();
#endregion
#region Events
/// <summary>
/// Process update event
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// <remarks date="2020-Dec-10" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
public virtual void ProcessUpdate_Event(Object sender, ProcessExecEventArgs e)
{
// copy text from overall messages to actual, because this is from sub-routine
OnProcessUpdate?.Invoke(this, new ProcessExecEventArgs(StrProcessLut,
OverallProcessCtrPercent, _actualOperation, e.OverallProcessPercent));
}
#endregion
#region Information
/// <summary>
/// Process counter in percent
/// </summary>
/// <remarks date="2022-Mar-03" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
public Double OverallProcessCtrPercent => 100.0 * _operationCtr / NumberOfOperations;
/// <summary>
/// Single file process counter in percent
/// </summary>
/// <remarks date="2019-Jun-24" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
public Double SingleFileProcessCtrPercent => _meterFile?.ProcessCtrPercent ?? 0;
#endregion
#region CtorAssignment
/// <summary>
/// Ctor
/// </summary>
/// <param name="genesisMeter"></param>
/// <remarks date="2022-Feb-16" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
public MeterLutUpdate(GenesisMeter genesisMeter)
{
if (genesisMeter == null) return;
AssignGenesis(genesisMeter);
if (genesisMeter.MeterAppListVersion.Any(f => f.AppName == "GENESISFLOW" && f.IsInstalled))
{
_registersBeforeUpdate.Add(Register.Genesisflow.LedMode, new[] { (Byte)LedMode.Off });
_registersBeforeUpdate.Add(Register.Genesisflow.SampleRate, new Byte[] { 1 });
}
if (genesisMeter.MeterAppListVersion.Any(f => f.AppName == "METROLOGYASST" && f.IsInstalled))
_registersBeforeUpdate.Add(Register.Mertrologyasst.PulseMode, new Byte[] { 0 });
//deny access if NA product, because this does not have the radio app installed
if (genesisMeter.MeterAppListVersion.Any(f => f.AppName == "SENSUSRADIO" && f.IsInstalled))
_registersBeforeUpdate.Add(Register.Sensusradio.WakeupInterval, new Byte[] { 6 });
}
/// <summary>
/// Assign new genesis
/// </summary>
/// <param name="genesisMeter"></param>
/// <remarks date="2022-Feb-16" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
public void AssignGenesis(GenesisMeter genesisMeter)
{
_genesisMeter = genesisMeter;
_actualOperation = "";
_lutUpdateState = LutUpdateState.Idle;
}
/// <summary>
/// Dispose
/// </summary>
public void Dispose()
{
if (_meterFile == null) return;
_meterFile.OnProcessUpdate -= ProcessUpdate_Event;
_meterFile = null;
}
#endregion
#region ProcessInformation
/// <summary>
/// Returns the actual file in process for update
/// </summary>
/// <returns></returns>
/// <remarks date="2019-Jun-20" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
public String GetActualOperation()
{
return _actualOperation;
}
/// <summary>
/// Returns the LUT Update state
/// </summary>
/// <returns></returns>
/// <remarks date="2022-Feb-25" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
public String GetLutUpdateStateOperation()
{
// search text assigned to current state
var text = LutUpdateStateInfo.GetTextFromState(_lutUpdateState);
if (_lutUpdateState == LutUpdateState.Idle)
{
return text;
}
text += _updateProcedureRetryCtr > 0 ? $"Retry {_updateProcedureRetryCtr}" : "";
return text;
}
#endregion
#region Actions
/// <summary>
/// Try to re-establish the file system, therefor logout to close all open files
/// and login again.
/// </summary>
/// <remarks date="2019-Jun-21" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
/// <remarks date="2019-Jun-28" author="Thomas Wiedebusch">
/// - Enable auto-logon added
/// </remarks>
/// <remarks date="2019-Jul-03" author="Thomas Wiedebusch">
/// - Removed auto-logon
/// </remarks>
public void ReestablishMeterFileSystem()
{
_genesisMeter?.Logout();
_genesisMeter?.ReLogin();
}
private Boolean _stopUpdateProcess;
/// <summary>
/// Stop the update process
/// </summary>
public Boolean StopUpdateProcess
{
get => _stopUpdateProcess;
set
{
_stopUpdateProcess = value;
if (_meterFile != null)
{
_meterFile.StopProcess = value;
}
_lutUpdateState = LutUpdateState.UpdateFailed;
}
}
/// <summary>
/// Update meter lookup table
/// </summary>
/// <returns></returns>
/// <remarks date="2022-Feb-16" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
public Boolean UpdateMeterLut()
{
if (!UpdatePreparation())
{
return false;
}
_operationCtr = 0;
_actualOperation = "";
ErrorMessage = "";
_lutUpdateState = LutUpdateState.StartInitial;
_lutBackupUpdateState = LutUpdateState.Idle;
while (_lutUpdateState != LutUpdateState.Idle && !StopUpdateProcess)
{
LutUpdateStateMachine();
}
return ExitPreparation(true);
}
/// <summary>
/// Upload lookup table file and compare with the loaded from file system
/// </summary>
/// <remarks date="2019-Jun-29" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
public Boolean VerifyLutFile()
{
if (!UpdatePreparation())
{
return false;
}
return ExitPreparation(true);
}
/// <summary>
/// Reset lookup table update process and all lists and counters
/// </summary>
/// <remarks date="2022-Feb-16" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
public void ResetAll()
{
LutFile = null;
//remove the update stop action
StopUpdateProcess = false;
//reset all counters
_updateProcedureRetryCtr = 0;
//set state machine for automatic FW update
_lutUpdateState = LutUpdateState.Idle;
_lutBackupUpdateState = LutUpdateState.Idle;
_actualOperation = "";
_operationCtr = 0;
//logout/login/auto-login
ReestablishMeterFileSystem();
_genesisMeter?.Logout();
}
/// <summary>
/// Common update preparation and check
/// </summary>
/// <remarks date="2022-Feb-16" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
public Boolean UpdatePreparation()
{
_actualOperation = "Update preparation";
_lutUpdateState = LutUpdateState.Idle;
_meterFile = new MeterFile(_genesisMeter);
if (_meterFile != null) _meterFile.OnProcessUpdate += ProcessUpdate_Event;
_genesisMeter?.ReLogin();
_genesisMeter?.SetProcessState(DisplayCodes.FwUpdateActive, false);
if (_genesisMeter == null || !_genesisMeter.IsLoggedOn)
{
return false;
}
//set default timeout for file write operation
_meterFile.SetDefaultFileWriteTimeout();
//switch LED off set sample rate to 1 -> 1Hz to slow down CPU load
_registersAfterUpdate = new Dictionary<String, Byte[]>();
foreach (var item in _registersBeforeUpdate)
{
var writeBackValue = _genesisMeter.ReadRegister(item.Key);
_registersAfterUpdate.Add(item.Key, writeBackValue);
_genesisMeter.WriteRegister(item.Key, item.Value);
}
//remove the update stop action
StopUpdateProcess = false;
return true;
}
/// <summary>
/// Common exit routine
/// </summary>
/// <remarks date="2022-Feb-16" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
public Boolean ExitPreparation(Boolean returnValue)
{
if (_meterFile != null) _meterFile.OnProcessUpdate -= ProcessUpdate_Event;
_meterFile = null;
ReestablishMeterFileSystem();
foreach (var item in _registersAfterUpdate)
{
_genesisMeter.WriteRegister(item.Key, item.Value);
}
_genesisMeter?.Logout();
if (!StopUpdateProcess)
{
return returnValue;
}
_actualOperation = "";
return false;
}
#endregion
#region StateMachine
/// <summary>
/// State machine for metrology lookup table update process
/// </summary>
/// <remarks date="2022-Feb-16" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
/// <remarks date="2022-Mar-04" author="Thomas Wiedebusch">
/// - Introduced lock for repeated execution of state machine
/// </remarks>
private void LutUpdateStateMachine()
{
if (_lutBackupUpdateState == _lutUpdateState)
{
Thread.Sleep(1);
}
else
{
// remind backup state to avoid repeated execution and side effects
_lutBackupUpdateState = _lutUpdateState;
switch (_lutUpdateState)
{
case LutUpdateState.Idle:
break;
case LutUpdateState.StartInitial:
_updateProcedureRetryCtr = 0;
_lutUpdateState = LutUpdateState.PrepareLutDownload;
break;
case LutUpdateState.PrepareLutDownload:
_lutUpdateState =
PrepareLutDownload() ? LutUpdateState.EraseLutFile : LutUpdateState.StepFailed;
break;
case LutUpdateState.EraseLutFile:
_lutUpdateState = EraseLutFiles() ? LutUpdateState.DownloadLutFile : LutUpdateState.StepFailed;
break;
case LutUpdateState.DownloadLutFile:
_lutUpdateState = DownloadLutFiles() ? LutUpdateState.UploadLutFile : LutUpdateState.StepFailed;
break;
case LutUpdateState.UploadLutFile:
_lutUpdateState = UploadAndCompareLutFiles() ? LutUpdateState.Idle : LutUpdateState.StepFailed;
break;
case LutUpdateState.CompareLutFile:
break;
case LutUpdateState.StepFailed:
_lutUpdateState = _updateProcedureRetryCtr++ < UpdateProcedureRetries
? LutUpdateState.RepeatLutUpdate
: LutUpdateState.UpdateFailed;
break;
case LutUpdateState.RepeatLutUpdate:
_lutUpdateState = LutUpdateState.DownloadLutFile;
if (_updateProcedureRetryCtr >= IncreaseTimeoutUpdateProcedureRetries)
{
_meterFile?.SetExtremeFileWriteTimeout();
}
break;
case LutUpdateState.UpdateFailed:
StopUpdateProcess = true;
_lutUpdateState = LutUpdateState.Idle;
break;
case LutUpdateState.LutUpdateStateListDelimiter:
_lutUpdateState = LutUpdateState.Idle;
break;
default:
_lutUpdateState = LutUpdateState.Idle;
break;
}
}// lock for identical state
}
#endregion
#region LutFile
/// <summary>
/// Check the content of the metrology lookup table file
/// </summary>
/// <returns></returns>
/// <remarks date="2022-Feb-25" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
private Boolean ValidateLutFile()
{
// check if LUT file contains data
if (LutFile?.BinData == null || LutFile.BinData.Count < SizeLutFile)
{
ErrorMessage += "File size mismatch!";
return false;
}
LutFile.IsValid = false;
// extract the identifier and check, if this is a LUT file
LutFile.StrLutFileId =
Encoding.UTF8.GetString(LutFile.BinData.ToArray(), IndexLutFileId, IndexDataLength);
if (LutFile.StrLutFileId != StrLutFileId) return false;
LutFile.MeterSize = (MeterSize)LutFile.BinData[IndexMeterSize];
LutFile.FileCrc = (UInt16)(LutFile.BinData[IndexCrc] + (LutFile.BinData[IndexCrc + 1] << 8));
LutFile.Version = (UInt16)(LutFile.BinData[IndexVersion] + (LutFile.BinData[IndexVersion + 1] << 8));
LutFile.DataLength = (UInt32)(LutFile.BinData[IndexDataLength]
+ (LutFile.BinData[IndexDataLength + 1] << 8)
+ (LutFile.BinData[IndexDataLength + 2] << 16)
+ (LutFile.BinData[IndexDataLength + 3] << 24));
// calculate CRC and compare this with the file CRC
var entireFile = new List<Byte>();
entireFile.AddRange(LutFile.BinData);
var payload = new List<Byte>();
payload.AddRange(entireFile.GetRange(IndexVersion, LutFileDataLength + LengthVersion));
var calculatedCrc = Crc16Ccitt.CalculateMsb1021(payload.ToArray());
if (calculatedCrc != LutFile.FileCrc)
{
ErrorMessage += "CRC mismatch!";
return false;
}
LutFile.CalculatedCrc = calculatedCrc;
LutFile.IsValid = true;
return true;
}
/// <summary>
/// Download the CRC, the meter size and store calibration as preparation for the lookup table
/// </summary>
/// <returns></returns>
/// <remarks date="2022-Feb-16" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
private Boolean PrepareLutDownload()
{
var returnValue = true;
var retryCtr = 0;
if (LutFile == null || _genesisMeter == null || _meterFile == null) return false;
//set extended timeout for trigger upgrade response delay
_genesisMeter.TransmitProtocol.SetResponseTimeout(5000);
do
{
_actualOperation = "Write Lut CRC to meter";
_operationCtr++;
if (!_genesisMeter.WriteRegister<UInt32>(Register.Genesisflow.LookupFileCrc, LutFile.FileCrc))
{
ErrorMessage += "Meter LUT CRC could not be set!\n";
_operationCtr--;
returnValue = false;
}
else
{
_operationCtr++;
_actualOperation = "Write meter size";
if (!_genesisMeter.WriteRegister(Register.Genesisflow.MeterSize, new[] { (Byte)LutFile.MeterSize }))
{
ErrorMessage = "Meter size could not be set!\n";
_operationCtr--;
returnValue = false;
}
else
{
_operationCtr++;
_actualOperation = "Store calibration to meter";
if (!_genesisMeter.WriteRegister(Register.Genesisflow.StoreCalibration, 1))
{
ErrorMessage += "Meter store calibration failed!\n";
_operationCtr--;
returnValue = false;
}
}
}
if (!returnValue)
{
ReestablishMeterFileSystem();
}
} while (!returnValue && retryCtr++ < RegisterWriteRetries && !StopUpdateProcess);
//set timeout back to default value
_genesisMeter.TransmitProtocol.SetDefaultResponseTimeout();
return returnValue && !StopUpdateProcess;
}
/// <summary>
/// Read meter files of drive 1
/// </summary>
/// <returns></returns>
/// <remarks date="2022-Mar-04" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
private Boolean ReadMeterFilesDrive1()
{
// logout and re-login to clear all ongoing processes and clear the Genesis buffers
ReestablishMeterFileSystem();
if (_meterFilesDrive1 == null)
{
_meterFilesDrive1 = new List<String>();
}
_meterFilesDrive1.Clear();
if (!_meterFile.ReadMeterFileCatalog(out var meterFilesDrive1, MeterFile.StrMeterDrive1,
MeterFile.WildcardAll.ToString())) return false;
_meterFilesDrive1.AddRange(meterFilesDrive1);
return true;
}
/// <summary>
/// Erase file and check if done!
/// </summary>
/// <returns></returns>
/// <remarks date="2022-Mar-04" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
private Boolean EraseFile(String fileDriveName)
{
var returnValue = _meterFile.UnlockEraseWriteMeterFile(fileDriveName);
//erase returns always TRUE, even if the erasure failed! Check with catalogue
_meterFile.EraseMeterFile(fileDriveName);
if (ReadMeterFilesDrive1())
{
if (_meterFilesDrive1.Contains(fileDriveName))
{
returnValue = false;
}
}
else
{
returnValue = false;
}
return returnValue;
}
/// <summary>
/// Erase old LUT files from meter
/// </summary>
/// <remarks date="2022-Feb-16" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
public Boolean EraseLutFiles()
{
//counters for actual process information
var retryCtr = 0;
if (LutFile == null) return false;
//set extended timeout for trigger upgrade response delay
_genesisMeter.TransmitProtocol.SetResponseTimeout(10000);
var returnValue = true;
//erase loop and retry if not successful
do
{
var filesToErase = new[] { StrLutBackupMeterFileName, StrLutMeterFileName };
//var filesToErase = new[] { StrLutMeterFileName, StrLutBackupMeterFileName};
// read all files which are already installed
_actualOperation = "Read installed meter files drive 1";
_operationCtr++;
// read files on drive 1 to verify the LUT installation
if (ReadMeterFilesDrive1())
{
foreach (var fileToErase in filesToErase)
{
if (!_meterFilesDrive1.Contains(fileToErase)) continue;
_operationCtr++;
_actualOperation = $"Erase {fileToErase}";
if (EraseFile(fileToErase)) continue;
ErrorMessage += $"LUT file {fileToErase} not erased!\n";
returnValue = false;
_operationCtr--;
}
}
if (!returnValue)
{
ReestablishMeterFileSystem();
}
} while (!returnValue && retryCtr++ < FileWriteRetries && !StopUpdateProcess);
//set timeout back to default value
_genesisMeter.TransmitProtocol.SetDefaultResponseTimeout();
return !StopUpdateProcess && returnValue;
}
/// <summary>
/// Download the metrology lookup table files and read the catalog of drive 1
/// </summary>
/// <returns></returns>
/// <remarks date="2022-Feb-16" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
private Boolean DownloadLutFiles()
{
//counters for actual process information
var retryCtr = 0;
if (LutFile == null) return false;
//set extended timeout for trigger upgrade response delay
_genesisMeter.TransmitProtocol.SetResponseTimeout(10000);
var returnValue = true;
//write LUT files and retry if not successful
do
{
_actualOperation = "Download LUT files to meter";
var filesToDownload = new[] { StrLutMeterFileName, StrLutBackupMeterFileName };
foreach (var fileToDownload in filesToDownload)
{
_operationCtr++;
_actualOperation = $"Write {fileToDownload}";
// logout and re-login to clear all ongoing processes and clear the Genesis buffers
ReestablishMeterFileSystem();
_meterFile.UnlockEraseWriteMeterFile(fileToDownload);
if (_meterFile.WriteMeterFile(fileToDownload, LutFile.BinData.ToArray())) continue;
ErrorMessage += $"Writing of {fileToDownload} failed!\n";
returnValue = false;
_operationCtr--;
}
// read all files on drive 1
_operationCtr++;
_actualOperation = "Read installed meter files drive 1";
if (ReadMeterFilesDrive1())
{
foreach (var checkInstalledFile in filesToDownload)
{
if (_meterFilesDrive1.Contains(checkInstalledFile)) continue;
ErrorMessage += $"LUT file {StrLutMeterFileName} not installed!\n";
returnValue = false;
}
}
else
{
returnValue = false;
}
if (!returnValue)
{
ReestablishMeterFileSystem();
}
} while (!returnValue && retryCtr++ < FileWriteRetries && !StopUpdateProcess);
//set timeout back to default value
_genesisMeter.TransmitProtocol.SetDefaultResponseTimeout();
return !StopUpdateProcess && returnValue;
}
/// <summary>
/// Upload the metrology lookup table files and read the catalog of drive 1
/// </summary>
/// <returns></returns>
/// <remarks date="2022-Mar-04" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
private Boolean UploadAndCompareLutFiles()
{
//counters for actual process information
var retryCtr = 0;
if (LutFile == null) return false;
//set extended timeout for trigger upgrade response delay
_genesisMeter.TransmitProtocol.SetResponseTimeout(10000);
var returnValue = true;
//write LUT files and retry if not successful
do
{
_actualOperation = "Upload LUT files to meter";
var filesToUpload = new[] { StrLutMeterFileName, StrLutBackupMeterFileName };
foreach (var fileToUpload in filesToUpload)
{
_operationCtr++;
_actualOperation = $"Read {fileToUpload}";
// logout and re-login to clear all ongoing processes and clear the Genesis buffers
ReestablishMeterFileSystem();
if (_meterFile.ReadMeterFile(fileToUpload, out var binData, LutFile.BinData.Count))
{
// compare the entire buffer which also includes the header of the file
if (!binData.SequenceEqual(LutFile.BinData))
{
ErrorMessage += $"Meter LUT file is unequal to downloaded {fileToUpload}!\n";
returnValue = false;
_operationCtr--;
}
continue;
}
ErrorMessage += $"Reading of {fileToUpload} failed!\n";
returnValue = false;
_operationCtr--;
}
if (!returnValue)
{
ReestablishMeterFileSystem();
}
} while (!returnValue && retryCtr++ < FileWriteRetries && !StopUpdateProcess);
//set timeout back to default value
_genesisMeter.TransmitProtocol.SetDefaultResponseTimeout();
return !StopUpdateProcess && returnValue;
}
/// <summary>
/// Load file from memory
/// </summary>
/// <param name="filePathName">to binary files</param>
/// <returns></returns>
/// <remarks date="2022-Feb-15" author="Thomas Wiedebusch">
/// - Initial
/// </remarks>
public Boolean LoadLutFile(String filePathName)
{
if (!File.Exists(filePathName))
{
return false;
}
LutFile = null;
LutFile = new MeterLutFile(filePathName)
{
BinData = new List<Byte>(File.ReadAllBytes(filePathName))
};
// validate the file
return ValidateLutFile();
}
#endregion
}
}