Exemplo n.º 1
0
        internal static RootLayer Parse(BigEndianBinaryReader buffer)
        {
            Int16 preambleLength = buffer.ReadInt16();

            Debug.Assert(preambleLength == PREAMBLE_LENGTH);
            Int16 postambleLength = buffer.ReadInt16();

            Debug.Assert(postambleLength == POSTAMBLE_LENGTH);
            byte[] packetIdentifier = buffer.ReadBytes(12);
            Debug.Assert(packetIdentifier.SequenceEqual(PACKET_IDENTIFIER));
            UInt16 flagsAndRootLength = (UInt16)buffer.ReadInt16();
            UInt16 flags = (UInt16)(flagsAndRootLength & SACNPacket.FIRST_FOUR_BITS_MASK);

            Debug.Assert(flags == SACNPacket.FLAGS);
            UInt16 length = (UInt16)(flagsAndRootLength & SACNPacket.LAST_TWELVE_BITS_MASK);
            Int32  vector = buffer.ReadInt32();

            Debug.Assert(vector == ROOT_VECTOR);
            Guid cid = new Guid(buffer.ReadBytes(16));

            RootLayer rootLayer = new RootLayer()
            {
                UUID         = cid,
                FramingLayer = FramingLayer.Parse(buffer)
            };

            return(rootLayer);
        }
Exemplo n.º 2
0
        public static SACNPacket Parse(byte[] packet)
        {
            using (var stream = new MemoryStream(packet))
                using (var buffer = new BigEndianBinaryReader(stream))
                {
                    var rootLayer = RootLayer.Parse(buffer);

                    return(new SACNPacket(rootLayer));
                }
        }
Exemplo n.º 3
0
 public byte[] ToArray()
 {
     return(RootLayer.ToArray());
 }
Exemplo n.º 4
0
 public SACNPacket(RootLayer rootLayer)
 {
     RootLayer = rootLayer;
 }
Exemplo n.º 5
0
 public SACNPacket(UInt16 universeID, String sourceName, Guid uuid, byte sequenceID, byte[] data, byte priority)
 {
     RootLayer = new RootLayer(uuid, sourceName, universeID, sequenceID, data, priority);
 }