Esempio n. 1
0
        /// <summary>
        /// Start the E.131 Lisener.
        /// </summary>
        private void Start(IPAddress networkCard, int startUniverse, int endUniverse)
        {
            _socket            = new StreamingAcnSocket(Guid.NewGuid(), "Streaming ACN Snoop");
            _socket.NewPacket += new EventHandler <NewPacketEventArgs <Acn.Packets.sAcn.StreamingAcnDmxPacket> >(socket_NewPacket);
            _socket.Open(networkCard);

            for (int universe = startUniverse; universe <= endUniverse; universe++)
            {
                _socket.JoinDmxUniverse(universe);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Initialises the specified universes.
 /// </summary>
 /// <param name="universes">The universes.</param>
 /// <param name="ip">The ip.</param>
 protected virtual void Initialise(IEnumerable <int> universes, IPAddress ip)
 {
     acnSocket            = new StreamingAcnSocket(Guid.NewGuid(), "Unit test");
     acnSocket.NewPacket += (o, e) =>
     {
         lock (senders)
         {
             senders.Add(e.Packet.Root.SenderId);
             dmxValues[new Tuple <Guid, int>(e.Packet.Root.SenderId, e.Packet.Framing.Universe)] = e.Packet.Dmx.Data;
         }
     };
     acnSocket.Open(ip);
     foreach (int universe in universes)
     {
         acnSocket.JoinDmxUniverse(universe);
     }
 }
Esempio n. 3
0
        private void Start(CardInfo networkCard, IEnumerable <int> universes)
        {
            socket            = new StreamingAcnSocket(Guid.NewGuid(), "Streaming ACN Snoop");
            socket.NewPacket += new EventHandler <NewPacketEventArgs <Acn.Packets.sAcn.StreamingAcnDmxPacket> >(socket_NewPacket);
            socket.Open(networkCard.IpAddress);

            foreach (int universe in universes)
            {
                socket.JoinDmxUniverse(universe);
            }

            dmxOutput = new DmxStreamer(socket);
            dmxOutput.AddUniverse(sendData.Universe);

            acnPortExplorer = new RdmNetEndPointExplorer();
            acnPortExplorer.LocalAdapter      = networkCard.IpAddress;
            acnPortExplorer.NewEndpointFound += acnPortExplorer_NewEndpointFound;
            acnPortExplorer.Start();
        }
Esempio n. 4
0
        private void Start(CardInfo networkCard, IEnumerable <int> universes)
        {
            //socket = new StreamingAcnSocket(Guid.NewGuid(), "Acn Data Matrix", callBackClass);

            //socket.Open(networkCard.IpAddress);

            Sockets = new List <StreamingAcnSocket>();
            foreach (int universe in universes)
            {
                StreamingAcnSocket newSocket = new StreamingAcnSocket(Guid.NewGuid(), "Acn Data Matrix");
                newSocket.Open(networkCard.IpAddress);
                newSocket.JoinDmxUniverse(universe);
                Sockets.Add(newSocket);
            }

            acnPortExplorer = new RdmNetEndPointExplorer();
            acnPortExplorer.LocalAdapter      = networkCard.IpAddress;
            acnPortExplorer.NewEndpointFound += acnPortExplorer_NewEndpointFound;
            acnPortExplorer.Start();
        }
Esempio n. 5
0
        public void Start()
        {
            PatchManager.Instance.Init();

            socket = new StreamingAcnSocket(Guid.NewGuid(), "PixelDriver");
            socket.Open(new System.Net.IPAddress(new byte[] { 192, 168, 1, 50 }));

            foreach (Byte u in PatchManager.Instance.Universes)
            {
                socket.JoinDmxUniverse(u);
                universes.Add(u, new DmxUniverse(u));
            }

            dmxOutput = new DmxStreamer(socket);
            foreach (KeyValuePair <byte, DmxUniverse> universe in universes)
            {
                dmxOutput.AddUniverse(universe.Value);
            }
            dmxOutput.Start();
        }
Esempio n. 6
0
        private void Start(CardInfo networkCard, IEnumerable<int> universes)
        {
            socket = new StreamingAcnSocket(Guid.NewGuid(), "Streaming ACN Snoop");
            socket.SynchronizationAddress = SynchronizationUniverse;
            socket.NewPacket += socket_NewPacket;
            socket.NewSynchronize += socket_NewSynchronize;
            socket.NewDiscovery += socket_NewDiscovery;
            socket.Open(networkCard.IpAddress);
            socket.StartDiscovery();

            foreach (int universe in universes)
                socket.JoinDmxUniverse(universe);

            dmxOutput = new DmxStreamer(socket);
            dmxOutput.AddUniverse(sendData.Universe);

            acnPortExplorer = new RdmNetEndPointExplorer();
            acnPortExplorer.LocalAdapter = networkCard.IpAddress;
            acnPortExplorer.NewEndpointFound += acnPortExplorer_NewEndpointFound;
            acnPortExplorer.Start();

        }
Esempio n. 7
0
        public void Start()
        {
            Console.WriteLine("Start listening on {0} {1}.{2} for {3}ms pauses", IpAddress, Universe, Channel, Threshold);
            socket.Open(IPAddress.Parse(IpAddress));
            socket.NewPacket += socket_NewPacket;

            socket.JoinDmxUniverse(Universe);

            receiveData = new DmxUniverse(Universe);
            receiveData.DmxDataChanged += universe_DmxDataChanged;

            startTime     = DateTime.UtcNow;
            labelingTimer = new Timer(new TimerCallback((o) =>
            {
                var now = DateTime.UtcNow;
                Console.WriteLine("{0}   {1}", now, now - startTime);
            }), null, TimeSpan.FromMinutes(0), TimeSpan.FromMinutes(1));

            while (true)
            {
                Thread.Sleep(1000);
            }
        }
Esempio n. 8
0
        private static void ProcessDmxInput(Guid senderId, List <int> universes, int timeout, Action <StreamingAcnDmxPacket> handler)
        {
            ManualResetEvent waitForDMX      = new ManualResetEvent(false);
            Exception        socketException = null;

            StreamingAcnSocket acnSocket = new StreamingAcnSocket(Guid.NewGuid(), "DMX Assert");

            try
            {
                acnSocket.UnhandledException += (object sender, UnhandledExceptionEventArgs e)
                                                =>
                {
                    socketException = (Exception)e.ExceptionObject;
                    waitForDMX.Set();
                };

                acnSocket.NewPacket += (object sender, NewPacketEventArgs <Acn.Packets.sAcn.StreamingAcnDmxPacket> e) =>
                {
                    if ((senderId == Guid.Empty || senderId == e.Packet.Root.SenderId) &&
                        (universes.Contains(e.Packet.Framing.Universe)))
                    {
                        try
                        {
                            handler(e.Packet);

                            universes.Remove(e.Packet.Framing.Universe);
                            if (universes.Count == 0)
                            {
                                waitForDMX.Set();
                            }
                        }
                        finally
                        {
                            if (universes.Count == 0)
                            {
                                acnSocket.Close();
                            }
                        }
                    }
                };
                acnSocket.Open(IPAddress.Any);
                foreach (int universe in universes)
                {
                    acnSocket.JoinDmxUniverse(universe);
                }

                if (!waitForDMX.WaitOne(timeout))
                {
                    throw new TimeoutException(string.Format("A timeout ocurred whil waiting for DMX on universe {0}.", string.Join(",", universes)));
                }

                if (socketException != null)
                {
                    throw socketException;
                }
            }
            finally
            {
                acnSocket.Dispose();
            }
        }