public TunnelService(){ //handler = new Handler(); tunnel = new Tunnel(); streamingSettings = new StreamingSettings(); rtspServer = new RtspServer (); tunnelBinder = new TunnelBinder(tunnel,streamingSettings,rtspServer); tunnel.Started += OnTunnelStated; tunnel.Stopped += OnTunnelStoped; tunnel.ClientConnected += OnClientConnected; tunnel.ClientDisConnected += OnClientDisconnected; }
public TunnelService() { //handler = new Handler(); tunnel = new Tunnel(); streamingSettings = new StreamingSettings(); rtspServer = new RtspServer(); tunnelBinder = new TunnelBinder(tunnel, streamingSettings, rtspServer); tunnel.Started += OnTunnelStated; tunnel.Stopped += OnTunnelStoped; tunnel.ClientConnected += OnClientConnected; tunnel.ClientDisConnected += OnClientDisconnected; }
protected void OnBoundToTunnelService(TunnelService.TunnelBinder binder) { Console.WriteLine("Bound to tunnel service"); if (tunnel == null || !tunnel.Equals(binder.Tunnel)) { tunnel = binder.Tunnel; rtspServer = binder.RtspServer; streamingSettings = binder.StreamingSettings; tunnel.Started += OnTunnelStarted; tunnel.Stopped += OnTunnelStopped; tunnel.ClientConnected += OnClientConnected; tunnel.ClientDisConnected += OnClientDisconnected; tunnel.LogEvent += WriteLine; rtspServer.StreamingStarted += OnStreamStarted; rtspServer.StreamingStoped += OnStreamStopped; } if (tunnel.IsRunning) { OnTunnelStarted(); if (tunnel.ClientsConnected != 0) { OnClientConnected(null); } else { OnClientDisconnected(null); } SetStreamStatus(rtspServer.IsStreaming); } else { OnTunnelStopped(); OnClientDisconnected(null); SetStreamStatus(false); } //Do something here }
public TunnelBinder(Tunnel tunnel, StreamingSettings settings, RtspServer rtspServer){ this.tunnel = tunnel; this.settings = settings; this.rtspServer = rtspServer; }
protected void OnBoundToTunnelService(TunnelService.TunnelBinder binder){ Console.WriteLine("Bound to tunnel service"); if(tunnel == null || !tunnel.Equals(binder.Tunnel)){ tunnel = binder.Tunnel; rtspServer = binder.RtspServer; streamingSettings = binder.StreamingSettings; tunnel.Started += OnTunnelStarted; tunnel.Stopped += OnTunnelStopped; tunnel.ClientConnected += OnClientConnected; tunnel.ClientDisConnected += OnClientDisconnected; tunnel.LogEvent += WriteLine; rtspServer.StreamingStarted += OnStreamStarted; rtspServer.StreamingStoped += OnStreamStopped; } if (tunnel.IsRunning) { OnTunnelStarted(); if(tunnel.ClientsConnected != 0){ OnClientConnected(null); } else{ OnClientDisconnected(null); } SetStreamStatus(rtspServer.IsStreaming); } else{ OnTunnelStopped(); OnClientDisconnected(null); SetStreamStatus(false); } //Do something here }
public TunnelBinder(Tunnel tunnel, StreamingSettings settings, RtspServer rtspServer) { this.tunnel = tunnel; this.settings = settings; this.rtspServer = rtspServer; }