Exemple #1
0
        /// <summary>
        /// Processes the packet that have been recieved and allocated to this filter.
        /// </summary>
        /// <param name="source">The source IP address of the packet.</param>
        /// <param name="header">The header information for the ACN packet.</param>
        /// <param name="data">The data reader for the remaining packet data.</param>
        /// <remarks>
        /// Only packets that have supported protocol ID's will be sent to this function.
        /// </remarks>
        void IProtocolFilter.ProcessPacket(IPEndPoint source, AcnRootLayer header, AcnBinaryReader data)
        {
            RdmNetPacket newPacket = AcnPacket.ReadPacket(header, data) as RdmNetPacket;

            if (newPacket != null)
            {
                RdmBinaryReader dmxReader = new RdmBinaryReader(new MemoryStream(newPacket.RdmNet.RdmData));

                //Skip Start Code and sub-start code
                dmxReader.BaseStream.Seek(1, SeekOrigin.Begin);

                RdmPacket rdmPacket = RdmPacket.ReadPacket(dmxReader);
                RaiseNewRdmPacket(new RdmEndPoint(source, newPacket.Framing.EndpointID), rdmPacket);
            }
        }
Exemple #2
0
        private void ProcessPacket(IPEndPoint source, ArtNetPacket packet)
        {
            if (packet != null)
            {
                if (NewPacket != null)
                {
                    NewPacket(this, new NewPacketEventArgs <ArtNetPacket>(source, packet));
                }

                ArtRdmPacket rdmPacket = packet as ArtRdmPacket;
                if (rdmPacket != null && NewRdmPacket != null)
                {
                    RdmPacket rdm = RdmPacket.ReadPacket(new RdmBinaryReader(new MemoryStream(rdmPacket.RdmData)));
                    NewRdmPacket(this, new NewPacketEventArgs <RdmPacket>(source, rdm));
                }
            }
        }