public static RdmPacket BuildErrorResponse(RdmHeader header)
        {
            if (header.PortOrResponseType != 0)
            {
                switch ((RdmResponseTypes)header.PortOrResponseType)
                {
                case RdmResponseTypes.AckTimer:
                    return(RdmPacket.Create(header, typeof(RdmAckTimer)));

                case RdmResponseTypes.NackReason:
                    return(RdmPacket.Create(header, typeof(RdmNack)));
                }
            }

            return(null);
        }
        public static bool IsErrorResponse(RdmHeader header)
        {
            if (!IsResponse(header))
            {
                return(false);
            }

            switch ((RdmResponseTypes)header.PortOrResponseType)
            {
            case RdmResponseTypes.Ack:
            case RdmResponseTypes.AckOverflow:
                return(false);
            }

            return(true);
        }
        public static RdmPacket Build(RdmHeader header)
        {
            if (IsErrorResponse(header))
            {
                //Error Response Packets
                return(BuildErrorResponse(header));
            }
            else
            {
                Type packetType;
                if (packetStore.TryGetValue(new PacketKey(header.Command, header.ParameterId), out packetType))
                {
                    return(RdmPacket.Create(header, packetType));
                }
            }

            return(null);
        }
Example #4
0
 public UnknownRdmPacketException(RdmHeader header)
     : base(string.Format("An RDM packet with the PID 0x{0:0000} is not recognised.", ((int)header.ParameterId).ToString("X")))
 {
     Header = header;
 }
 public static bool IsResponse(RdmHeader header)
 {
     return(header.Command == RdmCommands.GetResponse || header.Command != RdmCommands.SetResponse);
 }
Example #6
0
 public static RdmPacket Create(RdmHeader header)
 {
     return(RdmPacketFactory.Build(header));
 }
Example #7
0
 public RdmPacket(RdmCommands command, RdmParameters parameterId)
 {
     Header             = new RdmHeader();
     Header.Command     = command;
     Header.ParameterId = parameterId;
 }