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); }
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)); } }
public byte[] ToArray() { return(RootLayer.ToArray()); }
public SACNPacket(RootLayer rootLayer) { RootLayer = rootLayer; }
public SACNPacket(UInt16 universeID, String sourceName, Guid uuid, byte sequenceID, byte[] data, byte priority) { RootLayer = new RootLayer(uuid, sourceName, universeID, sequenceID, data, priority); }