Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 public static RdmPacket Create(RdmHeader header)
 {
     return(RdmPacketFactory.Build(header));
 }
Ejemplo n.º 5
0
 public RdmPacket(RdmCommands command, RdmParameters parameterId)
 {
     Header             = new RdmHeader();
     Header.Command     = command;
     Header.ParameterId = parameterId;
 }
Ejemplo n.º 6
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;
 }
Ejemplo n.º 7
0
 public static bool IsResponse(RdmHeader header)
 {
     return(header.Command == RdmCommands.GetResponse || header.Command != RdmCommands.SetResponse);
 }