/// <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); } }
public AcnStream(IPAddress bindIpAddress, byte priority) { if (bindIpAddress == null) { bindIpAddress = GetFirstBindAddress(); } this.priority = priority; this.socket = new StreamingAcnSocket(dmxPlayerAcnId, "DmxPlayer"); this.socket.Open(new IPEndPoint(bindIpAddress, 0)); this.socket.UnhandledException += Socket_UnhandledException; Console.WriteLine("ACN binding to {0}", bindIpAddress); }
public AcnStream(IPAddress bindIpAddress, int priority) { if (bindIpAddress == null) bindIpAddress = GetFirstBindAddress(); this.socket = new StreamingAcnSocket(animatrollerAcnId, "Animatroller"); this.socket.NewPacket += socket_NewPacket; this.socket.Open(bindIpAddress); log.Info("ACN binding to {0}", bindIpAddress); this.dmxStreamer = new DmxStreamer(this.socket); this.dmxStreamer.Priority = priority; this.sendingUniverses = new Dictionary<int, AcnUniverse>(); Executor.Current.Register(this); }
/// <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); } }
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(); }
private void Stop() { if (acnPortExplorer != null) { acnPortExplorer.Stop(); acnPortExplorer = null; } if (dmxOutput != null) { dmxOutput.Dispose(); dmxOutput = null; } if (socket != null) { socket.Close(); socket = null; } }
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(); }
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(); }
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(); }
public DmxStreamer(StreamingAcnSocket socket) { this.socket = socket; Streaming = false; }
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(); } }
public void Dispose() { this.socket.Close(); this.socket.Dispose(); this.socket = null; }