laatzen/Common/Hardware/WaterMeter/Genesis/GenesisCore/IGenesisMeter.cs

298 lines
8.5 KiB
C#

using System;
using System.Collections.Generic;
using Xylem.Common.CommonCore.Consts;
using Xylem.Common.Hardware.Interfaces.Protocols.TransmitProtocol;
using Xylem.Common.Hardware.WaterMeter.Genesis.Applications;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig;
using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore.Consts;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using Xylem.Common.Hardware.WaterMeter.WaterMeterCore;
namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
{
/// <summary>
/// Interface of special GenesisMeter derived from IMeter
/// </summary>
public interface IGenesisMeter : IMeter
{
#region properties
/// <summary>
/// Represent <see cref="Register.Configexchange.PcbSerialNumber" />
/// proposed for login
/// </summary>
String PcbId
{
get;
}
/// <summary>
/// A new meter has to be checked for the reboot counter. On retries the reboot counter
/// may have increased on unsuccessfully after-reboot procedure. This would force failing
/// the 'ConnectCordonel'.
/// </summary>
Boolean CheckRebootCtr
{
get;
set;
}
/// <summary>
/// Interface information
/// </summary>
InterfaceInfo InterfaceInfo
{
get;
}
/// <summary>
/// This FW version is supported by the interface "configuration.json".
/// </summary>
Boolean InterfaceSupportsFwVersion
{
get;
}
/// <summary>
/// Transmit protocol access for underlie objects to change response timeout
/// </summary>
ITransmitProtocol TransmitProtocol { get; }
/// <summary>
/// List of all present meter applications installed in meter
/// </summary>
List<MeterApplications> MeterAppListVersion
{
get;
}
/// <summary>
/// Successfully logged on to meter
/// </summary>
Boolean IsLoggedOn
{
get;
}
/// <summary>
/// Core revision of boot code.
/// </summary>
Int32? CoreRevision
{
get;
}
/// <summary>
/// Core revision of boot code as string.
/// </summary>
String StrCoreRevision
{
get;
}
/// <summary>
/// This is the FLEXNETVERSION version which describes the entire packet.
/// </summary>
String FwVersion
{
get;
}
/// <summary>
/// This is the FLEXNETVERSION version which describes the entire packet.
/// </summary>
UInt32? InstalledFwVersion
{
get;
}
/// <summary>
/// This is the Metrology Lookup Table CRC.
/// </summary>
String LutCrc
{
get;
}
/// <summary>
/// This is the meter size.
/// </summary>
String MeterSize { get; }
/// <summary>
/// Length of the meter.
/// </summary>
String MeterLength { get; set; }
/// <summary>
/// Pressure sensor assembled to meter.
/// </summary>
Boolean PressureSensorAssembled { get; }
/// <summary>
/// Region (EMEA, NA or China).
/// </summary>
String Region
{
get;
}
/// <summary>
/// Radio frequency in MHz (433 or 868 or null).
/// </summary>
Int32? RadioFrequencyMhz
{
get;
}
/// <summary>
/// Metrology upgrade permission.
/// </summary>
Byte MetrologyUpgradePermission
{
set; get;
}
/// <summary>
/// Order number under which this meter has to be produced
/// </summary>
Int32 OrderNumber
{
set; get;
}
/// <summary>
/// Radio address
/// </summary>
Int64 RadioAddress
{
set; get;
}
/// <summary>
/// Process configuration
/// </summary>
ProcessConfig Configuration
{
get;
}
/// <summary>
/// Customer serial number for informal issues
/// </summary>
String CustomerSerialNumber
{
get; set;
}
/// <summary>
/// Unlocked the property change ability for special sequences.
/// </summary>
Boolean UnlockEssentialProperties
{
get;
}
#endregion
#region methods
/// <summary>
/// Check region and size.
/// After reading the version, all valid registers are going to be selected.
/// </summary>
void CheckRegionSizeLutCrc();
/// <summary>
/// Unlocked the property change ability for special sequences.
/// </summary>
Boolean EnablePropertyChangeAbility(Boolean unlockPropertyChange);
/// <summary>
/// Set the meter size if previously unlocked.
/// The data types are: - String like "DN50" or
/// </summary>
Boolean SetMeterSize<T>(T meterSize);
/// <summary>
/// Set the pressure sensor if previously unlocked
/// </summary>
Boolean SetPressureSensorAssembled(Boolean pressureSensorAssembled);
/// <summary>
/// Reset the empty pipe alarm
/// </summary>
void ResetAlarm(Alarm clear);
/// <summary>
/// Upload app list to database
/// </summary>
/// <param name="progressName"></param>
/// <param name="version"></param>
/// <returns></returns>
StatusReturn PushProgress(String progressName, String version);
/// <summary>
/// Clear password to force new password reading
/// </summary>
void ClearPassword();
/// <summary>
/// Executes all StoreConfiguration and StoreCalibration for each application.
/// </summary>
/// <returns>true if all configurations are stored</returns>
Boolean StoreAllConfigurations();
/// <summary>
/// Login with identical password as last time to avoid get password from database
/// </summary>
Boolean ReLogin();
/// <summary>
/// Returns meter registers
/// </summary>
/// <returns></returns>
MeterRegisters GetConfigRegistersDefinitions();
/// <summary>
/// Common routine for reboot being able to override this routine which will be called in
/// MeteResetPsu to simulate a reboot.
/// </summary>
/// <returns></returns>
StatusReturn RebootGenesis();
/// <summary>
/// Write Register, optional: wait for result and validate,
/// write register will ALWAYS log the data DON'T use for password write
/// </summary>
/// <typeparam name="T">Data type of Register</typeparam>
/// <param name="regName">Register name</param>
/// <param name="value">Value to save as byte array in raw format</param>
/// <param name="waitForResult">wait until result is ready</param>
/// <param name="checkRegister">check the content of the register by read back</param>
/// <param name="skipRetryErrorCode">skip retries on this error code return</param>
/// <returns>true on successful operation</returns>
Boolean WriteRegister<T>(String regName, T value, Boolean waitForResult = true,
Boolean checkRegister = false, UInt16 skipRetryErrorCode = CommunicationConfig.SkipRetryErrorCode);
/// <summary>
/// Read Register and return byte array
/// </summary>
/// <param name="regName">Register name</param>
/// <param name="expectedLength">expected length for response</param>
/// <param name="skipRetryErrorCode">skip retries on this error code return</param>
/// <returns>value as byte array in raw format or null</returns>
Byte[] ReadRegister(String regName, Int32? expectedLength = null,
UInt16 skipRetryErrorCode = CommunicationConfig.SkipRetryErrorCode);
/// <summary>
/// Clear all pending alarms.
/// </summary>
/// <remarks date="2025-Aug-26" author="Roland Drabesch">
/// - Initial.
/// </remarks>
void ClearAlarm();
#endregion
}
}