Create() public static method

public static Create ( long millisecond, long sequence, int universe, byte data ) : RawDmxData
millisecond long
sequence long
universe int
data byte
return RawDmxData
示例#1
0
        private void Socket_NewPacket(object sender, NewPacketEventArgs <ArtNetPacket> e)
        {
            if (e.Packet.OpCode == ArtNetOpCodes.Dmx)
            {
                if (this.timestamper == null)
                {
                    this.timestamper = Stopwatch.StartNew();
                }

                var packet = e.Packet as ArtNetDmxPacket;

                UniverseData universeData;
                if (!this.universes.TryGetValue(packet.Universe, out universeData))
                {
                    // Unknown universe
                    return;
                }

                var dmxData = RawDmxData.Create(
                    millisecond: (ulong)this.timestamper.ElapsedMilliseconds,
                    sequence: packet.Sequence,
                    universe: packet.Universe,
                    data: packet.DmxData);

                this.writer.AddData(dmxData);
            }
        }
示例#2
0
        private void AcnSocket_NewPacket(object sender, Acn.Sockets.NewPacketEventArgs <Acn.Packets.sAcn.StreamingAcnDmxPacket> e)
        {
            if (this.masterClock == null)
            {
                this.masterClock = Stopwatch.StartNew();
            }
            ulong timestamp = (ulong)this.masterClock.ElapsedMilliseconds;

            var propData = e.Packet.Dmx.PropertyData;

            if (propData.Length < 1)
            {
                // Unknown/unsupported
                return;
            }

            if (propData[0] != 0)
            {
                // We only support start code 0
                return;
            }

            var newDmxData = e.Packet.Dmx.PropertyData;

            UniverseData universeData;

            if (!this.universes.TryGetValue(e.Packet.Framing.Universe, out universeData))
            {
                // Unknown universe
                return;
            }

            long sequence = e.Packet.Framing.SequenceNumber + universeData.SequenceHigh;

            if (e.Packet.Framing.SequenceNumber < universeData.LastSequenceLow)
            {
                // Wrap
                universeData.SequenceHigh += 256;
                sequence += 256;
            }
            universeData.LastSequenceLow = e.Packet.Framing.SequenceNumber;

            var dmxData = RawDmxData.Create(
                millisecond: timestamp,
                sequence: sequence,
                universe: e.Packet.Framing.Universe,
                data: newDmxData.Skip(1).ToArray());

            this.writer.AddData(dmxData);
        }