protected void OnUnBoundToTunnelService(TunnelService.TunnelBinder binder) { tunnel.Started -= OnTunnelStarted; tunnel.Stopped -= OnTunnelStopped; tunnel.ClientConnected -= OnClientConnected; tunnel.ClientDisConnected -= OnClientDisconnected; tunnel.LogEvent -= WriteLine; rtspServer.StreamingStarted -= OnStreamStarted; rtspServer.StreamingStoped -= OnStreamStopped; Console.WriteLine("Unbound from tunnel service"); }
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 void OnServiceConnected(ComponentName name, IBinder service) { binder = (TunnelService.TunnelBinder) service; onConnect(binder); }
public void OnServiceConnected(ComponentName name, IBinder service) { binder = (TunnelService.TunnelBinder)service; onConnect(binder); }