Add test case for BSSID hotlist and fix wifi scanner test cases

For the BSSID hotlist testing config file should have dependencies
information such as interest Bssids to be tracked for 2g, 5g and DFS
and test bed information as per sample bssidhotlist.config file.
BSSIDs set for tracking should be part of the shield box which is
connected throgh second attenuator listed in config file.

For wifi scanner, "isolated environment test" is included. In this test
scripts will attenuate both attenuator to 90db and make isolated environment
for device. Before running this test make sure that attenuators
information is provided in config file

Change-Id: Ic132f24b996475b7b9181ee2e580b36d899cb446
diff --git a/Common/src/com/googlecode/android_scripting/facade/wifi/WifiScannerFacade.java b/Common/src/com/googlecode/android_scripting/facade/wifi/WifiScannerFacade.java
index bc54c99..2875652 100644
--- a/Common/src/com/googlecode/android_scripting/facade/wifi/WifiScannerFacade.java
+++ b/Common/src/com/googlecode/android_scripting/facade/wifi/WifiScannerFacade.java
@@ -331,14 +331,20 @@
         return result;
     }
 
-    private BssidInfo parseBssidInfo(String info) throws JSONException {
-        JSONObject bi = new JSONObject(info);
-        BssidInfo bssidInfo = new BssidInfo();
-        bssidInfo.bssid = bi.getString("bssid");
-        bssidInfo.high = bi.getInt("high");
-        bssidInfo.low = bi.getInt("low");
-        bssidInfo.frequencyHint = bi.getInt("frequencyHint");
-        return bssidInfo;
+    private BssidInfo[] parseBssidInfo(JSONArray jBssids) throws JSONException {
+        BssidInfo[] bssids = new BssidInfo[jBssids.length()];
+        for (int i = 0; i < bssids.length; i++) {
+              JSONObject bi = (JSONObject)jBssids.get(i);
+              BssidInfo bssidInfo = new BssidInfo();
+              bssidInfo.bssid = bi.getString("BSSID");
+              bssidInfo.high = bi.getInt("high");
+              bssidInfo.low = bi.getInt("low");
+              if (bi.has("frequencyHint")) {
+                bssidInfo.frequencyHint = bi.getInt("frequencyHint");
+              }
+              bssids[i] = bssidInfo;
+          }
+        return bssids;
     }
 
     /**
@@ -469,15 +475,11 @@
      */
     @Rpc(description = "Starts tracking changes of the specified bssids.")
     public Integer wifiScannerStartTrackingBssids(
-            @RpcParameter(name = "bssidInfos") String[] bssidInfos,
-            @RpcParameter(name = "apLostThreshold") Integer apLostThreshold
-            ) throws JSONException {
-        BssidInfo[] infos = new BssidInfo[bssidInfos.length];
-        for (int i = 0; i < bssidInfos.length; i++) {
-            infos[i] = parseBssidInfo(bssidInfos[i]);
-        }
+            @RpcParameter(name = "bssidInfos") JSONArray  bssidInfos,
+            @RpcParameter(name = "apLostThreshold") Integer  apLostThreshold)throws JSONException {
+        BssidInfo[] bssids = parseBssidInfo(bssidInfos);
         WifiBssidListener listener = genWifiBssidListener();
-        mScan.startTrackingBssids(infos, apLostThreshold, listener);
+        mScan.startTrackingBssids(bssids, apLostThreshold, listener);
         return listener.mIndex;
     }
 
@@ -543,39 +545,6 @@
     }
 
     /**
-     * Starts tracking changes of the wifi networks specified in a list of bssid
-     *
-     * @param bssidInfos a list specifying which wifi networks to track
-     * @param apLostThreshold signal strength below which an AP is considered lost
-     * @return the id of the bssid listener associated with this track
-     * @throws Exception
-     */
-    @Rpc(description = "Starts tracking changes in the APs specified by the list")
-    public Integer startTrackingBssid(String[] bssidInfos, Integer apLostThreshold)
-            throws Exception {
-        // Instantiates BssidInfo objs
-        BssidInfo[] mBssidInfos = new BssidInfo[bssidInfos.length];
-        for (int i = 0; i < bssidInfos.length; i++) {
-            Log.d("android_scripting " + bssidInfos[i]);
-            String[] tokens = bssidInfos[i].split(" ");
-            if (tokens.length != 3) {
-                throw new Exception("Invalid bssid info: " + bssidInfos[i]);
-
-            }
-            int a = Integer.parseInt(tokens[1]);
-            int b = Integer.parseInt(tokens[2]);
-            BssidInfo mBI = new BssidInfo();
-            mBI.bssid = tokens[0];
-            mBI.low = a < b ? a : b;
-            mBI.high = a < b ? b : a;
-            mBssidInfos[i] = mBI;
-        }
-        WifiBssidListener mWHL = genWifiBssidListener();
-        mScan.startTrackingBssids(mBssidInfos, apLostThreshold, mWHL);
-        return mWHL.mIndex;
-    }
-
-    /**
      * Shuts down all activities associated with WifiScanner
      */
     @Rpc(description = "Shuts down all WifiScanner activities and remove listeners.")