Example #1
0
 public void SetManager(WifiP2pManager manager, WifiP2pManager.Channel channel, PeerListListener peerListListener)
 {
     // Maybe the receiver should only use events instead.
     _manager = manager;
     _channel = channel;
     _peerListListener = peerListListener;            
 }
Example #2
0
        private void SetupWifiDirect()
        {
            _intentFilter = new IntentFilter();
            _intentFilter.AddAction(WifiP2pManager.WifiP2pStateChangedAction);
            _intentFilter.AddAction(WifiP2pManager.WifiP2pPeersChangedAction);
            _intentFilter.AddAction(WifiP2pManager.WifiP2pConnectionChangedAction);
            _intentFilter.AddAction(WifiP2pManager.WifiP2pThisDeviceChangedAction);

            _actionListener = new ActionListener();
            _peerListListener = new PeerListListener();
            _wifiManager = (WifiP2pManager)SessionsApplication.Context.GetSystemService(Context.WifiP2pService);
            _wifiChannel = _wifiManager.Initialize(SessionsApplication.Context, SessionsApplication.Context.MainLooper, null);
            _wifiDirectReceiver = new WifiDirectReceiver();
            _wifiDirectReceiver.SetManager(_wifiManager, _wifiChannel, _peerListListener);
            SessionsApplication.Context.RegisterReceiver(_wifiDirectReceiver, _intentFilter);
        }