Loading wifi/java/android/net/wifi/WifiNative.java +4 −4 Original line number Diff line number Diff line Loading @@ -261,10 +261,10 @@ public class WifiNative { public static String p2pConnect(WifiP2pConfig config, boolean joinExistingGroup) { if (config == null) return null; List<String> args = new ArrayList<String>(); Wps wpsConfig = config.wpsConfig; Wps wps = config.wps; args.add(config.deviceAddress); switch (wpsConfig.setup) { switch (wps.setup) { case PBC: args.add("pbc"); break; Loading @@ -274,11 +274,11 @@ public class WifiNative { args.add("display"); break; case KEYPAD: args.add(wpsConfig.pin); args.add(wps.pin); args.add("keypad"); break; case LABEL: args.add(wpsConfig.pin); args.add(wps.pin); args.add("label"); default: break; Loading wifi/java/android/net/wifi/Wps.java +4 −2 Original line number Diff line number Diff line Loading @@ -27,10 +27,12 @@ import java.util.BitSet; /** * A class representing Wi-Fi Protected Setup * @hide * * {@see WifiP2pConfig} */ public class Wps implements Parcelable { /* Wi-Fi Protected Setup. www.wi-fi.org/wifi-protected-setup has details */ /** Wi-Fi Protected Setup. www.wi-fi.org/wifi-protected-setup has details */ public enum Setup { /* Push button configuration */ PBC, Loading @@ -49,6 +51,7 @@ public class Wps implements Parcelable { /** @hide */ public String BSSID; /** Passed with pin method configuration */ public String pin; /** @hide */ Loading @@ -60,7 +63,6 @@ public class Wps implements Parcelable { /** @hide */ public LinkProperties linkProperties; /** @hide */ public Wps() { setup = Setup.INVALID; BSSID = null; Loading wifi/java/android/net/wifi/p2p/WifiP2pConfig.java +19 −16 Original line number Diff line number Diff line Loading @@ -22,20 +22,22 @@ import android.os.Parcelable; import android.os.Parcel; /** * A class representing a Wi-Fi P2p configuration * A class representing a Wi-Fi P2p configuration for setting up a connection * @hide * * {@see WifiP2pManager} */ public class WifiP2pConfig implements Parcelable { /** * Device address * The device MAC address uniquely identifies a Wi-Fi p2p device */ public String deviceAddress; /** * WPS configuration * Wi-Fi Protected Setup information */ public Wps wpsConfig; public Wps wps; /** * This is an integer value between 0 and 15 where 0 indicates the least Loading @@ -61,11 +63,11 @@ public class WifiP2pConfig implements Parcelable { public WifiP2pConfig() { //set defaults wpsConfig = new Wps(); wpsConfig.setup = Setup.PBC; wps = new Wps(); wps.setup = Setup.PBC; } /* P2P-GO-NEG-REQUEST 42:fc:89:a8:96:09 dev_passwd_id=4 */ /** P2P-GO-NEG-REQUEST 42:fc:89:a8:96:09 dev_passwd_id=4 {@hide}*/ public WifiP2pConfig(String supplicantEvent) throws IllegalArgumentException { String[] tokens = supplicantEvent.split(" "); Loading @@ -74,7 +76,7 @@ public class WifiP2pConfig implements Parcelable { } deviceAddress = tokens[1]; wpsConfig = new Wps(); wps = new Wps(); if (tokens.length > 2) { String[] nameVal = tokens[2].split("="); Loading @@ -87,28 +89,29 @@ public class WifiP2pConfig implements Parcelable { //As defined in wps/wps_defs.h switch (devPasswdId) { case 0x00: wpsConfig.setup = Setup.LABEL; wps.setup = Setup.LABEL; break; case 0x01: wpsConfig.setup = Setup.KEYPAD; wps.setup = Setup.KEYPAD; break; case 0x04: wpsConfig.setup = Setup.PBC; wps.setup = Setup.PBC; break; case 0x05: wpsConfig.setup = Setup.DISPLAY; wps.setup = Setup.DISPLAY; break; default: wpsConfig.setup = Setup.PBC; wps.setup = Setup.PBC; break; } } } /** @hide */ public String toString() { StringBuffer sbuf = new StringBuffer(); sbuf.append("\n address: ").append(deviceAddress); sbuf.append("\n wps: ").append(wpsConfig); sbuf.append("\n wps: ").append(wps); sbuf.append("\n groupOwnerIntent: ").append(groupOwnerIntent); sbuf.append("\n persist: ").append(persist.toString()); return sbuf.toString(); Loading @@ -129,7 +132,7 @@ public class WifiP2pConfig implements Parcelable { /** Implement the Parcelable interface {@hide} */ public void writeToParcel(Parcel dest, int flags) { dest.writeString(deviceAddress); dest.writeParcelable(wpsConfig, flags); dest.writeParcelable(wps, flags); dest.writeInt(groupOwnerIntent); dest.writeString(persist.name()); } Loading @@ -140,7 +143,7 @@ public class WifiP2pConfig implements Parcelable { public WifiP2pConfig createFromParcel(Parcel in) { WifiP2pConfig config = new WifiP2pConfig(); config.deviceAddress = in.readString(); config.wpsConfig = (Wps) in.readParcelable(null); config.wps = (Wps) in.readParcelable(null); config.groupOwnerIntent = in.readInt(); config.persist = Persist.valueOf(in.readString()); return config; Loading wifi/java/android/net/wifi/p2p/WifiP2pDevice.java +41 −15 Original line number Diff line number Diff line Loading @@ -25,17 +25,20 @@ import java.util.regex.Pattern; /** * A class representing a Wi-Fi p2p device * @hide * * {@see WifiP2pManager} */ public class WifiP2pDevice implements Parcelable { private static final String TAG = "WifiP2pDevice"; /** * Device name * The device name is a user friendly string to identify a Wi-Fi p2p device */ public String deviceName; /** * Device MAC address * The device MAC address uniquely identifies a Wi-Fi p2p device */ public String deviceAddress; Loading @@ -46,35 +49,30 @@ public class WifiP2pDevice implements Parcelable { * P2P Interface Address and the group interface will be created with * address as the local address in case of successfully completed * negotiation. * @hide */ public String interfaceAddress; /** * Primary device type * Primary device type identifies the type of device. For example, an application * could filter the devices discovered to only display printers if the purpose is to * enable a printing action from the user. See the Wi-Fi Direct technical specification * for the full list of standard device types supported. */ public String primaryDeviceType; /** * Secondary device type * Secondary device type is an optional attribute that can be provided by a device in * addition to the primary device type. */ public String secondaryDeviceType; // These definitions match the ones in wpa_supplicant /* WPS config methods supported */ private static final int WPS_CONFIG_USBA = 0x0001; private static final int WPS_CONFIG_ETHERNET = 0x0002; private static final int WPS_CONFIG_LABEL = 0x0004; private static final int WPS_CONFIG_DISPLAY = 0x0008; private static final int WPS_CONFIG_EXT_NFC_TOKEN = 0x0010; private static final int WPS_CONFIG_INT_NFC_TOKEN = 0x0020; private static final int WPS_CONFIG_NFC_INTERFACE = 0x0040; private static final int WPS_CONFIG_PUSHBUTTON = 0x0080; private static final int WPS_CONFIG_KEYPAD = 0x0100; private static final int WPS_CONFIG_VIRT_PUSHBUTTON = 0x0280; private static final int WPS_CONFIG_PHY_PUSHBUTTON = 0x0480; private static final int WPS_CONFIG_VIRT_DISPLAY = 0x2008; private static final int WPS_CONFIG_PHY_DISPLAY = 0x4008; /* Device Capability bitmap */ private static final int DEVICE_CAPAB_SERVICE_DISCOVERY = 1; Loading @@ -95,19 +93,23 @@ public class WifiP2pDevice implements Parcelable { /** * WPS config methods supported * @hide */ public int wpsConfigMethodsSupported; /** * Device capability * @hide */ public int deviceCapability; /** * Group capability * @hide */ public int groupCapability; /** Device connection status */ public enum Status { CONNECTED, INVITED, Loading @@ -118,7 +120,7 @@ public class WifiP2pDevice implements Parcelable { public Status status = Status.UNAVAILABLE; public WifiP2pDevice() { WifiP2pDevice() { } /** Loading @@ -144,6 +146,7 @@ public class WifiP2pDevice implements Parcelable { * group_capab=0x0 * * Note: The events formats can be looked up in the wpa_supplicant code * @hide */ public WifiP2pDevice(String string) throws IllegalArgumentException { String[] tokens = string.split(" "); Loading Loading @@ -198,11 +201,33 @@ public class WifiP2pDevice implements Parcelable { } } /** Returns true if WPS push button configuration is supported */ public boolean wpsPbcSupported() { return (wpsConfigMethodsSupported & WPS_CONFIG_PUSHBUTTON) != 0; } /** Returns true if WPS keypad configuration is supported */ public boolean wpsKeypadSupported() { return (wpsConfigMethodsSupported & WPS_CONFIG_KEYPAD) != 0; } /** Returns true if WPS display configuration is supported */ public boolean wpsDisplaySupported() { return (wpsConfigMethodsSupported & WPS_CONFIG_DISPLAY) != 0; } /** Returns true if the device is capable of service discovery */ public boolean isServiceDiscoveryCapable() { return (deviceCapability & DEVICE_CAPAB_SERVICE_DISCOVERY) != 0; } /** Returns true if the device is a group owner */ public boolean isGroupOwner() { return (groupCapability & GROUP_CAPAB_GROUP_OWNER) != 0; } @Override /** @hide */ public boolean equals(Object obj) { if (this == obj) return true; if (!(obj instanceof WifiP2pDevice)) return false; Loading @@ -214,6 +239,7 @@ public class WifiP2pDevice implements Parcelable { return other.deviceAddress.equals(deviceAddress); } /** @hide */ public String toString() { StringBuffer sbuf = new StringBuffer(); sbuf.append("Device: ").append(deviceName); Loading wifi/java/android/net/wifi/p2p/WifiP2pDeviceList.java +10 −2 Original line number Diff line number Diff line Loading @@ -28,22 +28,25 @@ import java.util.Collections; /** * A class representing a Wi-Fi P2p device list * @hide * * {@see WifiP2pManager} */ public class WifiP2pDeviceList implements Parcelable { private Collection<WifiP2pDevice> mDevices; public WifiP2pDeviceList() { WifiP2pDeviceList() { mDevices = new ArrayList<WifiP2pDevice>(); } //copy constructor /** copy constructor {@hide} */ public WifiP2pDeviceList(WifiP2pDeviceList source) { if (source != null) { mDevices = source.getDeviceList(); } } /** @hide */ public WifiP2pDeviceList(ArrayList<WifiP2pDevice> devices) { mDevices = new ArrayList<WifiP2pDevice>(); for (WifiP2pDevice device : devices) { Loading @@ -51,12 +54,14 @@ public class WifiP2pDeviceList implements Parcelable { } } /** @hide */ public boolean clear() { if (mDevices.isEmpty()) return false; mDevices.clear(); return true; } /** @hide */ public void update(WifiP2pDevice device) { if (device == null) return; for (WifiP2pDevice d : mDevices) { Loading @@ -75,15 +80,18 @@ public class WifiP2pDeviceList implements Parcelable { mDevices.add(device); } /** @hide */ public boolean remove(WifiP2pDevice device) { if (device == null) return false; return mDevices.remove(device); } /** Get the list of devices */ public Collection<WifiP2pDevice> getDeviceList() { return Collections.unmodifiableCollection(mDevices); } /** @hide */ public String toString() { StringBuffer sbuf = new StringBuffer(); for (WifiP2pDevice device : mDevices) { Loading Loading
wifi/java/android/net/wifi/WifiNative.java +4 −4 Original line number Diff line number Diff line Loading @@ -261,10 +261,10 @@ public class WifiNative { public static String p2pConnect(WifiP2pConfig config, boolean joinExistingGroup) { if (config == null) return null; List<String> args = new ArrayList<String>(); Wps wpsConfig = config.wpsConfig; Wps wps = config.wps; args.add(config.deviceAddress); switch (wpsConfig.setup) { switch (wps.setup) { case PBC: args.add("pbc"); break; Loading @@ -274,11 +274,11 @@ public class WifiNative { args.add("display"); break; case KEYPAD: args.add(wpsConfig.pin); args.add(wps.pin); args.add("keypad"); break; case LABEL: args.add(wpsConfig.pin); args.add(wps.pin); args.add("label"); default: break; Loading
wifi/java/android/net/wifi/Wps.java +4 −2 Original line number Diff line number Diff line Loading @@ -27,10 +27,12 @@ import java.util.BitSet; /** * A class representing Wi-Fi Protected Setup * @hide * * {@see WifiP2pConfig} */ public class Wps implements Parcelable { /* Wi-Fi Protected Setup. www.wi-fi.org/wifi-protected-setup has details */ /** Wi-Fi Protected Setup. www.wi-fi.org/wifi-protected-setup has details */ public enum Setup { /* Push button configuration */ PBC, Loading @@ -49,6 +51,7 @@ public class Wps implements Parcelable { /** @hide */ public String BSSID; /** Passed with pin method configuration */ public String pin; /** @hide */ Loading @@ -60,7 +63,6 @@ public class Wps implements Parcelable { /** @hide */ public LinkProperties linkProperties; /** @hide */ public Wps() { setup = Setup.INVALID; BSSID = null; Loading
wifi/java/android/net/wifi/p2p/WifiP2pConfig.java +19 −16 Original line number Diff line number Diff line Loading @@ -22,20 +22,22 @@ import android.os.Parcelable; import android.os.Parcel; /** * A class representing a Wi-Fi P2p configuration * A class representing a Wi-Fi P2p configuration for setting up a connection * @hide * * {@see WifiP2pManager} */ public class WifiP2pConfig implements Parcelable { /** * Device address * The device MAC address uniquely identifies a Wi-Fi p2p device */ public String deviceAddress; /** * WPS configuration * Wi-Fi Protected Setup information */ public Wps wpsConfig; public Wps wps; /** * This is an integer value between 0 and 15 where 0 indicates the least Loading @@ -61,11 +63,11 @@ public class WifiP2pConfig implements Parcelable { public WifiP2pConfig() { //set defaults wpsConfig = new Wps(); wpsConfig.setup = Setup.PBC; wps = new Wps(); wps.setup = Setup.PBC; } /* P2P-GO-NEG-REQUEST 42:fc:89:a8:96:09 dev_passwd_id=4 */ /** P2P-GO-NEG-REQUEST 42:fc:89:a8:96:09 dev_passwd_id=4 {@hide}*/ public WifiP2pConfig(String supplicantEvent) throws IllegalArgumentException { String[] tokens = supplicantEvent.split(" "); Loading @@ -74,7 +76,7 @@ public class WifiP2pConfig implements Parcelable { } deviceAddress = tokens[1]; wpsConfig = new Wps(); wps = new Wps(); if (tokens.length > 2) { String[] nameVal = tokens[2].split("="); Loading @@ -87,28 +89,29 @@ public class WifiP2pConfig implements Parcelable { //As defined in wps/wps_defs.h switch (devPasswdId) { case 0x00: wpsConfig.setup = Setup.LABEL; wps.setup = Setup.LABEL; break; case 0x01: wpsConfig.setup = Setup.KEYPAD; wps.setup = Setup.KEYPAD; break; case 0x04: wpsConfig.setup = Setup.PBC; wps.setup = Setup.PBC; break; case 0x05: wpsConfig.setup = Setup.DISPLAY; wps.setup = Setup.DISPLAY; break; default: wpsConfig.setup = Setup.PBC; wps.setup = Setup.PBC; break; } } } /** @hide */ public String toString() { StringBuffer sbuf = new StringBuffer(); sbuf.append("\n address: ").append(deviceAddress); sbuf.append("\n wps: ").append(wpsConfig); sbuf.append("\n wps: ").append(wps); sbuf.append("\n groupOwnerIntent: ").append(groupOwnerIntent); sbuf.append("\n persist: ").append(persist.toString()); return sbuf.toString(); Loading @@ -129,7 +132,7 @@ public class WifiP2pConfig implements Parcelable { /** Implement the Parcelable interface {@hide} */ public void writeToParcel(Parcel dest, int flags) { dest.writeString(deviceAddress); dest.writeParcelable(wpsConfig, flags); dest.writeParcelable(wps, flags); dest.writeInt(groupOwnerIntent); dest.writeString(persist.name()); } Loading @@ -140,7 +143,7 @@ public class WifiP2pConfig implements Parcelable { public WifiP2pConfig createFromParcel(Parcel in) { WifiP2pConfig config = new WifiP2pConfig(); config.deviceAddress = in.readString(); config.wpsConfig = (Wps) in.readParcelable(null); config.wps = (Wps) in.readParcelable(null); config.groupOwnerIntent = in.readInt(); config.persist = Persist.valueOf(in.readString()); return config; Loading
wifi/java/android/net/wifi/p2p/WifiP2pDevice.java +41 −15 Original line number Diff line number Diff line Loading @@ -25,17 +25,20 @@ import java.util.regex.Pattern; /** * A class representing a Wi-Fi p2p device * @hide * * {@see WifiP2pManager} */ public class WifiP2pDevice implements Parcelable { private static final String TAG = "WifiP2pDevice"; /** * Device name * The device name is a user friendly string to identify a Wi-Fi p2p device */ public String deviceName; /** * Device MAC address * The device MAC address uniquely identifies a Wi-Fi p2p device */ public String deviceAddress; Loading @@ -46,35 +49,30 @@ public class WifiP2pDevice implements Parcelable { * P2P Interface Address and the group interface will be created with * address as the local address in case of successfully completed * negotiation. * @hide */ public String interfaceAddress; /** * Primary device type * Primary device type identifies the type of device. For example, an application * could filter the devices discovered to only display printers if the purpose is to * enable a printing action from the user. See the Wi-Fi Direct technical specification * for the full list of standard device types supported. */ public String primaryDeviceType; /** * Secondary device type * Secondary device type is an optional attribute that can be provided by a device in * addition to the primary device type. */ public String secondaryDeviceType; // These definitions match the ones in wpa_supplicant /* WPS config methods supported */ private static final int WPS_CONFIG_USBA = 0x0001; private static final int WPS_CONFIG_ETHERNET = 0x0002; private static final int WPS_CONFIG_LABEL = 0x0004; private static final int WPS_CONFIG_DISPLAY = 0x0008; private static final int WPS_CONFIG_EXT_NFC_TOKEN = 0x0010; private static final int WPS_CONFIG_INT_NFC_TOKEN = 0x0020; private static final int WPS_CONFIG_NFC_INTERFACE = 0x0040; private static final int WPS_CONFIG_PUSHBUTTON = 0x0080; private static final int WPS_CONFIG_KEYPAD = 0x0100; private static final int WPS_CONFIG_VIRT_PUSHBUTTON = 0x0280; private static final int WPS_CONFIG_PHY_PUSHBUTTON = 0x0480; private static final int WPS_CONFIG_VIRT_DISPLAY = 0x2008; private static final int WPS_CONFIG_PHY_DISPLAY = 0x4008; /* Device Capability bitmap */ private static final int DEVICE_CAPAB_SERVICE_DISCOVERY = 1; Loading @@ -95,19 +93,23 @@ public class WifiP2pDevice implements Parcelable { /** * WPS config methods supported * @hide */ public int wpsConfigMethodsSupported; /** * Device capability * @hide */ public int deviceCapability; /** * Group capability * @hide */ public int groupCapability; /** Device connection status */ public enum Status { CONNECTED, INVITED, Loading @@ -118,7 +120,7 @@ public class WifiP2pDevice implements Parcelable { public Status status = Status.UNAVAILABLE; public WifiP2pDevice() { WifiP2pDevice() { } /** Loading @@ -144,6 +146,7 @@ public class WifiP2pDevice implements Parcelable { * group_capab=0x0 * * Note: The events formats can be looked up in the wpa_supplicant code * @hide */ public WifiP2pDevice(String string) throws IllegalArgumentException { String[] tokens = string.split(" "); Loading Loading @@ -198,11 +201,33 @@ public class WifiP2pDevice implements Parcelable { } } /** Returns true if WPS push button configuration is supported */ public boolean wpsPbcSupported() { return (wpsConfigMethodsSupported & WPS_CONFIG_PUSHBUTTON) != 0; } /** Returns true if WPS keypad configuration is supported */ public boolean wpsKeypadSupported() { return (wpsConfigMethodsSupported & WPS_CONFIG_KEYPAD) != 0; } /** Returns true if WPS display configuration is supported */ public boolean wpsDisplaySupported() { return (wpsConfigMethodsSupported & WPS_CONFIG_DISPLAY) != 0; } /** Returns true if the device is capable of service discovery */ public boolean isServiceDiscoveryCapable() { return (deviceCapability & DEVICE_CAPAB_SERVICE_DISCOVERY) != 0; } /** Returns true if the device is a group owner */ public boolean isGroupOwner() { return (groupCapability & GROUP_CAPAB_GROUP_OWNER) != 0; } @Override /** @hide */ public boolean equals(Object obj) { if (this == obj) return true; if (!(obj instanceof WifiP2pDevice)) return false; Loading @@ -214,6 +239,7 @@ public class WifiP2pDevice implements Parcelable { return other.deviceAddress.equals(deviceAddress); } /** @hide */ public String toString() { StringBuffer sbuf = new StringBuffer(); sbuf.append("Device: ").append(deviceName); Loading
wifi/java/android/net/wifi/p2p/WifiP2pDeviceList.java +10 −2 Original line number Diff line number Diff line Loading @@ -28,22 +28,25 @@ import java.util.Collections; /** * A class representing a Wi-Fi P2p device list * @hide * * {@see WifiP2pManager} */ public class WifiP2pDeviceList implements Parcelable { private Collection<WifiP2pDevice> mDevices; public WifiP2pDeviceList() { WifiP2pDeviceList() { mDevices = new ArrayList<WifiP2pDevice>(); } //copy constructor /** copy constructor {@hide} */ public WifiP2pDeviceList(WifiP2pDeviceList source) { if (source != null) { mDevices = source.getDeviceList(); } } /** @hide */ public WifiP2pDeviceList(ArrayList<WifiP2pDevice> devices) { mDevices = new ArrayList<WifiP2pDevice>(); for (WifiP2pDevice device : devices) { Loading @@ -51,12 +54,14 @@ public class WifiP2pDeviceList implements Parcelable { } } /** @hide */ public boolean clear() { if (mDevices.isEmpty()) return false; mDevices.clear(); return true; } /** @hide */ public void update(WifiP2pDevice device) { if (device == null) return; for (WifiP2pDevice d : mDevices) { Loading @@ -75,15 +80,18 @@ public class WifiP2pDeviceList implements Parcelable { mDevices.add(device); } /** @hide */ public boolean remove(WifiP2pDevice device) { if (device == null) return false; return mDevices.remove(device); } /** Get the list of devices */ public Collection<WifiP2pDevice> getDeviceList() { return Collections.unmodifiableCollection(mDevices); } /** @hide */ public String toString() { StringBuffer sbuf = new StringBuffer(); for (WifiP2pDevice device : mDevices) { Loading