use of android.net.wifi.WifiConfiguration in project zxingfragmentlib by mitoyarzun.
the class WifiConfigManager method changeNetworkUnEncrypted.
// Adding an open, unsecured network
private static void changeNetworkUnEncrypted(WifiManager wifiManager, WifiParsedResult wifiResult) {
WifiConfiguration config = changeNetworkCommon(wifiResult);
config.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
updateNetwork(wifiManager, config);
}
use of android.net.wifi.WifiConfiguration in project robolectric by robolectric.
the class ShadowWifiConfigurationTest method shouldSetTheBitSetsAndWepKeyArrays.
@Test
public void shouldSetTheBitSetsAndWepKeyArrays() throws Exception {
WifiConfiguration wifiConfiguration = new WifiConfiguration();
assertNotNull(wifiConfiguration.allowedAuthAlgorithms);
}
use of android.net.wifi.WifiConfiguration in project robolectric by robolectric.
the class ShadowWifiManagerTest method updateNetwork_shouldReplaceNetworks.
@Test
public void updateNetwork_shouldReplaceNetworks() throws Exception {
WifiConfiguration wifiConfiguration = new WifiConfiguration();
wifiConfiguration.networkId = -1;
wifiManager.addNetwork(wifiConfiguration);
WifiConfiguration anotherConfig = new WifiConfiguration();
int networkId = wifiManager.addNetwork(anotherConfig);
assertThat(networkId).isEqualTo(1);
WifiConfiguration configuration = new WifiConfiguration();
configuration.networkId = networkId;
configuration.priority = 44;
assertThat(wifiManager.updateNetwork(configuration)).isEqualTo(networkId);
List<WifiConfiguration> configuredNetworks = wifiManager.getConfiguredNetworks();
assertThat(configuredNetworks.size()).isEqualTo(2);
assertThat(configuration.priority).isEqualTo(44);
assertThat(configuredNetworks.get(1).priority).isEqualTo(44);
}
use of android.net.wifi.WifiConfiguration in project robolectric by robolectric.
the class ShadowWifiConfiguration method copy.
public WifiConfiguration copy() {
WifiConfiguration config = new WifiConfiguration();
config.networkId = realObject.networkId;
config.SSID = realObject.SSID;
config.BSSID = realObject.BSSID;
config.preSharedKey = realObject.preSharedKey;
config.wepTxKeyIndex = realObject.wepTxKeyIndex;
config.status = realObject.status;
config.priority = realObject.priority;
config.hiddenSSID = realObject.hiddenSSID;
config.allowedKeyManagement = (BitSet) realObject.allowedKeyManagement.clone();
config.allowedProtocols = (BitSet) realObject.allowedProtocols.clone();
config.allowedAuthAlgorithms = (BitSet) realObject.allowedAuthAlgorithms.clone();
config.allowedPairwiseCiphers = (BitSet) realObject.allowedPairwiseCiphers.clone();
config.allowedGroupCiphers = (BitSet) realObject.allowedGroupCiphers.clone();
config.wepKeys = new String[4];
System.arraycopy(realObject.wepKeys, 0, config.wepKeys, 0, config.wepKeys.length);
return config;
}
use of android.net.wifi.WifiConfiguration in project robolectric by robolectric.
the class ShadowWifiManager method makeCopy.
private WifiConfiguration makeCopy(WifiConfiguration config, int networkId) {
WifiConfiguration copy = Shadows.shadowOf(config).copy();
copy.networkId = networkId;
return copy;
}
Aggregations