Java Code Examples for android.net.wifi.p2p.WifiP2pDeviceList#getDeviceList()

The following examples show how to use android.net.wifi.p2p.WifiP2pDeviceList#getDeviceList() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@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());
    }
  }
}
 
Example 2
Source Project: ShareBox   File: P2pConnect.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onPeersAvailable(WifiP2pDeviceList peers) {
    for(WifiP2pDevice device:peers.getDeviceList())
    {
        Log.i(TAG,device.toString());
    }
    _p2pDeviceList.clear();
    _p2pDeviceList.addAll(peers.getDeviceList());
}
 
Example 3
Source Project: libcommon   File: WiFiP2pHelper.java    License: Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example 4
Source Project: android-p2p   File: P2pChatService.java    License: MIT License 5 votes vote down vote up
@Override
public void onPeersAvailable(WifiP2pDeviceList deviceList) {
    Collection<WifiP2pDevice> foundDevices = deviceList.getDeviceList();
    boolean devicesRemoved = this.Devices.retainAll(foundDevices);
    boolean devicesAdded = this.Devices.addAll(foundDevices);
    if (devicesRemoved || devicesAdded) {
        this.updateDevices();
    }
}
 
Example 5
@Override
public void onPeersAvailable(WifiP2pDeviceList peerList) {

  Collection<WifiP2pDevice> deviceList = peerList.getDeviceList();

  for (WifiP2pDevice device : deviceList)
  {
	  boolean trusted = false; //not sure how to do this with wifi
	  
 	 if (!GilgaService.mapToNickname(device.deviceAddress).startsWith(mLocalAddressHeader)) //not me
 		mService.processInboundMessage(device.deviceName,device.deviceAddress,trusted);
	  
	  
	  
  }
}