use of android.net.wifi.p2p.WifiP2pDevice in project nfcspy by sinpolib.
the class ActivityManageP2P method handleBroadcast.
void handleBroadcast(Intent intent) {
closeProgressDialog();
final String action = intent.getAction();
if (WIFI_P2P_STATE_CHANGED_ACTION.equals(action)) {
int state = intent.getIntExtra(EXTRA_WIFI_STATE, -1);
if (state == WifiP2pManager.WIFI_P2P_STATE_ENABLED) {
p2p.isWifiP2pEnabled = true;
} else {
showMessage(R.string.event_p2p_disable);
resetData();
}
} else if (WIFI_P2P_PEERS_CHANGED_ACTION.equals(action)) {
new Wifip2pRequestPeers(eventHelper).execute(p2p);
} else if (WIFI_P2P_THIS_DEVICE_CHANGED_ACTION.equals(action)) {
WifiP2pDevice me = (WifiP2pDevice) intent.getParcelableExtra(EXTRA_WIFI_P2P_DEVICE);
thisDevice.setText(getWifiP2pDeviceInfo(me));
}
}
use of android.net.wifi.p2p.WifiP2pDevice in project android_packages_apps_Settings by SudaMod.
the class WifiP2pSettings method handlePeersChanged.
private void handlePeersChanged() {
mPeerCategoryController.removeAllChildren();
mConnectedDevices = 0;
if (DBG)
Log.d(TAG, "List of available peers");
for (WifiP2pDevice peer : mPeers.getDeviceList()) {
if (DBG)
Log.d(TAG, "-> " + peer);
mPeerCategoryController.addChild(new WifiP2pPeer(getPrefContext(), peer));
if (peer.status == WifiP2pDevice.CONNECTED)
mConnectedDevices++;
}
if (DBG)
Log.d(TAG, " mConnectedDevices " + mConnectedDevices);
}
use of android.net.wifi.p2p.WifiP2pDevice in project platform_packages_apps_Settings by BlissRoms.
the class P2pThisDevicePreferenceControllerTest method updateDeviceName_hasName_shouldUseName.
@Test
public void updateDeviceName_hasName_shouldUseName() {
WifiP2pDevice device = new WifiP2pDevice();
device.deviceAddress = "address";
device.deviceName = "name";
mController.displayPreference(mPreferenceScreen);
mController.updateDeviceName(device);
assertThat(mPreference.getTitle()).isEqualTo(device.deviceName);
}
use of android.net.wifi.p2p.WifiP2pDevice in project platform_packages_apps_Settings by BlissRoms.
the class P2pThisDevicePreferenceControllerTest method updateDeviceName_emptyName_shouldUseIpAddress.
@Test
public void updateDeviceName_emptyName_shouldUseIpAddress() {
WifiP2pDevice device = new WifiP2pDevice();
device.deviceAddress = "address";
mController.displayPreference(mPreferenceScreen);
mController.updateDeviceName(device);
assertThat(mPreference.getTitle()).isEqualTo(device.deviceAddress);
}
use of android.net.wifi.p2p.WifiP2pDevice in project platform_packages_apps_Settings by BlissRoms.
the class WifiP2pSettings method handlePeersChanged.
private void handlePeersChanged() {
mPeerCategoryController.removeAllChildren();
mConnectedDevices = 0;
if (DBG)
Log.d(TAG, "List of available peers");
for (WifiP2pDevice peer : mPeers.getDeviceList()) {
if (DBG)
Log.d(TAG, "-> " + peer);
mPeerCategoryController.addChild(new WifiP2pPeer(getPrefContext(), peer));
if (peer.status == WifiP2pDevice.CONNECTED)
mConnectedDevices++;
}
if (DBG)
Log.d(TAG, " mConnectedDevices " + mConnectedDevices);
}
Aggregations