public static Mutex s_mutex = new Mutex(); // a mutex to prevent concurrent read/write of the DMX data

        public static void Main(string[] args)
        {
            var artnet = new ArtNet.Sockets.ArtNetSocket();
            artnet.EnableBroadcast = true;

            Console.WriteLine(artnet.BroadcastAddress.ToString());
            artnet.Open(IPAddress.Parse("10.10.80.48"), IPAddress.Parse("255.255.255.0"));

            // Initialize DMX values and colours to zero
            for (int i = 0; i < MAX_SUPPORTED_UNIVERSES; i++)
            {
                for (int j = 0; j < MAX_SUPPORTED_UNIVERSES; j++)
                {
                    s_dmxValues[i, j] = 0;
                }
            }

            // Register a packet listener that will write the data to the array at the incoming frame rate
            artnet.NewPacket += artnet_NewPacket;

            if (s_writeImageSequence)
            {
                // Launch an image writer
                System.Timers.Timer timer = new System.Timers.Timer(1000 / IMAGE_SEQUENCE_FPS);
                timer.Elapsed += WriteImage;
                timer.Start();
            }

            Console.ReadLine();
        }
示例#2
0
        public static Mutex s_mutex             = new Mutex(); // a mutex to prevent concurrent read/write of the DMX data

        public static void Main(string[] args)
        {
            var artnet = new ArtNet.Sockets.ArtNetSocket();

            artnet.EnableBroadcast = true;

            Console.WriteLine(artnet.BroadcastAddress.ToString());
            artnet.Open(IPAddress.Parse("10.10.80.48"), IPAddress.Parse("255.255.255.0"));

            // Initialize DMX values and colours to zero
            for (int i = 0; i < MAX_SUPPORTED_UNIVERSES; i++)
            {
                for (int j = 0; j < MAX_SUPPORTED_UNIVERSES; j++)
                {
                    s_dmxValues[i, j] = 0;
                }
            }

            // Register a packet listener that will write the data to the array at the incoming frame rate
            artnet.NewPacket += artnet_NewPacket;

            if (s_writeImageSequence)
            {
                // Launch an image writer
                System.Timers.Timer timer = new System.Timers.Timer(1000 / IMAGE_SEQUENCE_FPS);
                timer.Elapsed += WriteImage;
                timer.Start();
            }

            Console.ReadLine();
        }
示例#3
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Starte ArtNet -> VLC Schnittstelle...");
            var artnet = new ArtNet.Sockets.ArtNetSocket();

            artnet.EnableBroadcast = true;
            Console.WriteLine("Öffne config.txt");
            try
            {
                String[] config = File.ReadAllLines("config.txt");
                localip      = config[0];
                dmxstartaddr = Convert.ToInt16(config[1]);
            }
            catch (Exception e)
            {
                Console.WriteLine("Fehler beim Öffnen der Konfigurationsdatei. Beende...");
                Console.ReadLine();
                Environment.Exit(1);
            }

            artnet.Open(IPAddress.Parse(localip), IPAddress.Parse("255.255.255.0"));
            Console.WriteLine("Höre auf IPAdresse: " + artnet.LocalIP.ToString());
            Console.WriteLine("ARTNET-Startadresse: " + dmxstartaddr.ToString());
            Console.WriteLine("Verbinde mit VLC RemoteInterface...");
            if (vlcremote.Connected == true)
            {
                Console.WriteLine("Verbunden!");
            }

            //Neues Paket? Reagieren!
            artnet.NewPacket += (object sender, ArtNet.Sockets.NewPacketEventArgs <ArtNet.Packets.ArtNetPacket> e) =>
            {
                //Feststellen ob ArtNet-Paket
                if (e.Packet.OpCode == ArtNet.Enums.ArtNetOpCodes.Dmx)
                {
                    //Enthaltene Daten in Puffer verschieben
                    var packet = e.Packet as ArtNet.Packets.ArtNetDmxPacket;
                    if (packet.DmxData != _dmxData)
                    {
                        new_dmx();
                        _dmxData = packet.DmxData;
                    }
                }
            };
            Console.WriteLine("Warte auf Befehle...");
            while (true)
            {
                Console.ReadLine();
            }
        }
示例#4
0
        public static void Main(string[] args)
        {
            var artnet = new ArtNet.Sockets.ArtNetSocket();

            artnet.EnableBroadcast = true;

            Console.WriteLine(artnet.BroadcastAddress.ToString());
            artnet.Open(IPAddress.Parse("127.0.0.1"), IPAddress.Parse("255.255.255.0"));

            byte[] _dmxData = new byte[511];

            artnet.NewPacket += (object sender, ArtNet.Sockets.NewPacketEventArgs <ArtNet.Packets.ArtNetPacket> e) =>
            {
                if (e.Packet.OpCode == ArtNet.Enums.ArtNetOpCodes.Dmx)
                {
                    var packet = e.Packet as ArtNet.Packets.ArtNetDmxPacket;
                    Console.Clear();

                    if (packet.DmxData != _dmxData)
                    {
                        Console.WriteLine("New Packet");
                        for (var i = 0; i < packet.DmxData.Length; i++)
                        {
                            if (packet.DmxData[i] != 0)
                            {
                                Console.WriteLine(i + " = " + packet.DmxData[i]);
                            }
                        }
                        ;

                        _dmxData = packet.DmxData;
                    }
                }
            };

            Console.ReadLine();
        }