122 lines
3.4 KiB
C#
122 lines
3.4 KiB
C#
using System;
|
|
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers.DataTypes;
|
|
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers.RegisterProperties;
|
|
using Xylem.Common.Hardware.WaterMeter.WaterMeterRegisters;
|
|
|
|
namespace Xylem.Common.Hardware.WaterMeter.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>
|
|
public Byte AppAddress;
|
|
|
|
/// <summary>
|
|
/// address of the register in this application
|
|
/// </summary>
|
|
public Byte RegAddressInApp;
|
|
|
|
/// <summary>
|
|
/// data type of register
|
|
/// </summary>
|
|
public Type DataType;
|
|
|
|
/// <summary>
|
|
/// length of one chunk during communication
|
|
/// </summary>
|
|
/// <returns>returns the expected length of the data from register</returns>
|
|
public static 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>
|
|
public Byte[] RegisterAddress
|
|
{
|
|
get { return new[] { AppAddress, RegAddressInApp }; }
|
|
set
|
|
{
|
|
AppAddress = value[0];
|
|
RegAddressInApp = value[1];
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// describe the accessibility for different login levels
|
|
/// </summary>
|
|
public RegisterDetail 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();
|
|
}
|
|
|
|
///// <inheritdoc />
|
|
//public override Boolean Equals(Object obj)
|
|
//{
|
|
// return obj is RegisterDefinition fooItem && GetHashCode() == fooItem.GetHashCode();
|
|
//}
|
|
|
|
///// <inheritdoc />
|
|
//public override Int32 GetHashCode()
|
|
//{
|
|
// var hashCode = base.GetHashCode();
|
|
// if (RegisterDetail == null) return hashCode;
|
|
// hashCode ^= RegisterDetail.GetHashCode();
|
|
// if (RegisterDetail.Version != null)
|
|
// {
|
|
// hashCode ^= RegisterDetail.Version.GetHashCode();
|
|
// }
|
|
|
|
// return hashCode;
|
|
//}
|
|
}
|
|
} |