public IkusNetGetVumetersResponse(ProdysSocketProxy socket)
        {
            var responseBytes = GetResponseBytes(socket, Command.IkusNetGetVumeters, 32);

            ProgramTxLeft  = (int)ConvertHelper.DecodeUInt(responseBytes, 0);
            ProgramTxRight = (int)ConvertHelper.DecodeUInt(responseBytes, 4);
            ProgramRxLeft  = (int)ConvertHelper.DecodeUInt(responseBytes, 8);
            ProgramRxRight = (int)ConvertHelper.DecodeUInt(responseBytes, 12);
        }
        public IkusNetGetLineStatusResponse(ProdysSocketProxy socket)
        {
            var responseBytes = GetResponseBytes(socket, Command.IkusNetGetLineStatus, 268);

            Address           = responseBytes.ToNullTerminatedString(0, 256);
            LineStatus        = (IkusNetLineStatus)ConvertHelper.DecodeUInt(responseBytes, 256);
            DisconnectionCode = (IkusNetStreamingDisconnectionReason)ConvertHelper.DecodeUInt(responseBytes, 260);
            IpCallType        = (IkusNetIPCallType)ConvertHelper.DecodeUInt(responseBytes, 264);
        }
Пример #3
0
        public AcknowledgeResponse(ProdysSocketProxy socket)
        {
            var buffer = new byte[16];

            socket.Receive(buffer);

            Command         = (Command)ConvertHelper.DecodeUInt(buffer, 0);
            Length          = (int)ConvertHelper.DecodeUInt(buffer, 4);
            ReceivedCommand = (Command)ConvertHelper.DecodeUInt(buffer, 8);
            Acknowleged     = Convert.ToBoolean(ConvertHelper.DecodeUInt(buffer, 12));
        }
        protected static byte[] GetResponseBytes(ProdysSocketProxy socket, Command expectedCommand, int expectedResponseLength)
        {
            // Read fixed part of header
            var buffer = new byte[8];

            socket.Receive(buffer);
            var command = (Command)ConvertHelper.DecodeUInt(buffer, 0);
            var length  = (int)ConvertHelper.DecodeUInt(buffer, 4);

            // Read variable part of header
            var result = new byte[length];

            socket.Receive(result);

            if (command != expectedCommand || length != expectedResponseLength)
            {
                throw new Exception(string.Format(
                                        "Invalid response from codec. Command was {0} and length {1}. Expected {2} with length {3}",
                                        command, length, expectedCommand, expectedResponseLength));
            }

            return(result);
        }
        protected void ParseResponse(ProdysSocketProxy socket, Command expectedCommand)
        {
            var buffer = new byte[8];

            socket.Receive(buffer);
            var command = (Command)ConvertHelper.DecodeUInt(buffer, 0);
            var length  = (int)ConvertHelper.DecodeUInt(buffer, 4);

            // TODO: Verify that length has valid value.

            var payloadBytes = new byte[length];

            socket.Receive(payloadBytes);

            if (command != expectedCommand || length != 4)
            {
                // This is usually a sign that no GPIO exists for the requested gpio number
                Active = null;
                return;
            }

            Active = Convert.ToBoolean(ConvertHelper.DecodeUInt(payloadBytes, 0));
        }
        public IkusNetGetLoadedPresetNameResponse(ProdysSocketProxy socket)
        {
            var responseBytes = GetResponseBytes(socket, Command.IkusNetGetLoadedPresetName, 256);

            PresetName = responseBytes.ToNullTerminatedString(0, 256);
        }
        public static IkusNetGetDecoderAudioModeResponse GetResponse(ProdysSocketProxy socket)
        {
            var responseBytes = GetResponseBytes(socket, Command.IkusNetDecoderGetAudioMode, 4);

            return(new IkusNetGetDecoderAudioModeResponse(responseBytes));
        }
        public IkusNetGetInputEnabledResponse(ProdysSocketProxy socket)
        {
            var response = GetResponseBytes(socket, Command.IkusNetGetInputEnabled, 4);

            Enabled = Convert.ToBoolean(ConvertHelper.DecodeUInt(response, 0));
        }
Пример #9
0
        public IkusNetGetInputGainLevelResponse(ProdysSocketProxy socket)
        {
            var responseBytes = GetResponseBytes(socket, Command.IkusNetGetInputGainLevel, 4);

            GainLeveldB = (int)ConvertHelper.DecodeUInt(responseBytes, 0);
        }
 protected IkusNetGetGpioResponse(ProdysSocketProxy socket, Command command)
 {
     ParseResponse(socket, command);
 }
 public IkusNetGetGpoResponse(ProdysSocketProxy socket) : base(socket, Command.IkusNetGetGpo)
 {
 }
        public IkusNetGetDeviceNameResponse(ProdysSocketProxy socket)
        {
            var payload = GetResponseBytes(socket, Command.IkusNetSysGetDeviceName, 256);

            DeviceName = payload.ToNullTerminatedString(0, 256);
        }