SSB-14939: wlan_hal changes for Andorid-M

Changes in wlan_hal for builing it for Andorid-M

Change-Id: I884ddb308091308480eaeb221da161829d285056
SCSC-Bug-Id: SSB-14939
Signed-off-by: Debasish Das <d.das@samsung.com>
diff --git a/gscan.cpp b/gscan.cpp
index f9df8a4..2de10a6 100755
--- a/gscan.cpp
+++ b/gscan.cpp
@@ -302,7 +302,7 @@
             return result;

         }

 

-        result = request.put_u32(GSCAN_ATTRIBUTE_REPORT_THRESHOLD, mParams->report_threshold);

+        result = request.put_u32(GSCAN_ATTRIBUTE_REPORT_THRESHOLD, mParams->report_threshold_percent);

         if (result < 0) {

             return result;

         }

@@ -434,7 +434,7 @@
         event.log();

 

         nlattr *vendor_data = event.get_attribute(NL80211_ATTR_VENDOR_DATA);

-        int len = event.get_vendor_data_len();

+        unsigned int len = event.get_vendor_data_len();

         int event_id = event.get_vendor_subcmd();

         ALOGD("handleEvent, event_id = %d", event_id);

 

@@ -531,7 +531,7 @@
 }

 

 class GetScanResultsCommand : public WifiCommand {

-    wifi_scan_result *mResults;

+    wifi_cached_scan_results *mResults;

     int mMax;

     int *mNum;

     int mRetrieved;

@@ -539,7 +539,7 @@
     int mCompleted;

 public:

     GetScanResultsCommand(wifi_interface_handle iface, byte flush,

-            wifi_scan_result *results, int max, int *num)

+            wifi_cached_scan_results *results, int max, int *num)

         : WifiCommand(iface, -1), mResults(results), mMax(max), mNum(num),

                 mRetrieved(0), mFlush(flush), mCompleted(0)

     { }

@@ -652,8 +652,7 @@
 };

 

 wifi_error wifi_get_cached_gscan_results(wifi_interface_handle iface, byte flush,

-        int max, wifi_scan_result *results, int *num) {

-

+        int max, wifi_cached_scan_results *results, int *num) {

     ALOGD("Getting cached scan results, iface handle = %p, num = %d", iface, *num);

 

     GetScanResultsCommand *cmd = new GetScanResultsCommand(iface, flush, results, max, num);

@@ -689,7 +688,7 @@
         }

 

         struct nlattr * attr = request.attr_start(GSCAN_ATTRIBUTE_HOTLIST_BSSIDS);

-        for (int i = 0; i < mParams.num_ap; i++) {

+        for (int i = 0; i < mParams.num_bssid; i++) {

             nlattr *attr2 = request.attr_start(GSCAN_ATTRIBUTE_HOTLIST_ELEM);

             if (attr2 == NULL) {

                 return WIFI_ERROR_OUT_OF_MEMORY;

@@ -706,10 +705,6 @@
             if (result < 0) {

                 return result;

             }

-            result = request.put_u16(GSCAN_ATTRIBUTE_CHANNEL_NUMBER, mParams.ap[i].channel);

-            if (result < 0) {

-                return result;

-            }

             request.attr_end(attr2);

         }

 

@@ -728,7 +723,7 @@
     }

 

     int start() {

-        ALOGD("Executing hotlist setup request, num = %d", mParams.num_ap);

+        ALOGD("Executing hotlist setup request, num = %d", mParams.num_bssid);

         WifiRequest request(familyId(), ifaceId());

         int result = createSetupRequest(request);

         if (result < 0) {

@@ -743,7 +738,7 @@
             return result;

         }

 

-        ALOGD("Successfully set %d APs in the hotlist", mParams.num_ap);

+        ALOGD("Successfully set %d APs in the hotlist", mParams.num_bssid);

 

         registerVendorHandler(GOOGLE_OUI, GSCAN_EVENT_HOTLIST_RESULTS_FOUND);

         registerVendorHandler(GOOGLE_OUI, GSCAN_EVENT_HOTLIST_RESULTS_LOST);

@@ -879,7 +874,7 @@
 

         struct nlattr * attr = request.attr_start(GSCAN_ATTRIBUTE_SIGNIFICANT_CHANGE_BSSIDS);

 

-        for (int i = 0; i < mParams.num_ap; i++) {

+        for (int i = 0; i < mParams.num_bssid; i++) {

 

             nlattr *attr2 = request.attr_start(i);

             if (attr2 == NULL) {

@@ -897,10 +892,6 @@
             if (result < 0) {

                 return result;

             }

-            result = request.put_u16(GSCAN_ATTRIBUTE_CHANNEL, mParams.ap[i].channel);

-            if (result < 0) {

-                return result;

-            }

             request.attr_end(attr2);

         }

 

@@ -978,7 +969,7 @@
         typedef struct {

             uint16_t channel;

             mac_addr bssid;

-            s16 rssi_history[8];

+            int16_t rssi_history[8];

         } ChangeInfo;

 

         int num = min(len / sizeof(ChangeInfo), MAX_RESULTS);

diff --git a/wifi_hal.cpp b/wifi_hal.cpp
index ad7cf79..837119a 100755
--- a/wifi_hal.cpp
+++ b/wifi_hal.cpp
@@ -93,6 +93,37 @@
     return sock;

 }

 

+/*initialize function pointer table with Broadcom HHAL API*/

+wifi_error init_wifi_vendor_hal_func_table(wifi_hal_fn *fn)

+{

+    if (fn == NULL) {

+        return WIFI_ERROR_UNKNOWN;

+    }

+    fn->wifi_initialize = wifi_initialize;

+    fn->wifi_cleanup = wifi_cleanup;

+    fn->wifi_event_loop = wifi_event_loop;

+    fn->wifi_get_supported_feature_set = wifi_get_supported_feature_set;

+    fn->wifi_get_concurrency_matrix = wifi_get_concurrency_matrix;

+    fn->wifi_set_scanning_mac_oui =  wifi_set_scanning_mac_oui;

+    fn->wifi_get_ifaces = wifi_get_ifaces;

+    fn->wifi_get_iface_name = wifi_get_iface_name;

+    fn->wifi_start_gscan = wifi_start_gscan;

+    fn->wifi_stop_gscan = wifi_stop_gscan;

+    fn->wifi_get_cached_gscan_results = wifi_get_cached_gscan_results;

+    fn->wifi_set_bssid_hotlist = wifi_set_bssid_hotlist;

+    fn->wifi_reset_bssid_hotlist = wifi_reset_bssid_hotlist;

+    fn->wifi_set_significant_change_handler = wifi_set_significant_change_handler;

+    fn->wifi_reset_significant_change_handler = wifi_reset_significant_change_handler;

+    fn->wifi_get_gscan_capabilities = wifi_get_gscan_capabilities;

+    fn->wifi_get_link_stats = wifi_get_link_stats;

+    fn->wifi_get_valid_channels = wifi_get_valid_channels;

+    fn->wifi_rtt_range_request = wifi_rtt_range_request;

+    fn->wifi_rtt_range_cancel = wifi_rtt_range_cancel;

+    fn->wifi_get_rtt_capabilities = wifi_get_rtt_capabilities;

+    fn->wifi_set_nodfs_flag = wifi_set_nodfs_flag;

+    return WIFI_SUCCESS;

+}

+

 wifi_error wifi_initialize(wifi_handle *handle)

 {

     srand(getpid());