73 lines
2.6 KiB
C#
73 lines
2.6 KiB
C#
using System;
|
|
using System.Linq;
|
|
|
|
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.FinalizeLutDownload;
|
|
StateInfos[8].Message = "Finalize LUT file installation";
|
|
|
|
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();
|
|
}
|
|
}
|
|
}
|