change UI1236 Comamds

This commit is contained in:
Roland Drabesch
2022-08-24 17:23:11 +02:00
parent c5dbb895d2
commit 94e7a04d7b
12 changed files with 121 additions and 9 deletions
@@ -1878,6 +1878,16 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
}
}
public byte[] SendUI1236Command(byte[] UI1236Frame,bool waitForResult = true,bool checkRegister = false,ushort skipRetryErrorCode = 4)
{
this._logger.Info(string.Format("Slot:{0} - Sending Ui-1236 frame: {1} ", (object)this.Slot, (object)UI1236Frame));
RequestRecord sendFifoUi1236 = this.RequestProtocol.AddRecordToSendFifoUI1236(UI1236Frame);
this.RequestProtocolProcess();
return sendFifoUi1236.ResponsePayload.ToArray();
}
#endregion
#region Class handling
@@ -11,6 +11,8 @@ using Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig;
using Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.ProtocolCore;
using Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.RequestProtocol.Consts;
using Xylem.Common.Hardware.WaterMeter.Genesis.Registers;
using Xylem.Common.Hardware.Interfaces.Protocols.TransmitProtocol;
using Xylem.Common.Hardware.Interfaces.Ports.PortCore;
namespace Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.RequestProtocol
{
@@ -305,6 +307,27 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.Protocols.RequestProtocol
return recordForSendFifo;
}
public RequestRecord AddRecordToSendFifoUI1236(
byte[] payload,
RegisterDefinition register = null,
bool hideDataInLog = false,
ushort skipRetryErrorCode = 4)
{
byte maxValue = byte.MaxValue;
List<byte> requestProtocolData = new List<byte>()
{
maxValue
};
requestProtocolData.AddRange((IEnumerable<byte>)payload);
ITransmitProtocol transmitProtocol = this.GetTransmitProtocol();
List<byte> encodedRequestData = transmitProtocol.DecodeDataForPhysicalLayerUI1236(payload);
TransmitPortSettings transmitPortSettings = transmitProtocol.GetTransmitPortSettings();
RequestRecord sendFifoUi1236 = new RequestRecord(maxValue, requestProtocolData, encodedRequestData, transmitPortSettings.ResponseTimeoutMs, register, hideDataInLog, skipRetryErrorCode);
this._recordsSendFifo.Enqueue(sendFifoUi1236);
return sendFifoUi1236;
}
/// <summary>
/// Called after successful response.
/// Decode and check record, handle Errors and dispatch result.
@@ -1 +1 @@
5ed75d99ee45ff67821090f1b3dbb001dd9e4fe3
46bd00889699f5a20a4981a22f62b66368323855