init
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
using System.Collections.Generic;
|
||||
using DTS.Common.Enums.DASFactory;
|
||||
using DTS.Common.Interface.DASFactory;
|
||||
|
||||
namespace DTS.DASLib.Command.SLICE.DownloadCommands
|
||||
{
|
||||
/// <summary>
|
||||
/// Retrieves parameters of Ethernet data recorder by EthernetRecorder
|
||||
/// </summary>
|
||||
public class QueryEthernetEventInfo : EventDataCommands
|
||||
{
|
||||
protected override Commands Command => Commands.QueryEthernetEventInfo;
|
||||
|
||||
private ushort _eventID = 0;
|
||||
public ushort EventID
|
||||
{
|
||||
get { return _eventID; }
|
||||
set { _eventID = value; command.SetParameter(0, _eventID); }
|
||||
}
|
||||
|
||||
private ushort _dataDownloaded = 0;
|
||||
public ushort DataDownloaded => _dataDownloaded;
|
||||
|
||||
private ulong _totalByteCount = 0UL;
|
||||
public ulong TotalByteCount => _totalByteCount;
|
||||
|
||||
private ulong _triggerByteCount = 0UL;
|
||||
public ulong TriggerByteCount => _triggerByteCount;
|
||||
|
||||
private ulong _faultByteCount;
|
||||
public ulong FaultByteCount => _faultByteCount;
|
||||
|
||||
private uint[] _DataStartTimeStamp = new uint[] { 0, 0 };
|
||||
public uint[] DataStartTimeStamp => _DataStartTimeStamp;
|
||||
public QueryEthernetEventInfo(ICommunication sock)
|
||||
: base(sock)
|
||||
{
|
||||
//Command Parameters: 4 bytes.
|
||||
//Byte[1:0] U16 Event ID.
|
||||
//Byte[3:2]: Reserved.
|
||||
command.Parameter = new byte[4];
|
||||
}
|
||||
|
||||
public QueryEthernetEventInfo(ICommunication sock, int TimeoutMillisec)
|
||||
: base(sock, TimeoutMillisec)
|
||||
{
|
||||
//Command Parameters: 4 bytes.
|
||||
//Byte[1:0] U16 Event ID.
|
||||
//Byte[3:2]: Reserved.
|
||||
command.Parameter = new byte[4];
|
||||
}
|
||||
|
||||
protected override CommandReceiveAction WholePackage()
|
||||
{
|
||||
if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError)
|
||||
{
|
||||
if (response.ParameterLength > 0)
|
||||
{
|
||||
/*
|
||||
Response: 36 bytes.
|
||||
Byte [1:0] U16 Event ID.
|
||||
Byte [3:2] U16 Data Downloaded Flag.
|
||||
Byte [11:4] U64 Total ByteCount.
|
||||
Byte [19:12] U64 Trigger ByteCount.
|
||||
Byte [27:20] U64 Fault ByteCount.
|
||||
Byte [35:28] U32[2] Data Start Timestamp. U32[0] = Second. U32[1] = Nano-Second
|
||||
*/
|
||||
response.GetParameter(0, out _eventID);
|
||||
response.GetParameter(2, out _dataDownloaded);
|
||||
response.GetParameter(4, out _totalByteCount);
|
||||
response.GetParameter(12, out _triggerByteCount);
|
||||
response.GetParameter(20, out _faultByteCount);
|
||||
response.GetParameter(28, out uint temp);
|
||||
_DataStartTimeStamp[0] = temp;
|
||||
response.GetParameter(32, out temp);
|
||||
_DataStartTimeStamp[1] = temp;
|
||||
}
|
||||
else { _eventID = 0; }
|
||||
}
|
||||
return CommandReceiveAction.StopReceiving;
|
||||
}
|
||||
public override void ResponseToString(ref List<List<string>> lines)
|
||||
{
|
||||
base.ResponseToString(ref lines);
|
||||
lines.Add(new List<string>()
|
||||
{
|
||||
$"EventId: {EventID}",
|
||||
$"DataDownloaded: {DataDownloaded}",
|
||||
$"TotalByteCount: {TotalByteCount}",
|
||||
$"TriggerByteCount: {TriggerByteCount}",
|
||||
$"FaultByteCount: {FaultByteCount}",
|
||||
$"DataStartTimeStamp: {DataStartTimeStamp[0]}, {DataStartTimeStamp[1]}"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user