summaryrefslogtreecommitdiffstats
path: root/wifi/java/android/net/wifi/ScanResult.java
diff options
context:
space:
mode:
authorIrfan Sheriff <isheriff@google.com>2012-09-05 10:46:24 -0700
committerIrfan Sheriff <isheriff@google.com>2012-09-11 10:50:04 -0700
commitb6deeed3ceff9e0f754697987b7c724901996082 (patch)
tree790b652af7de47429fc4a92d1680d01b57a92269 /wifi/java/android/net/wifi/ScanResult.java
parent799553e02aa3350397d723982d42198a5bab774c (diff)
downloadframeworks_base-b6deeed3ceff9e0f754697987b7c724901996082.zip
frameworks_base-b6deeed3ceff9e0f754697987b7c724901996082.tar.gz
frameworks_base-b6deeed3ceff9e0f754697987b7c724901996082.tar.bz2
Handle ascii encoded SSID
Supplicant now passes as an ascii encoded string that allows it to pass any sequence of bytes for a SSID. see src/utils/common.c in supplicant for details of the implementation. We create a SSID structure WifiSsid in framework to store the ssid and handle the conversion appropriately when required for printing and for an application. At this point, we still do not handle non-printable octets from an application perspective for connectivity Bug: 7110903 Change-Id: I520e5ee23baed4867b8b408bbb3eda5c9e92b6bf
Diffstat (limited to 'wifi/java/android/net/wifi/ScanResult.java')
-rw-r--r--wifi/java/android/net/wifi/ScanResult.java35
1 files changed, 23 insertions, 12 deletions
diff --git a/wifi/java/android/net/wifi/ScanResult.java b/wifi/java/android/net/wifi/ScanResult.java
index 3e20756..9977419 100644
--- a/wifi/java/android/net/wifi/ScanResult.java
+++ b/wifi/java/android/net/wifi/ScanResult.java
@@ -28,6 +28,10 @@ import android.os.Parcel;
public class ScanResult implements Parcelable {
/** The network name. */
public String SSID;
+
+ /** Ascii encoded SSID. This will replace SSID when we deprecate it. @hide */
+ public WifiSsid wifiSsid;
+
/** The address of the access point. */
public String BSSID;
/**
@@ -52,15 +56,11 @@ public class ScanResult implements Parcelable {
*/
public long timestamp;
- /**
- * We'd like to obtain the following attributes,
- * but they are not reported via the socket
- * interface, even though they are known
- * internally by wpa_supplicant.
- * {@hide}
- */
- public ScanResult(String SSID, String BSSID, String caps, int level, int frequency, long tsf) {
- this.SSID = SSID;
+ /** {@hide} */
+ public ScanResult(WifiSsid wifiSsid, String BSSID, String caps, int level, int frequency,
+ long tsf) {
+ this.wifiSsid = wifiSsid;
+ this.SSID = (wifiSsid != null) ? wifiSsid.toString() : WifiSsid.NONE;
this.BSSID = BSSID;
this.capabilities = caps;
this.level = level;
@@ -68,9 +68,11 @@ public class ScanResult implements Parcelable {
this.timestamp = tsf;
}
+
/** copy constructor {@hide} */
public ScanResult(ScanResult source) {
if (source != null) {
+ wifiSsid = source.wifiSsid;
SSID = source.SSID;
BSSID = source.BSSID;
capabilities = source.capabilities;
@@ -86,7 +88,7 @@ public class ScanResult implements Parcelable {
String none = "<none>";
sb.append("SSID: ").
- append(SSID == null ? none : SSID).
+ append(wifiSsid == null ? WifiSsid.NONE : wifiSsid).
append(", BSSID: ").
append(BSSID == null ? none : BSSID).
append(", capabilities: ").
@@ -108,7 +110,12 @@ public class ScanResult implements Parcelable {
/** Implement the Parcelable interface {@hide} */
public void writeToParcel(Parcel dest, int flags) {
- dest.writeString(SSID);
+ if (wifiSsid != null) {
+ dest.writeInt(1);
+ wifiSsid.writeToParcel(dest, flags);
+ } else {
+ dest.writeInt(0);
+ }
dest.writeString(BSSID);
dest.writeString(capabilities);
dest.writeInt(level);
@@ -120,8 +127,12 @@ public class ScanResult implements Parcelable {
public static final Creator<ScanResult> CREATOR =
new Creator<ScanResult>() {
public ScanResult createFromParcel(Parcel in) {
+ WifiSsid wifiSsid = null;
+ if (in.readInt() == 1) {
+ wifiSsid = WifiSsid.CREATOR.createFromParcel(in);
+ }
return new ScanResult(
- in.readString(),
+ wifiSsid,
in.readString(),
in.readString(),
in.readInt(),