SSB-11315 include channel in significant change
authorJaya Prakash Sangaru <j.sangaru@samsung.com>
Tue, 15 Dec 2015 04:49:44 +0000 (10:19 +0530)
committerTarun Karela <t.karela@samsung.com>
Mon, 4 Jun 2018 09:40:47 +0000 (10:40 +0100)
significant change requires proper channel in significant change request.

SCSC-Bug-Id: SSB-11315

Change-Id: I97ae4d807b127af3442668689c08a0ac4060da8e
Signed-off-by: Jaya Prakash Sangaru <j.sangaru@samsung.com>
gscan.cpp

index 3da86961115e83c33b5a016122ee94b1347dd6a7..f9df8a4423851af988a27e437507f48a6efc6c7f 100755 (executable)
--- a/gscan.cpp
+++ b/gscan.cpp
@@ -436,7 +436,7 @@ public:
         nlattr *vendor_data = event.get_attribute(NL80211_ATTR_VENDOR_DATA);\r
         int len = event.get_vendor_data_len();\r
         int event_id = event.get_vendor_subcmd();\r
-        ALOGD("handleEvent, event_id = %d", event_id);\r
+        ALOGD("handleEvent, event_id = %d", event_id);\r
 \r
         if(event_id == GSCAN_EVENT_COMPLETE_SCAN) {\r
             if (vendor_data == NULL || len != 4) {\r
@@ -706,7 +706,7 @@ public:
             if (result < 0) {\r
                 return result;\r
             }\r
-            result = request.put_u8(GSCAN_ATTRIBUTE_CHANNEL_NUMBER, mParams.ap[i].channel);\r
+            result = request.put_u16(GSCAN_ATTRIBUTE_CHANNEL_NUMBER, mParams.ap[i].channel);\r
             if (result < 0) {\r
                 return result;\r
             }\r
@@ -745,24 +745,9 @@ public:
 \r
         ALOGD("Successfully set %d APs in the hotlist", mParams.num_ap);\r
 \r
-        result = createFeatureRequest(request, SLSI_NL80211_VENDOR_SUBCMD_ADD_GSCAN);\r
-        if (result < 0) {\r
-            return result;\r
-        }\r
-\r
         registerVendorHandler(GOOGLE_OUI, GSCAN_EVENT_HOTLIST_RESULTS_FOUND);\r
         registerVendorHandler(GOOGLE_OUI, GSCAN_EVENT_HOTLIST_RESULTS_LOST);\r
 \r
-        result = requestResponse(request);\r
-        if (result != WIFI_SUCCESS) {\r
-            ALOGE("failed to start scan; result = %d", result);\r
-            unregisterVendorHandler(GOOGLE_OUI, GSCAN_EVENT_HOTLIST_RESULTS_FOUND);\r
-            unregisterVendorHandler(GOOGLE_OUI, GSCAN_EVENT_HOTLIST_RESULTS_LOST);\r
-            return result;\r
-        }\r
-\r
-        ALOGD("successfully restarted the scan");\r
-\r
         return result;\r
     }\r
 \r
@@ -912,6 +897,10 @@ public:
             if (result < 0) {\r
                 return result;\r
             }\r
+            result = request.put_u16(GSCAN_ATTRIBUTE_CHANNEL, mParams.ap[i].channel);\r
+            if (result < 0) {\r
+                return result;\r
+            }\r
             request.attr_end(attr2);\r
         }\r
 \r
@@ -944,21 +933,8 @@ public:
             ALOGD("failed to set significant wifi change %d", result);\r
             return result;\r
         }\r
-\r
-        result = createFeatureRequest(request, SLSI_NL80211_VENDOR_SUBCMD_ADD_GSCAN);\r
-        if (result < 0) {\r
-            return result;\r
-        }\r
-\r
         registerVendorHandler(GOOGLE_OUI, GSCAN_EVENT_SIGNIFICANT_CHANGE_RESULTS);\r
 \r
-        result = requestResponse(request);\r
-        if (result < 0) {\r
-            unregisterVendorHandler(GOOGLE_OUI, GSCAN_EVENT_SIGNIFICANT_CHANGE_RESULTS);\r
-            return result;\r
-        }\r
-\r
-        ALOGD("successfully restarted the scan");\r
         return result;\r
     }\r
 \r
@@ -1011,9 +987,17 @@ public:
         for (int i = 0; i < num; i++) {\r
             memcpy(mResultsBuffer[i].bssid, ci[i].bssid, sizeof(mac_addr));\r
             mResultsBuffer[i].channel = ci[i].channel;\r
-            mResultsBuffer[i].num_rssi = 8;\r
-            for (int j = 0; j < mResultsBuffer[i].num_rssi; j++)\r
+                       /* Driver sends N samples and the rest 8-N are filled 0x7FFF\r
+                        * N = no of rssi samples to average sent in significant change request. */\r
+            int num_rssi = 0;\r
+            for (int j = 0; j < 8; j++) {\r
+                if (ci[i].rssi_history[j] == 0x7FFF) {\r
+                    num_rssi = j;\r
+                    break;\r
+                }\r
                 mResultsBuffer[i].rssi[j] = (int) ci[i].rssi_history[j];\r
+            }\r
+            mResultsBuffer[i].num_rssi = num_rssi;\r
             mResults[i] = reinterpret_cast<wifi_significant_change_result *>(&(mResultsBuffer[i]));\r
         }\r
 \r