- Replace `Xylem.Common` namespace references with `TBF.Rig.RegisterReaders`. - Introduce `GenesisSmartReaderTest` and `FakeSerialDriver` for unit testing. - Revamp `FlowDirectionDetection` to support multiple channels. - Make constants in `StreamingDecoder` public for enhanced accessibility. - Update `AssemblyVersion` and `AssemblyFileVersion` to `3.9.3010.1`.
118 lines
4.0 KiB
C#
118 lines
4.0 KiB
C#
using System;
|
|
using TBF.Rig.RegisterReaders.GenesisRegReader.communication.Genesis.Registers.DataTypes;
|
|
using TBF.Rig.RegisterReaders.GenesisRegReader.communication.Genesis.Registers.Json;
|
|
using Xylem.Common.Hardware.WaterMeter.WaterMeterRegisters;
|
|
|
|
namespace TBF.Rig.RegisterReaders.GenesisRegReader.communication.Genesis.Registers
|
|
{
|
|
/// <summary>
|
|
/// describe a genesis register.
|
|
/// need for read and write
|
|
/// all request protocols uses RegisterDefinition
|
|
/// </summary>
|
|
public class RegisterDefinition : IRegister
|
|
{
|
|
/// <summary>
|
|
/// name of the application which uses the register
|
|
/// </summary>
|
|
public String AppName;
|
|
|
|
/// <summary>
|
|
/// address of application which is the base address for the register
|
|
/// </summary>
|
|
/// <remarks date="2025-Aug-05" author="Thomas Wiedebusch">
|
|
/// - AppAddress from Byte to UInt16 including typecast for Byte[] return. To external, it will be used as Byte
|
|
/// as before this change. But being able to parse the configuration.json with OPTICALINTERFACE using the
|
|
/// AppAddress 256, which exceeds the byte range as this isn't a real application, but will be used to identify
|
|
/// the interface (configuration.json) version.
|
|
/// </remarks>
|
|
public UInt16 AppAddress;
|
|
|
|
/// <summary>
|
|
/// address of the register in this application
|
|
/// </summary>
|
|
public Byte RegAddressInApp;
|
|
|
|
/// <summary>
|
|
/// data type of register
|
|
/// </summary>
|
|
public Type DataType;
|
|
|
|
/// <summary>
|
|
/// size of the data to support the SizeOf implementation
|
|
/// </summary>
|
|
public Int32 DataSize;
|
|
|
|
/// <summary>
|
|
/// length of one chunk during communication
|
|
/// </summary>
|
|
/// <returns>returns the expected length of the data from register</returns>
|
|
public const Int32 ChunkSize = 4;
|
|
|
|
/// <summary>
|
|
/// name of the register
|
|
/// </summary>
|
|
public String RegisterName;
|
|
|
|
/// <summary>
|
|
/// Indicated if the register is a for this meter
|
|
/// </summary>
|
|
public Boolean IsAvailable;
|
|
|
|
/// <inheritdoc />
|
|
public String GetIdent()
|
|
{
|
|
return $"{AppName}_{RegisterName}";
|
|
}
|
|
|
|
/// <summary>
|
|
/// address combined of application and register in this application
|
|
/// </summary>
|
|
/// <remarks date="2025-Aug-05" author="Thomas Wiedebusch">
|
|
/// - AppAddress from Byte to UInt16 including typecast for Byte[] return. To external, it will be used as Byte
|
|
/// as before this change. But being able to parse the configuration.json with OPTICALINTERFACE using the
|
|
/// AppAddress 256, which exceeds the byte range as this isn't a real application, but will be used to identify
|
|
/// the interface (configuration.json) version.
|
|
/// </remarks>
|
|
public Byte[] RegisterAddress
|
|
{
|
|
get { return new[] { (Byte)AppAddress, RegAddressInApp }; }
|
|
set
|
|
{
|
|
AppAddress = value[0];
|
|
RegAddressInApp = value[1];
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// describe the accessibility for different login levels
|
|
/// </summary>
|
|
public Details RegisterDetail { get; set; }
|
|
|
|
/// <summary>
|
|
/// default value
|
|
/// </summary>
|
|
public Int64? Default { get; set; }
|
|
|
|
/// <summary>
|
|
/// minimum value
|
|
/// </summary>
|
|
public Int64? Minimum { get; set; }
|
|
|
|
/// <summary>
|
|
/// maximum value
|
|
/// </summary>
|
|
public Int64? Maximum { get; set; }
|
|
|
|
/// <summary>
|
|
/// Read restore capability for firmware updates
|
|
/// </summary>
|
|
public StaticType RestoreCapability;
|
|
|
|
/// <inheritdoc />
|
|
public Int32 CompareTo(Object obj)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
} |