This commit is contained in:
Roland Drabesch
2025-10-14 16:10:48 +02:00
44 changed files with 996 additions and 813 deletions
@@ -1,4 +1,6 @@
namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
using System.Text.RegularExpressions;
namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
{
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
@@ -31,7 +33,7 @@
public List<ApplicationDefinition> ConfigApplicationDefinitions { get; }
= new List<ApplicationDefinition>();
/// <summary>
/// Information collected during 'configuration.json' read
/// </summary>
@@ -40,7 +42,7 @@
/// <summary>
/// Ctor
/// </summary>
public GenesisConfigurationReader() {}
public GenesisConfigurationReader() { }
/// <summary>
/// Ctor
@@ -66,6 +68,9 @@
/// <param name="configurationJson"></param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
/// <remarks date="??" author="Stoyan Slatev">
/// - Initial.
/// </remarks>
/// <remarks date="2025-Aug-05" author="Thomas Wiedebusch">
/// - AppId 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
@@ -78,6 +83,10 @@
/// <remarks date="2025-Sep-30" author="Thomas Wiedebusch">
/// - Supported application list introduced.
/// </remarks>
/// <remarks date="2025-Oct-10" author="Thomas Wiedebusch">
/// - Data size introduced including the new 'ByteArray' type and size to get rid of new defined 'uintxx_t'
/// data types.
/// </remarks>
public void BuildRegisterList(String configurationJson)
{
IDictionary<String, AppSection> sections;
@@ -88,7 +97,7 @@
.DeserializeObject<IDictionary<String, AppSection>>(configurationJson, SerializerSettings)
?? new Dictionary<String, AppSection>();
}
catch (Exception )
catch (Exception)
{
sections = new Dictionary<String, AppSection>();
}
@@ -121,7 +130,7 @@
AppId = appId,
AppName = appName,
AppVersion = appVersion,
});
});
var section = sectionKVP.Value;
@@ -159,6 +168,7 @@
AppAddress = appId,
AppName = appName,
DataType = GetType(detail.Type),
DataSize = GetSize(detail.Type),
Default = values?.Default is Int64 d ? d : default(Int64?),
IsAvailable = false,
Maximum = values?.Maximum is Int64 max ? max : default(Int64?),
@@ -188,31 +198,107 @@
},
};
/// <summary>
/// Convert data types from interface 'configuration.json' to CLR type or array
/// </summary>
/// <param name="value"></param>
/// <returns>type</returns>
/// <exception cref="Exception"></exception>
/// <remarks date="??" author="Stoyan Slatev">
/// - Initial.
/// </remarks>
/// <remarks date="2025-Oct-10" author="Thomas Wiedebusch">
/// - Parsed all 'uintxx_t' which are not based on CLR types to byte-array
/// </remarks>
private static Type GetType(String value)
{
switch (value.ToLower())
// Catch all uintxx_t to split to standard CLR or to array
var lowStrValue = value.ToLower();
if (lowStrValue.Contains("uint") && lowStrValue.Contains("_t"))
{
switch (lowStrValue)
{
case "uint8_t": return typeof(Byte);
case "uint16_t": return typeof(UInt16);
case "uint32_t": return typeof(UInt32);
case "uint64_t": return typeof(UInt64);
default:
return typeof(ByteArray);
}
}
// Catch the signed standard CLR and some special types
switch (lowStrValue)
{
// CLR types
case "bool_t": return typeof(Boolean);
case "rpc": return typeof(Rpc);
case "string": return typeof(String);
case "uint32_t": return typeof(UInt32);
case "time_t": return typeof(TimeT);
case "status_t": return typeof(StatusT);
case "uint16_t": return typeof(UInt16);
case "uint8_t": return typeof(Byte);
case "enum8": return typeof(Enum8);
case "uint64_t": return typeof(UInt64);
case "uint96_t": return typeof(UInt96);
case "uint128_t": return typeof(UInt128);
case "int8_t": return typeof(SByte);
case "int16_t": return typeof(Int16);
case "int32_t": return typeof(Int32);
case "int64_t": return typeof(Int64);
case "int16_t": return typeof(Int16);
case "uint72_t": return typeof(UInt72);
case "uint48_t": return typeof(UInt48);
case "uint88_t": return typeof(UInt88);
case "uint672_t": return typeof(UInt672);
default: throw new Exception($"Type {value} not recognized!");
case "string": return typeof(String);
// Special types defined in FW interface file 'configuration.json'
case "rpc": return typeof(Rpc);
case "time_t": return typeof(TimeT);
case "status_t": return typeof(StatusT);
case "enum8": return typeof(Enum8);
default:
throw new Exception($"Data type {value} in unknown!");
}
}
/// <summary>
/// Build the data size
/// </summary>
/// <param name="value"></param>
/// <returns>size</returns>
/// <remarks date="2025-Oct-10" author="Thomas Wiedebusch">
/// - Initial: - parsed all 'uintxx_t' which are not based on CLR types to byte-array
/// </remarks>
private static Int32 GetSize(String value)
{
// Catch all uintxx_t to split to standard CLR or to array
var lowStrValue = value.ToLower();
if (lowStrValue.Contains("uint") && lowStrValue.Contains("_t"))
{
switch (lowStrValue)
{
case "uint8_t": return sizeof(Byte);
case "uint16_t": return sizeof(UInt16);
case "uint32_t": return sizeof(UInt32);
case "uint64_t": return sizeof(UInt64);
default:
// Extract the size from the string
var dataSizeStr = Regex.Replace(lowStrValue, "[^0-9]", string.Empty);
if (Int32.TryParse(dataSizeStr, out var dataSize))
return dataSize / 8;
throw new Exception($"Data size {lowStrValue} cannot be converted!");
}
}
// Catch the signed standard CLR and some special types
switch (lowStrValue)
{
// CLR types
case "bool_t": return sizeof(Boolean);
case "int8_t": return sizeof(SByte);
case "int16_t": return sizeof(Int16);
case "int32_t": return sizeof(Int32);
case "int64_t": return sizeof(Int64);
// Take just some value as the string length is unknown
case "string": return 6 * 4;
// Special types defined in FW interface file 'configuration.json'
// Remote procedure call is always a 4 byte value
case "rpc": return sizeof(UInt32);
// Time will be in seconds since 01. Jan 2000 00:00:00 UTC as signed Int32
case "time_t": return sizeof(Int32);
case "status_t": return sizeof(UInt32);
case "enum8": return sizeof(Byte);
default:
throw new Exception($"Data type {value} in unknown!");
}
}
}
@@ -140,6 +140,11 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
private ILogger _loggerRawData;
/// <summary>
/// Optional request to use the offline passwords
/// </summary>
public Boolean UseOfflinePasswords { set; get; }
/// <summary>
/// Process configuration
/// </summary>
@@ -191,9 +196,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
/// <inheritdoc />
public List<MeterApplications> MeterAppListVersion
public List<MeterApplications> MeterAppListVersion
{
protected set; get;
protected set; get;
} = new List<MeterApplications>();
@@ -204,7 +209,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
/// <inheritdoc />
public InterfaceInfo InterfaceInfo
public InterfaceInfo InterfaceInfo
{
get; internal set;
}
@@ -228,16 +233,16 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
/// <inheritdoc />
public String LutCrc
{
protected set; get;
}
public String LutCrc {
protected set;
get;
} = "?";
/// <inheritdoc />
public String MeterSize
{
protected set; get;
}
public String MeterSize {
protected set;
get;
} = "?";
/// <inheritdoc />
public Boolean InterfaceSupportsFwVersion
@@ -247,10 +252,10 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
/// <inheritdoc />
public String Region
{
protected set; get;
}
public String Region {
protected set;
get;
} = "?";
/// <inheritdoc />
public String MeterLength
@@ -566,7 +571,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
{
return false;
}
return true;
}
@@ -654,19 +659,29 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
Logger.Warn(ex, $"Slot:{Slot} - Register definition file update went wrong.");
}
//builds a configuration file reader from configuration.json and reads all registers definitions
//and application definitions
var registerReader = new GenesisConfigurationReader(configFilePath);
InterfaceInfo = new InterfaceInfo
try
{
SupportedFwVersions = new List<String>()
};
InterfaceInfo.SupportedFwVersions.AddRange(registerReader.InterfaceInfo.SupportedFwVersions);
InterfaceInfo.InterfaceVersion = registerReader.InterfaceInfo.InterfaceVersion;
SetConfigRegisterDefinitions(registerReader.ConfigRegistersDefinitions);
SetConfigApplicationDefinitions(registerReader.ConfigApplicationDefinitions);
//builds a configuration file reader from configuration.json and reads all registers definitions
//and application definitions
var registerReader = new GenesisConfigurationReader(configFilePath);
InterfaceInfo = new InterfaceInfo
{
SupportedFwVersions = new List<String>()
};
InterfaceInfo.SupportedFwVersions.AddRange(registerReader.InterfaceInfo.SupportedFwVersions);
InterfaceInfo.InterfaceVersion = registerReader.InterfaceInfo.InterfaceVersion;
SetConfigRegisterDefinitions(registerReader.ConfigRegistersDefinitions);
SetConfigApplicationDefinitions(registerReader.ConfigApplicationDefinitions);
}
catch (Exception ex)
{
var msg = $"\'configuration.json\' file is incompatible!\nConfig Reader reports: {ex.Message}";
Logger.Error(ex, $"Slot:{Slot} - {msg}.");
throw new Exception(msg);
}
}
event EventHandler IMeter.OnDisposeCompleted
@@ -1201,6 +1216,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// <remarks date="2023-Feb-28" author="T.Wiedebusch">
/// - Used <see cref="MeterPwdHandlerDb.GetPasswordFromDb"/>
/// </remarks>
/// <remarks date="2025-Oct-10" author="T.Wiedebusch">
/// - Optional the offline passwords will be used.
/// </remarks>
private String GetPassword()
{
// without PCB ID it is not possible to login,
@@ -1219,14 +1237,15 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
// on unknown password try to get it from DB
if (MeterPwdHandlerDb.GetPasswordFromDb(PcbId, out var password))
if (MeterPwdHandlerDb.GetPasswordFromDb(PcbId, out var password) && !UseOfflinePasswords)
{
Logger.Info($"Slot:{Slot} - Got password from GenesisPasswordService, " +
$"URL({ServiceUrls.GenesisGetPasswordServiceUrl() + PcbId})");
}
else
{
Logger.Info($"Slot:{Slot} - Cannot get password from GenesisPasswordService, " +
if (!UseOfflinePasswords)
Logger.Info($"Slot:{Slot} - Cannot get password from GenesisPasswordService, " +
$"URL({ServiceUrls.GenesisGetPasswordServiceUrl() + PcbId}))");
// try to read the password from an offline password file
var offlinePwdPathName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
@@ -1236,7 +1255,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
var listOfOfflinePasswords = JsonConvert.DeserializeObject<List<OfflinePasswordItem>>(
File.ReadAllText(offlinePwdPathName));
if (listOfOfflinePasswords != null)
if (listOfOfflinePasswords != null && listOfOfflinePasswords.Any(x => x.PcbId == PcbId ))
password = listOfOfflinePasswords.First(x => x.PcbId == PcbId).Password;
if (!string.IsNullOrEmpty(password))
@@ -1467,8 +1486,8 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
major -= majorIndicatorForB;
}
return buildShortVersion ?
$"{major:X0}{minor:X0}{builtMajor:X0}{builtMinor:X0}" :
return buildShortVersion ?
$"{major:X0}{minor:X0}{builtMajor:X0}{builtMinor:X0}" :
$"{releaseTypeId}{major:X0}.{minor:X0}.{builtMajor:X0}{builtMinor:X0}";
}
@@ -1887,8 +1906,8 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
Logger.Info($"Slot:{Slot} - Meter size: {MeterSize}");
Logger.Info($"Slot:{Slot} - Upgrade permission: {MetrologyUpgradePermission:X2}");
Logger.Info($"Slot:{Slot} - Interface (configuration.json) version: {InterfaceInfo.InterfaceVersion}");
if (InterfaceInfo.SupportedFwVersions.Any( strFwVersion => strFwVersion.Contains(strShortFwVersion)))
if (InterfaceInfo.SupportedFwVersions.Any(strFwVersion => strFwVersion.Contains(strShortFwVersion)))
{
InterfaceSupportsFwVersion = true;
Logger.Info($"Slot:{Slot} - Interface supports this FW version: {FwVersion}");
@@ -2148,7 +2167,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
return fullAlarm;
}
/// <inheritdoc/>
public void ClearAlarm()
{
@@ -2156,14 +2175,14 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
var beforeCancelAlarmBroadcastMask = RegisterConverter.ByteArrayToValue<UInt32>(ReadRegister("CUSTOMER_AlarmBroadcastMask"));
WriteRegister("CUSTOMER_AlarmEnableMask", Alarm.ALL);
WriteRegister("CUSTOMER_AlarmBroadcastMask", Alarm.ALL );
WriteRegister("CUSTOMER_AlarmBroadcastMask", Alarm.ALL);
WriteRegister(Register.Customer.TriggerAlarmCancel, Alarm.ALL);
if (GetRegistersDic().Any(a => a.Key.RegisterName == "PersistenceGroup1"))
{
// ReSharper disable once UnusedVariable used for debug
var x = ReadRegister("SENSUSRADIO_PersistenceGroup1");
WriteRegister("SENSUSRADIO_PersistenceGroup1", new Byte[] { 0x00,0xff,0x00,0xff });
var x = ReadRegister("SENSUSRADIO_PersistenceGroup1");
WriteRegister("SENSUSRADIO_PersistenceGroup1", new Byte[] { 0x00, 0xff, 0x00, 0xff });
}
if (GetRegistersDic().Any(a => a.Key.RegisterName == "PersistenceGroup2"))
@@ -2376,6 +2395,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// <remarks date="2024-May-17" author="Thomas Wiedebusch">
/// - Changed sensitive information from "*****" to SHA256.
/// </remarks>
/// <remarks date="2025-Oct-13" author="Thomas Wiedebusch">
/// - Date size directly from register object.
/// </remarks>
public virtual Byte[] ReadRegister(String regName, Int32? expectedLength = null,
UInt16 skipRetryErrorCode = CommunicationConfig.SkipRetryErrorCode)
{
@@ -2384,14 +2406,13 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
{
var regDef = ConfigRegister.GetRegisterDefinitionByName(regName);
ConfigRegister.Set(regDef, null);
//_logger.Info($"Slot:{Slot} - Read register({regDef.GetIdent()})");
var hideDataInLog = regDef.RegisterName.Contains("EncryptionKey");
// setup length based on data type
if (!expectedLength.HasValue)
{
expectedLength = RegisterConverter.SizeOf(regDef);
expectedLength = regDef.DataSize;
}
var dataLengthPreset = expectedLength.Value;
@@ -1671,6 +1671,9 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
/// <remarks date="2025-Apr-07" author="Thomas Wiedebusch">
/// - CancellationToken.
/// </remarks>
/// <remarks date="2025-Oct-13" author="Thomas Wiedebusch">
/// - Date size directly from register object.
/// </remarks>
private Boolean ReadRegistersSet(ref List<RecoveryRegisterItem> registers, CancellationToken cancellationToken)
{
if (_currentGenesis == null)
@@ -1706,7 +1709,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
try
{
var rawRegister = _currentGenesis.ReadRegister(regName, RegisterConverter.SizeOf(regDef));
var rawRegister = _currentGenesis.ReadRegister(regName, regDef.DataSize);
try
{
if (register != null && rawRegister != null)
@@ -0,0 +1,6 @@
namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers.DataTypes
{
public struct ByteArray
{
}
}
@@ -1,8 +0,0 @@
using System;
namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers.DataTypes
{
public struct UInt128
{
}
}
@@ -1,8 +0,0 @@
using System;
namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers.DataTypes
{
public struct UInt48
{
}
}
@@ -1,8 +0,0 @@
using System;
namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers.DataTypes
{
public struct UInt72
{
}
}
@@ -1,8 +0,0 @@
using System;
namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers.DataTypes
{
public struct UInt88
{
}
}
@@ -1,8 +0,0 @@
using System;
namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers.DataTypes
{
public struct UInt96
{
}
}
@@ -87,6 +87,10 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers
/// <remarks date="2024-Mar-20" author="Thomas Wiedebusch">
/// - Hash password and encryption key with SHA256.
/// </remarks>
/// <remarks date="2025-Oct-10" author="Thomas Wiedebusch">
/// - Data size introduced including the new 'ByteArray' type and size to get rid of new defined 'uintxx_t'
/// data types.
/// </remarks>
public static String GetRegisterRawText(RegisterDefinition registerDefinition, Byte[] regRawByteArray,
Boolean encryptData = false)
{
@@ -100,12 +104,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers
// reverse the list if it is not a string or the UInt48, UInt72, UInt88,UInt96 or UInt128 which
// will be used as placeholder for a string
if (registerDefinition.DataType != typeof(String) &&
registerDefinition.DataType != typeof(UInt48) &&
registerDefinition.DataType != typeof(UInt72) &&
registerDefinition.DataType != typeof(UInt88) &&
registerDefinition.DataType != typeof(UInt96) &&
registerDefinition.DataType != typeof(UInt128) &&
registerDefinition.DataType != typeof(UInt672))
registerDefinition.DataType != typeof(ByteArray))
{
tmpList.Reverse();
}
@@ -166,6 +165,10 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers
/// - Used <see cref="TimeT"/> to calculate time in UTC based on 01. Jan 2000
/// and the given offset in seconds.
/// </remarks>
/// <remarks date="2025-Oct-10" author="Thomas Wiedebusch">
/// - Data size introduced including the new 'ByteArray' type and size to get rid of new defined 'uintxx_t'
/// data types.
/// </remarks>
public static Byte[] ValueToByteArray<T>(T value)
{
var converted = new Byte[] { 0 };
@@ -239,104 +242,19 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers
return BitConverter.GetBytes(Convert.ToSByte(value));
}
else if (value is Byte[])
else if (value is Byte[] || value is ByteArray)
{
return (Byte[])Convert.ChangeType(value, typeof(Byte[]));
}
else
{
throw new ApplicationException($"Data type {typeof(T)} not implemented");
throw new ApplicationException($"Data type {typeof(T)} is unknown!");
}
return converted;
}
/// <summary>
/// Get size of type
/// </summary>
/// <param name="registerDefinition"></param>
/// <returns>size in bytes</returns>
/// <remarks date="2023-Sep-05" author="Thomas Wiedebusch">
/// - Init.
/// </remarks>
public static Int32 SizeOf(RegisterDefinition registerDefinition)
{
var size = 4;
if (registerDefinition.DataType == typeof(Boolean))
{
size = sizeof(Boolean);
}
if (registerDefinition.DataType == typeof(Byte) ||
registerDefinition.DataType == typeof(SByte) ||
registerDefinition.DataType == typeof(Char) ||
registerDefinition.DataType == typeof(Enum8))
{
size = sizeof(Byte);
}
else if (registerDefinition.DataType == typeof(Int16) ||
registerDefinition.DataType == typeof(UInt16))
{
size = sizeof(Int16);
}
else if (registerDefinition.DataType == typeof(Int32) ||
registerDefinition.DataType == typeof(UInt32) ||
registerDefinition.DataType == typeof(TimeT))
{
size = sizeof(Int32);
}
else if (registerDefinition.DataType == typeof(Int64) ||
registerDefinition.DataType == typeof(UInt64))
{
size = sizeof(Int64);
}
else if (registerDefinition.DataType == typeof(UInt48))
{
// 48 Bits / 8 Bits/Byte
size = 6;
}
else if (registerDefinition.DataType == typeof(UInt72))
{
// 72 Bits / 8 Bits/Byte
size = 9;
}
else if (registerDefinition.DataType == typeof(UInt88))
{
// 88 Bits / 8 Bits/Byte
size = 11;
}
else if (registerDefinition.DataType == typeof(UInt96))
{
// 96 Bits / 8 Bits/Byte
size = 3 * 4;
}
else if (registerDefinition.DataType == typeof(UInt128))
{
// 128 Bits / 8 Bits/Byte
size = 4 * 4;
}
else if (registerDefinition.DataType == typeof(UInt672))
{
// 672 Bits / 8 Bits/Byte
size = 56;
}
else if (registerDefinition.DataType == typeof(String))
{
// just some value
size = 6 * 4;
}
return size;
}
/// <summary>
/// Build the result of the array as text.
/// </summary>
@@ -350,6 +268,10 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers
/// - Used <see cref="TimeT"/> to calculate time in UTC based on 01. Jan 2000
/// and the given offset in seconds.
/// </remarks>
/// <remarks date="2025-Oct-10" author="Thomas Wiedebusch">
/// - Data size introduced including the new 'ByteArray' type and size to get rid of new defined 'uintxx_t'
/// data types.
/// </remarks>
public static String ConvertToText(Byte[] rawByteArray, Type type)
{
try
@@ -392,27 +314,7 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers
{
return ByteArrayToValue<Byte>(rawByteArray).ToString();
}
if (type == typeof(UInt48))
{
return "";
}
if (type == typeof(UInt72))
{
return "";
}
if (type == typeof(UInt88))
{
return "";
}
if (type == typeof(UInt672))
{
return "";
}
if (type == typeof(UInt96))
{
return "";
}
if (type == typeof(UInt128))
if (type == typeof(ByteArray) || type == typeof(Byte[]))
{
return "";
}
@@ -451,6 +353,10 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers
/// <remarks date="2025-Jun-16" author="Thomas Wiedebusch/Roland Drabesch">
/// - Padding bytes if input doesn't fit the required size;
/// </remarks>
/// <remarks date="2025-Oct-10" author="Thomas Wiedebusch">
/// - Data size introduced including the new 'ByteArray' type and size to get rid of new defined 'uintxx_t'
/// data types.
/// </remarks>
public static T ByteArrayToValue<T>(Byte[] rawByteArray)
{
if (rawByteArray == null)
@@ -461,33 +367,6 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers
Object convertedObj = null;
var type = typeof(T);
// For non-numerical or single byte values use the standard implementation
if (type == typeof(UInt48))
{
return default(T);
}
if (type == typeof(UInt72))
{
return default(T);
}
if (type == typeof(UInt88))
{
return default(T);
}
if (type == typeof(UInt96))
{
return default(T);
}
if (type == typeof(UInt128))
{
return default(T);
}
if (type == typeof(UInt672))
{
return default(T);
}
if (type == typeof(Byte) || type == typeof(Enum8))
{
convertedObj = rawByteArray[0];
@@ -37,6 +37,11 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Registers
/// 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
@@ -134,12 +134,7 @@
<Compile Include="DataTypes\st_radio_dewa.cs" />
<Compile Include="DataTypes\st_radio_tfx.cs" />
<Compile Include="DataTypes\TimeT.cs" />
<Compile Include="DataTypes\UInt672.cs" />
<Compile Include="DataTypes\UInt48.cs" />
<Compile Include="DataTypes\UInt72.cs" />
<Compile Include="DataTypes\UInt128.cs" />
<Compile Include="DataTypes\UInt88.cs" />
<Compile Include="DataTypes\UInt96.cs" />
<Compile Include="DataTypes\ByteArray.cs" />
<Compile Include="Json\AppsDictionary.cs" />
<Compile Include="Json\AppSection.cs" />
<Compile Include="Json\Build.cs" />