1 package com.xtremelabs.robolectric.shadows; 2 3 import android.net.wifi.WifiConfiguration; 4 import com.xtremelabs.robolectric.internal.Implements; 5 import com.xtremelabs.robolectric.internal.RealObject; 6 7 import java.util.BitSet; 8 9 @Implements(WifiConfiguration.class) 10 public class ShadowWifiConfiguration { 11 @RealObject WifiConfiguration realObject; 12 13 public void __constructor__() { 14 realObject.networkId = -1; 15 realObject.SSID = null; 16 realObject.BSSID = null; 17 realObject.priority = 0; 18 realObject.hiddenSSID = false; 19 realObject.allowedKeyManagement = new BitSet(); 20 realObject.allowedProtocols = new BitSet(); 21 realObject.allowedAuthAlgorithms = new BitSet(); 22 realObject.allowedPairwiseCiphers = new BitSet(); 23 realObject.allowedGroupCiphers = new BitSet(); 24 realObject.wepKeys = new String[4]; 25 for (int i = 0; i < realObject.wepKeys.length; i++) 26 realObject.wepKeys[i] = null; 27 // for (EnterpriseField field : realObject.enterpriseFields) { 28 // field.setValue(null); 29 // } 30 } 31 32 public WifiConfiguration copy(){ 33 WifiConfiguration config = new WifiConfiguration(); 34 config.networkId = realObject.networkId; 35 config.SSID = realObject.SSID; 36 config.BSSID = realObject.BSSID; 37 config.preSharedKey = realObject.preSharedKey; 38 config.wepTxKeyIndex = realObject.wepTxKeyIndex; 39 config.status = realObject.status; 40 config.priority = realObject.priority; 41 config.hiddenSSID = realObject.hiddenSSID; 42 config.allowedKeyManagement = (BitSet) realObject.allowedKeyManagement.clone(); 43 config.allowedProtocols = (BitSet) realObject.allowedProtocols.clone(); 44 config.allowedAuthAlgorithms = (BitSet) realObject.allowedAuthAlgorithms.clone(); 45 config.allowedPairwiseCiphers = (BitSet) realObject.allowedPairwiseCiphers.clone(); 46 config.allowedGroupCiphers = (BitSet) realObject.allowedGroupCiphers.clone(); 47 config.wepKeys = new String[4]; 48 System.arraycopy(realObject.wepKeys, 0, config.wepKeys, 0, config.wepKeys.length); 49 return config; 50 } 51 } 52