Example #1
0
        internal static FramingLayer Parse(BigEndianBinaryReader buffer)
        {
            UInt16 flagsAndFramingLength = (UInt16)buffer.ReadInt16();
            UInt16 flags = (UInt16)(flagsAndFramingLength & SACNPacket.FIRST_FOUR_BITS_MASK);

            Debug.Assert(flags == SACNPacket.FLAGS);
            UInt16 length = (UInt16)(flagsAndFramingLength & SACNPacket.LAST_TWELVE_BITS_MASK);

            Int32 vector2 = buffer.ReadInt32();

            Debug.Assert(vector2 == FRAMING_VECTOR);
            byte[] sourceNameBytes = buffer.ReadBytes(64);
            string sourceName      = new string(Encoding.UTF8.GetChars(sourceNameBytes)).TrimEnd('\0');
            byte   priority        = buffer.ReadByte();
            Int16  reserved        = buffer.ReadInt16();

            Debug.Assert(reserved == RESERVED);
            byte   sequenceID = buffer.ReadByte();
            byte   options    = buffer.ReadByte();
            UInt16 universeID = buffer.ReadUInt16();

            FramingLayer framingLayer = new FramingLayer()
            {
                SourceName = sourceName,
                Priority   = priority,
                SequenceID = sequenceID,
                Options    = FramingOptions.Parse(options),
                UniverseID = universeID,
                DMPLayer   = DMPLayer.Parse(buffer)
            };

            return(framingLayer);
        }
Example #2
0
 public FramingLayer(string sourceName, UInt16 universeID, byte sequenceID, byte[] data, byte priority)
 {
     SourceName = sourceName;
     UniverseID = universeID;
     SequenceID = sequenceID;
     Options    = new FramingOptions();
     DMPLayer   = new DMPLayer(data);
     Priority   = priority;
 }
        public static FramingOptions Parse(byte optionsByte)
        {
            FramingOptions options = new FramingOptions();

            if ((optionsByte & FORCE_SYNCHRONIZATION) != 0)
            {
                options.ForceSynchronization = true;
            }
            if ((optionsByte & STREAM_TERMINATED) != 0)
            {
                options.StreamTerminated = true;
            }
            if ((optionsByte & PREVIEW_DATA) != 0)
            {
                options.PreviewData = true;
            }
            return(options);
        }
Example #4
0
        public static FramingOptions Parse(byte options)
        {
            FramingOptions optionsObject = new FramingOptions(options);

            return(optionsObject);
        }