using System; using System.Collections.Generic; using DTS.Common.Enums.DASFactory; namespace DTS.DASLib.Command.SLICE.RealtimeCommands { /// /// these classes was ported from FWTU /// public class StreamConfigUDPGet : RealtimeCommandBase { private const int COMMAND_PAYLOAD_SIZE = 65; protected override Commands _Command => Commands.I106StreamConfigGet; private byte _stream_profile_number; private byte[] _udpipport; private ushort _timechannelid; private ushort _datachannelid; private uint _tmnsPcmSubFrameId; // _tmns0; private uint _tmnsMsgId; // _tmns1; private uint _tmnsPcmMinorPerMajor; // _tmns2; private uint _tmnsTmatsPortNumber; // _tmns3; private uint _ienaUdpSrcPortNumber; // _tmns4; private uint _udpRsv1; // _tmns5; private uint _udpRsv2; // _tmns6; private uint _udpRsv3; // _tmns7; public byte Stream_Profile_Number { get => _stream_profile_number; set { _stream_profile_number = value; command.SetParameter(0, _stream_profile_number); } } public byte[] UdpIpPort { get { return _udpipport; } set { _udpipport = value; command.SetParameter(1, _udpipport); } } public ushort TimeChannelID { get => _timechannelid; set { _timechannelid = value; command.SetParameter(29, _timechannelid); } } public ushort DataChannelID { get => _datachannelid; set { _datachannelid = value; command.SetParameter(31, _datachannelid); } } public uint TMNS_PCMSUBFRAMEID { get => _tmnsPcmSubFrameId; set { _tmnsPcmSubFrameId = value; command.SetParameter(33, _tmnsPcmSubFrameId); } } public uint TMNS_MSGID { get { return _tmnsMsgId; } set { _tmnsMsgId = value; command.SetParameter(37, _tmnsMsgId); } } public uint TMNS_PCMINORPERMAJOR { get => _tmnsPcmMinorPerMajor; set { _tmnsPcmMinorPerMajor = value; command.SetParameter(41, _tmnsPcmMinorPerMajor); } } public uint TMNS_TMATSPORTNUMBER { get => _tmnsTmatsPortNumber; set { _tmnsTmatsPortNumber = value; command.SetParameter(45, _tmnsTmatsPortNumber); } } public uint IENAUDP_PortNumber { get => _ienaUdpSrcPortNumber; set { _ienaUdpSrcPortNumber = value; command.SetParameter(49, _ienaUdpSrcPortNumber); } } public uint TMNS5 { get => _udpRsv1; set { _udpRsv1 = value; command.SetParameter(53, _udpRsv1); } } public uint TMNS6 { get => _udpRsv2; set { _udpRsv2 = value; command.SetParameter(57, _udpRsv2); } } public uint TMNS7 { get => _udpRsv3; set { _udpRsv3 = value; command.SetParameter(61, _udpRsv3); } } public StreamConfigUDPGet(Common.Interface.DASFactory.ICommunication sock) : base(sock) { command.Parameter = new byte[COMMAND_PAYLOAD_SIZE]; } public StreamConfigUDPGet(Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { command.Parameter = new byte[COMMAND_PAYLOAD_SIZE]; } protected override CommandReceiveAction WholePackage() { if (response.Status == DFConstantsAndEnums.CommandStatus.StatusNoError) { if (response.ParameterLength > 0) { response.GetParameter(0, out _stream_profile_number); _udpipport = new byte[29]; for (int i = 0; i < 28; i++) { response.GetParameter(1 + i, out _udpipport[i]); } response.GetParameter(29, out _timechannelid); response.GetParameter(31, out _datachannelid); response.GetParameter(33, out _tmnsPcmSubFrameId); response.GetParameter(37, out _tmnsMsgId); response.GetParameter(41, out _tmnsPcmMinorPerMajor); response.GetParameter(45, out _tmnsTmatsPortNumber); response.GetParameter(49, out _ienaUdpSrcPortNumber); response.GetParameter(53, out _udpRsv1); response.GetParameter(57, out _udpRsv2); response.GetParameter(61, out _udpRsv3); } else { _stream_profile_number = 0; } } return CommandReceiveAction.StopReceiving; } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { $"Stream Profile Number: {_stream_profile_number}" }); lines.Add(new List() { $"UDP IP PORT: {_udpipport}" }); lines.Add(new List() { $"Time Channel ID: {_timechannelid}" }); lines.Add(new List() { $"Data Channel ID: {_timechannelid}" }); lines.Add(new List() { $"TMNS: {_tmnsPcmSubFrameId}, {_tmnsMsgId}, {_tmnsPcmMinorPerMajor}, {_tmnsTmatsPortNumber}, {_ienaUdpSrcPortNumber}, {_udpRsv1}, {_udpRsv2}, {_udpRsv3}," }); } } public class StreamConfigUDPSet : RealtimeCommandBase { const int COMMAND_PAYLOAD_SIZE = 74; protected override RealtimeCommandBase.Commands _Command { get { return Commands.I106StreamConfigSet; } } private byte _stream_profile_number; private byte[] _udpipport; private ushort _irig106config0; private ushort _irig106config1; private uint _tmnsPcmSubFrameId; // _tmns0; private uint _tmnsMsgId; // _tmns1; private uint _tmnsPcmMinorPerMajor; // _tmns2; private uint _tmnsTmatsPortNumber; // _tmns3; private uint _ienaUdpSrcPortNumber; // _tmns4; private uint _udpRsv1; // _tmns5; private uint _udpRsv2; // _tmns6; private uint _udpRsv3; // _tmns7; public byte Stream_Profile_Number { get => _stream_profile_number; set { _stream_profile_number = value; command.SetParameter(0, _stream_profile_number); } } public byte[] UdpIpPort { get => _udpipport; set { _udpipport = value; command.SetParameter(1, _udpipport); } } public ushort Irig106Config0 { get => _irig106config0; set { _irig106config0 = value; command.SetParameter(29, _irig106config0); } } public ushort Irig106Config1 { get => _irig106config1; set { _irig106config1 = value; command.SetParameter(31, _irig106config1); } } public uint TMNS_PCMSubFrameId { get => _tmnsPcmSubFrameId; set { _tmnsPcmSubFrameId = value; command.SetParameter(33, _tmnsPcmSubFrameId); } } public uint TMNS_MsgId { get => _tmnsMsgId; set { _tmnsMsgId = value; command.SetParameter(37, _tmnsMsgId); } } public uint TMNS_PCMMinorPerMajor { get => _tmnsPcmMinorPerMajor; set { _tmnsPcmMinorPerMajor = value; command.SetParameter(41, _tmnsPcmMinorPerMajor); } } public uint TMNS_TMATSPortNumber { get => _tmnsTmatsPortNumber; set { _tmnsTmatsPortNumber = value; command.SetParameter(45, _tmnsTmatsPortNumber); } } public uint IENAUDP_PortNumber { get => _ienaUdpSrcPortNumber; set { _ienaUdpSrcPortNumber = value; command.SetParameter(49, _ienaUdpSrcPortNumber); } } public uint TMNS5 { get => _udpRsv1; set { _udpRsv1 = value; command.SetParameter(53, _udpRsv1); } } public uint TMNS6 { get => _udpRsv2; set { _udpRsv2 = value; command.SetParameter(57, _udpRsv2); } } public uint TMNS7 { get { return _udpRsv3; } set { _udpRsv3 = value; command.SetParameter(61, _udpRsv3); } } public StreamConfigUDPSet(Common.Interface.DASFactory.ICommunication sock) : base(sock) { command.Parameter = new byte[COMMAND_PAYLOAD_SIZE]; } public StreamConfigUDPSet(Common.Interface.DASFactory.ICommunication sock, int TimeoutMillisec) : base(sock, TimeoutMillisec) { command.Parameter = new byte[COMMAND_PAYLOAD_SIZE]; } public override void ResponseToString(ref List> lines) { base.ResponseToString(ref lines); lines.Add(new List() { $"Stream Profile Number: {_stream_profile_number}" }); lines.Add(new List() { $"UDP IP PORT: {_udpipport}" }); lines.Add(new List() { $"Irig Config: {_irig106config0}" }); lines.Add(new List() { $"TMNS: {_tmnsPcmSubFrameId}, {_tmnsMsgId}, {_tmnsPcmMinorPerMajor}, {_tmnsTmatsPortNumber}, {_ienaUdpSrcPortNumber}, {_udpRsv1}, {_udpRsv2}, {_udpRsv3}," }); } } }