internal static RootLayer Parse(BigEndianBinaryReader buffer) { RootLayer rootLayer = new RootLayer(); 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.UUID = cid; rootLayer.FramingLayer = FramingLayer.Parse(buffer); return(rootLayer); }
public static SACNPacket Parse(byte[] packet) { MemoryStream stream = new MemoryStream(packet); BigEndianBinaryReader buffer = new BigEndianBinaryReader(stream); RootLayer rootLayer = RootLayer.Parse(buffer); return(new SACNPacket(rootLayer)); }
public byte[] ToArray() { return(RootLayer.ToArray()); }
public SACNPacket(RootLayer rootLayer) { RootLayer = rootLayer; }
public SACNPacket(Int16 universeID, String sourceName, Guid uuid, byte sequenceID, byte[] data) { RootLayer = new RootLayer(uuid, sourceName, universeID, sequenceID, data); }