Java Code Examples for android.net.wifi.p2p.WifiP2pDeviceList#getDeviceList()
The following examples show how to use
android.net.wifi.p2p.WifiP2pDeviceList#getDeviceList() .
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
Source File: WifiUrlDeviceDiscoverer.java From physical-web with Apache License 2.0 | 6 votes |
@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 File: P2pConnect.java From ShareBox with Apache License 2.0 | 5 votes |
@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 File: WiFiP2pHelper.java From libcommon with Apache License 2.0 | 5 votes |
@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 File: P2pChatService.java From android-p2p with MIT License | 5 votes |
@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
Source File: WifiController.java From gilgamesh with GNU General Public License v3.0 | 4 votes |
@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); } }