Verification of LUT files, upload and verify binary content
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile.Properties;
|
||||
|
||||
namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile.Consts
|
||||
{
|
||||
/// <summary>
|
||||
/// Concatenation of state and string
|
||||
/// </summary>
|
||||
public static class LutUpdateStateInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// Build state information
|
||||
/// </summary>
|
||||
private static readonly LutUpdateStateText[] StateInfos;
|
||||
|
||||
/// <summary>
|
||||
/// Ctor
|
||||
/// </summary>
|
||||
static LutUpdateStateInfo()
|
||||
{
|
||||
StateInfos = new LutUpdateStateText[(Int32)LutUpdateState.LutUpdateStateListDelimiter];
|
||||
StateInfos[0].State = LutUpdateState.Idle;
|
||||
StateInfos[0].Message = "";
|
||||
|
||||
StateInfos[1].State = LutUpdateState.StepFailed;
|
||||
StateInfos[1].Message = "Processing Step Failed";
|
||||
|
||||
StateInfos[2].State = LutUpdateState.UpdateFailed;
|
||||
StateInfos[2].Message = "LUT Update Failed";
|
||||
|
||||
StateInfos[3].State = LutUpdateState.StartInitial;
|
||||
StateInfos[3].Message = "Initial start";
|
||||
|
||||
StateInfos[4].State = LutUpdateState.RepeatLutUpdate;
|
||||
StateInfos[4].Message = "Repeat update";
|
||||
|
||||
StateInfos[5].State = LutUpdateState.UploadLutFile;
|
||||
StateInfos[5].Message = "Upload LUT file from meter";
|
||||
|
||||
StateInfos[6].State = LutUpdateState.DownloadLutFile;
|
||||
StateInfos[6].Message = "Download LUT file to meter";
|
||||
|
||||
StateInfos[7].State = LutUpdateState.CompareLutFile;
|
||||
StateInfos[7].Message = "Compare LUT file";
|
||||
|
||||
StateInfos[8].State = LutUpdateState.PrepareLutDownload;
|
||||
StateInfos[8].Message = "Init meter size and LUT file CRC";
|
||||
|
||||
StateInfos[9].State = LutUpdateState.EraseLutFile;
|
||||
StateInfos[9].Message = "Erase LUT file in meter";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the current information
|
||||
/// </summary>
|
||||
/// <param name="state">state to search for information text</param>
|
||||
public static String GetTextFromState(LutUpdateState state)
|
||||
{
|
||||
return (from stateInfo in StateInfos
|
||||
where stateInfo.State == state select stateInfo.Message).FirstOrDefault();
|
||||
}
|
||||
/// <summary>
|
||||
/// Get the state of the text
|
||||
/// </summary>
|
||||
/// <param name="text">information text to search if state is assigned</param>
|
||||
public static LutUpdateState GetStateFromText(String text)
|
||||
{
|
||||
return (from stateInfo in StateInfos
|
||||
where stateInfo.Message == text select stateInfo.State).FirstOrDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisFile.Consts
|
||||
{
|
||||
/// <summary>
|
||||
/// Concatenation between lokup table update state and text
|
||||
/// </summary>
|
||||
public struct LutUpdateStateText
|
||||
{
|
||||
/// <summary>
|
||||
/// The state of the firmware update
|
||||
/// </summary>
|
||||
public LutUpdateState State;
|
||||
/// <summary>
|
||||
/// The message text of the lookup table update state
|
||||
/// </summary>
|
||||
public String Message;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user