@Override public void onPeersAvailable(WifiP2pDeviceList wifiP2pDeviceList) { if (!connectionAttemptInProgress.compareAndSet(false, true)) { return; } if (connected.get()) { return; } for (WifiP2pDevice device : wifiP2pDeviceList.getDeviceList()) { if (device.deviceAddress.equals(target)) { WifiP2pConfig config = new WifiP2pConfig(); config.deviceAddress = device.deviceAddress; config.wps.setup = WpsInfo.PBC; config.groupOwnerIntent = 0; // I want the other device to be the group owner (or 'server') Log.d(TAG, "Trying to connect to "+device.deviceAddress+" "+device.deviceName+" Owner: "+device.isGroupOwner()); connect(config); break; } } }
@Override public void onPeersAvailable(WifiP2pDeviceList peerList) { // Out with the old, in with the new. MainActivity.peers.clear(); MainActivity.peers.addAll(peerList.getDeviceList()); // If an AdapterView is backed by this data, notify it // of the change. For instance, if you have a ListView of available // peers, trigger an update. // ((WiFiPeerListAdapter) getListAdapter()).notifyDataSetChanged(); // if (peers.size() == 0) { // Log.d(WiFiDirectActivity.TAG, "No devices found"); // return; // } activity.notifyDataSetChanged(); }
@Override public void onPeersAvailable( WifiP2pDeviceList peers ) { Log.i("onPeersAvailable", "" + peers.getDeviceList().size()); SkyDivingEnvironment environment = SkyDivingEnvironment.getInstance( ); if (environment == null) return; for (String sdKey : previouslyDiscoveredPresence.keySet()) { setAbsent(sdKey); } List<SkyDiver> skydivers = getPeersAsSkyDivers(peers); for (SkyDiver skydiver : skydivers) { environment.onNewSkydiverInfo(skydiver); setPresent(skydiver.getName()); } manageDisconnections(); }
@Override public void onPeersAvailable(WifiP2pDeviceList peerList) { Log.d(TAG, String.format("Peers available: %d", peerList.getDeviceList().size())); discoverdPeers.clear(); discoverdPeers.addAll(peerList.getDeviceList()); updateIpPeerMapOfConnectedPeers(); removeDisconnectedPeersFromIpPeerMapOfConnectedPeers(); checkConnectionConsistency(); // If an AdapterView is backed by this data, notify it // of the change. For instance, if you have a ListView of available // peers, trigger an update. if (discoverdPeers.size() == 0) { Log.d(TAG, "No devices found"); return; } }
@Override public void onPeersAvailable(WifiP2pDeviceList peers) { if (display) { peerList.clear(); peerList.addAll(peers.getDeviceList()); if (peerList.size() == 0) { Toast.makeText(synCarnet, synCarnet.getString(R.string.noPair), Toast.LENGTH_SHORT).show(); } progressDialog = synCarnet.syncService.getProgressDialog(); if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); } peerListDialog.setPeerList(peerList); synCarnet.syncService.onPeerSelection(peerListDialog); } }
/** * Acquire new peers list and connect * * @param WifiP2pDeviceList peerList of devices! */ @Override public void onPeersAvailable(WifiP2pDeviceList peerList) { // Wipe old list // @todo filter connected peers (by address) out of new list this.peers.clear(); // Add new list this.peers.addAll(peerList.getDeviceList()); // Iterate to connect for (WifiP2pDevice device : this.peers) { // Prepare Config /w Device Address WifiP2pConfig wifiP2pConfig = new WifiP2pConfig(); wifiP2pConfig.deviceAddress = device.deviceAddress; // Connect // @todo add success/failure handling this.wifiP2pManager.connect(this.wifiP2pChannel, wifiP2pConfig, null); } }
@Override public void onPeersAvailable(WifiP2pDeviceList list) { Log.d(TAG, list.toString()); for (WifiP2pDevice device : list.getDeviceList()) { Utils.WifiDirectInfo info = Utils.parseWifiDirectName(device.deviceName); if (info != null) { String name = info.title; int port = info.port; reportUrlDevice(createUrlDeviceBuilder("WifiDirect" + name, device.deviceAddress + ":" + port) .setWifiAddress(device.deviceAddress) .setWifiPort(port) .setTitle(name) .setDescription("") .setDeviceType(Utils.WIFI_DIRECT_DEVICE_TYPE) .build()); } } }
@Override public void onPeersAvailable(WifiP2pDeviceList peers) { final Collection<WifiP2pDevice> deviceList = peers.getDeviceList(); final int nbrPeers = deviceList.size(); boolean isEqual = mPeers.containsAll(deviceList) && deviceList.containsAll(mPeers); Log.d(LOG_TAG, "PeerList: size=" + nbrPeers + ", wasUpdated?=" + !isEqual); if (!isEqual) { mPeers.clear(); mPeers.addAll(deviceList); if (mWifiP2pUiListener != null) { mWifiP2pUiListener.updatePeerList(mPeers); } } }
@Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); Logg.d(TAG, "received action " + action); // request list of peers wifi.getManager().requestPeers( wifi.getChannel(), new PeerListListener() { @Override public void onPeersAvailable(WifiP2pDeviceList peers) { // retreive list of devices devices.clear(); for (WifiP2pDevice device : peers.getDeviceList()) { devices.add(device); } onChange(); // if number of peers drops to zero if (devices.size() == 0) { // check again discover(); } } }); }
@Override public void onPeersAvailable(WifiP2pDeviceList peerList) { peers.clear(); peers.addAll(peerList.getDeviceList()); //Log.d(TAG,peers.toString()); // if Device on Inviting or Connected, terminate. if (onConnecting || wfd.status.p2p_status.equals("Connected") || wfd.status.p2p_status.equals("Invited")){ return; } // Search Opponent Device in Peer List for(int i=0; i<peers.size(); ++i){ if (peers.get(i).deviceName.equals(wfd.getOpponentID())){ onConnecting = true; WifiP2pDevice device = peers.get(i); WifiP2pConfig config = new WifiP2pConfig(); config.deviceAddress = device.deviceAddress; config.wps.setup = WpsInfo.PBC; Log.d(TAG,"connect challenge"); wfd.connect(config); return; } } // Can't Found Opponent Device Log.d(TAG,"can't found device"); }
@Override public void onPeersAvailable(WifiP2pDeviceList peers) { List<Device> peerList = new ArrayList<Device>(); for (WifiP2pDevice peer : peers.getDeviceList()){ peerList.add(new Device(peer.deviceName, peer.deviceAddress, peer.status)); } // Broadcast to all clients the new value. final int N = mCallbacks.beginBroadcast(); for (int i=0; i<N; i++) { try { mCallbacks.getBroadcastItem(i).updatePeersList(peerList); } catch (RemoteException e) {} } mCallbacks.finishBroadcast(); }
@Override public void onPeersAvailable(WifiP2pDeviceList peerList) { if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); } peers.clear(); peers.addAll(peerList.getDeviceList()); ((WiFiPeerListAdapter) getListAdapter()).notifyDataSetChanged(); if (peers.size() == 0) { Log.d(WiFiDirectActivity.TAG, "No devices found"); return; } }
@Override public void onPeersAvailable(final WifiP2pDeviceList peers) { if (DEBUG) Log.v(TAG, "onPeersAvailable:peers=" + peers); final Collection<WifiP2pDevice> devices = peers.getDeviceList(); synchronized (mAvailableDevices) { mAvailableDevices.clear(); mAvailableDevices.addAll(devices); } callOnUpdateDevices(mAvailableDevices); }
@Override public void onPeersAvailable(WifiP2pDeviceList peerDevices) { Log.d(TAG, "New wifi direct peer devices available" + peerDevices); // Actual handling of these peers is performed directly when the // peers changed event is raised, rather than indirectly here after // a request an a callback. }
@Override public void onPeersAvailable(WifiP2pDeviceList peerDevices) { log.debug( "New wifi direct peer devices available" + peerDevices); Log.d("peerDebug", "New wifi direct peer devices available" + peerDevices); // Actual handling of these peers is performed directly when the // peers changed event is raised, rather than indirectly here after // a request an a callback. }
@Override public void onPeersAvailable(WifiP2pDeviceList peersList) { if(progressDialog != null && progressDialog.isShowing()) progressDialog.dismiss(); peers.clear(); peers.addAll(peersList.getDeviceList()); ((WiFiPeerListAdapter)getListAdapter()).notifyDataSetChanged(); if(peers.size() == 0){ Log.e(WiFiDirectActivity.TAG, "the peers size is 0"); return; } }
/** Constructor **/ public WifiDirectHandler() { super(ANDROID_SERVICE_NAME); dnsSdTxtRecordMap = new HashMap<>(); dnsSdServiceMap = new HashMap<>(); peers = new WifiP2pDeviceList(); }
@Override public void onPeersAvailable(WifiP2pDeviceList peerList) { // TODO Auto-generated method stub WifiP2pDevice device; deviceList.clear(); deviceList.addAll(peerList.getDeviceList()); for(int i=0; i<deviceList.size(); i++) { WifiP2pDevice dd = deviceList.get(i); // LogUtils.i(WifiP2pHelper.TAG, dd + "---->addr="+dd.deviceAddress); } handler.sendEmptyMessage(WIFIP2P_DEVICE_LIST_CHANGED); }
@Override public void onPeersAvailable(WifiP2pDeviceList peerList) { boolean flag = false; WifiP2pConfig config = new WifiP2pConfig(); for (WifiP2pDevice peer : peerList.getDeviceList()) { if (peer.deviceAddress.equals(client.getGroupOwnerMacAddress())) { config.deviceAddress = peer.deviceAddress; flag = true; break; } } if (!flag) { client.getOutcomeBroadcastSender().serviceStoppedShowDialogFinishActivity("Keine Lobby gefunden."); client.stopSelf(); return; } config.wps.setup = WpsInfo.PBC; client.getmManager().connect(client.getmChannel(), config, new WifiP2pManager.ActionListener() { @Override public void onSuccess() { // WiFiDirectBroadcastReceiver will notify us. Ignore for now. } @Override public void onFailure(int reason) { Log.v("ClientPeerListListener", "Connect failed. Retry."); } }); }
@Override /** * Async callback. * Is called after peer scan was completed. */ public void onPeersAvailable(WifiP2pDeviceList peerList) { /*Log.d(LOG_TAG, "onPeersAvailable"); // Out with the old, in with the new. peers.clear(); peers.addAll(peerList.getDeviceList()); if (peers.size() == 0) { Log.d(LOG_TAG, "No devices found"); return; } else { Log.d(LOG_TAG, "Devices found: " + peers.size()); for(int i = 0; i < peers.size(); i++) { WifiP2pDevice currentDevice = (WifiP2pDevice) peers.get(i); String deviceName = currentDevice.deviceName; Log.d(LOG_TAG, "DeviceName: " + deviceName); } }*/ }
private List<SkyDiver> getPeersAsSkyDivers(WifiP2pDeviceList peers) { Collection<WifiP2pDevice> devices = peers.getDeviceList(); List<SkyDiver> skydivers = new ArrayList<SkyDiver>(); for (WifiP2pDevice device : devices) { skydivers.add( SkyDiver.valueOf(device) ); } return skydivers; }
private String dumpStack () { String result = ""; for(WifiP2pDeviceList dev : peerstack) { result = result + dev.toString() + "\n"; } return result; }
public WifiP2pDeviceList getPeers() { haspeers = false; if(peerstack.size() > 0) { WifiP2pDeviceList tmp = peerstack.get(0); peerstack.remove(0); return tmp; } else { return new WifiP2pDeviceList(); } }
public void onPeersAvailable(WifiP2pDeviceList peerList) { if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); } peers.clear(); peers.addAll(peerList.getDeviceList()); listAdapter.notifyDataSetChanged(); if (peers.size() == 0) { Log.d(WiFiDirectActivity.TAG, "No devices found"); return; } }
protected void notify_list_of_peers_changed(final WifiP2pDeviceList peers) { executorService.execute(new Runnable() { @Override public void run() { for (IBlaubotWifiDirectEventListener listener : eventListeners) { listener.onListOfPeersChanged(peers); } } }); }
public void onPeersAvailable(WifiP2pDeviceList peers) { ArrayList<WifiP2pDevice> devices = new ArrayList<WifiP2pDevice>(peers.getDeviceList()); for (WifiP2pDevice device : devices) { if (!connectedDevices.contains(device.deviceAddress)){ Log.d(ConnectService.TAG, "Connecting to " + device.toString()); context.connect(device.deviceAddress); connectedDevices.add(device.deviceAddress); } } }
public void onPeersAvailable(WifiP2pDeviceList peers) { ArrayList<WifiP2pDevice> devices = new ArrayList<WifiP2pDevice>(peers.getDeviceList()); for (WifiP2pDevice device : devices) { if (device.deviceAddress.equals(StartActivity.ScreenMAC)){ Log.d(StartActivity.TAG, "Screen detected"); ((TextView) context.findViewById(R.id.screenSearchText)).setText(R.string.connectionProgress); context.connect(); break; } } }
@Override public void onPeersAvailable(WifiP2pDeviceList peers) { this.peers.clear(); for (WifiP2pDevice peer : peers.getDeviceList()) { this.peers.add(peer); Log.d(TAG, "peer = " + peer); } mergeServicePeers(); onNFGameNotify(); if (this.peers.size() == 0) { Log.d(TAG, "no peers"); } }
public void onPeerListChanged() { mManager.requestPeers(mChannel, new PeerListListener() { @Override public void onPeersAvailable(WifiP2pDeviceList peers) { Collection<WifiP2pDevice> peersCollection = peers.getDeviceList(); updatePeerList(peersCollection); } }); }
@Override public void onPeersAvailable(WifiP2pDeviceList peerList) { Log.d(TAG, "onPeersAvailable"); if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); } peers.clear(); peers.addAll(peerList.getDeviceList()); ((WiFiPeerListAdapter)getListAdapter()).notifyDataSetChanged(); if (peers.size() == 0) { Log.d(TAG, "No devices found"); } }
@Override public void onPeersAvailable(WifiP2pDeviceList peerList) { if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); } peers.clear(); peers.addAll(peerList.getDeviceList()); ((WiFiPeerListAdapter) getListAdapter()).notifyDataSetChanged(); if (peers.size() == 0) { Log.d(MainActivity.TAG, "No devices found"); return; } }