[APR-1563][9610]wlbt: Hal changes for Fapi 7.
authorHimani Gupta <himani.g2@samsung.com>
Wed, 8 May 2019 07:00:53 +0000 (12:30 +0530)
committerKim Gunho <gunho.kim@samsung.com>
Mon, 9 Sep 2019 08:01:03 +0000 (17:01 +0900)
Cleanup required for set/reset hotlist bssid and significant
change bssid.Modified RTT results in accordance with fapi.

Change-Id: I772ca9c3d697a2bb1796ba4ab896e703917906fe
SCSC-Bug-Id: SSB-52297
Signed-off-by: Himani Gupta <himani.g2@samsung.com>
common.h
gscan.cpp
rtt.cpp
wifi_hal.cpp

index 7f270a35e0d177a3434357bff619d419063b83cc..a8cf93749fead75b97bf5d712890aaa4679c8394 100755 (executable)
--- a/common.h
+++ b/common.h
@@ -61,25 +61,6 @@ typedef enum {
     GSCAN_ATTRIBUTE_SCAN_FLAGS,
     GSCAN_ATTRIBUTE_SCAN_BUCKET_BIT,
 
-    /* remaining reserved for additional attributes */
-
-    GSCAN_ATTRIBUTE_SSID = 40,
-    GSCAN_ATTRIBUTE_BSSID,
-    GSCAN_ATTRIBUTE_CHANNEL,
-    GSCAN_ATTRIBUTE_RSSI,
-    GSCAN_ATTRIBUTE_TIMESTAMP,
-    GSCAN_ATTRIBUTE_RTT,
-    GSCAN_ATTRIBUTE_RTTSD,
-
-    /* remaining reserved for additional attributes */
-
-    GSCAN_ATTRIBUTE_HOTLIST_BSSIDS = 50,
-    GSCAN_ATTRIBUTE_RSSI_LOW,
-    GSCAN_ATTRIBUTE_RSSI_HIGH,
-    GSCAN_ATTRIBUTE_HOTLIST_ELEM,
-    GSCAN_ATTRIBUTE_HOTLIST_FLUSH,
-    GSCAN_ATTRIBUTE_CHANNEL_NUMBER,
-
     /* remaining reserved for additional attributes */
     GSCAN_ATTRIBUTE_RSSI_SAMPLE_SIZE = 60,
     GSCAN_ATTRIBUTE_LOST_AP_SAMPLE_SIZE,
@@ -147,11 +128,6 @@ typedef enum {
     SLSI_NL80211_VENDOR_SUBCMD_ADD_GSCAN,
     SLSI_NL80211_VENDOR_SUBCMD_DEL_GSCAN,
     SLSI_NL80211_VENDOR_SUBCMD_GET_SCAN_RESULTS,
-    SLSI_NL80211_VENDOR_SUBCMD_SET_BSSID_HOTLIST,
-    SLSI_NL80211_VENDOR_SUBCMD_RESET_BSSID_HOTLIST,
-    SLSI_NL80211_VENDOR_SUBCMD_GET_HOTLIST_RESULTS,
-    SLSI_NL80211_VENDOR_SUBCMD_SET_SIGNIFICANT_CHANGE,
-    SLSI_NL80211_VENDOR_SUBCMD_RESET_SIGNIFICANT_CHANGE,
     SLSI_NL80211_VENDOR_SUBCMD_SET_GSCAN_OUI,
     SLSI_NL80211_VENDOR_SUBCMD_SET_NODFS,
     SLSI_NL80211_VENDOR_SUBCMD_START_KEEP_ALIVE_OFFLOAD,
@@ -185,12 +161,9 @@ typedef enum {
 } WIFI_SUB_COMMAND;
 
 typedef enum {
-    GSCAN_EVENT_SIGNIFICANT_CHANGE_RESULTS ,
-    GSCAN_EVENT_HOTLIST_RESULTS_FOUND,
     GSCAN_EVENT_SCAN_RESULTS_AVAILABLE,
     GSCAN_EVENT_FULL_SCAN_RESULTS,
     GSCAN_EVENT_COMPLETE_SCAN,
-    GSCAN_EVENT_HOTLIST_RESULTS_LOST,
     WIFI_SUBCMD_KEY_MGMT_ROAM_AUTH, /* Handled by supplicant. not in Wifi-HAL */
     WIFI_HANGED_EVENT,
     WIFI_EPNO_EVENT,
@@ -209,7 +182,8 @@ typedef enum {
     SLSI_NAN_EVENT_DISABLED,
     /* NAN events end */
     SLSI_RTT_RESULT_EVENT,
-    SLSI_RTT_EVENT_COMPLETE
+    SLSI_RTT_EVENT_COMPLETE,
+    WIFI_ACS_EVENT            /* Handled by supplicant. not in Wifi-HAL */
 
 } WIFI_EVENT;
 
index 89d6dd6e4ace3b88b39f2a4ac14c8d783f47f813..e3227e1b47a601210676d4d23b0aafb6b06406bd 100755 (executable)
--- a/gscan.cpp
+++ b/gscan.cpp
@@ -642,368 +642,6 @@ wifi_error wifi_get_cached_gscan_results(wifi_interface_handle iface, byte flush
 }
 
 /////////////////////////////////////////////////////////////////////////////
-
-class BssidHotlistCommand : public WifiCommand
-{
-private:
-    wifi_bssid_hotlist_params mParams;
-    wifi_hotlist_ap_found_handler mHandler;
-    static const int MAX_RESULTS = 64;
-    wifi_scan_result mResults[MAX_RESULTS];
-public:
-    BssidHotlistCommand(wifi_interface_handle handle, int id,
-            wifi_bssid_hotlist_params params, wifi_hotlist_ap_found_handler handler)
-        : WifiCommand(handle, id), mParams(params), mHandler(handler)
-    {
-            memset(mResults, 0, sizeof(mResults));
-    }
-
-    int createSetupRequest(WifiRequest& request) {
-        int result = request.create(GOOGLE_OUI, SLSI_NL80211_VENDOR_SUBCMD_SET_BSSID_HOTLIST);
-        if (result < 0) {
-            return result;
-        }
-
-        nlattr *data = request.attr_start(NL80211_ATTR_VENDOR_DATA);
-
-        result = request.put_u32(GSCAN_ATTRIBUTE_LOST_AP_SAMPLE_SIZE, mParams.lost_ap_sample_size);
-        if (result < 0) {
-            return result;
-        }
-
-        struct nlattr * attr = request.attr_start(GSCAN_ATTRIBUTE_HOTLIST_BSSIDS);
-        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;
-            }
-            result = request.put_addr(GSCAN_ATTRIBUTE_BSSID, mParams.ap[i].bssid);
-            if (result < 0) {
-                return result;
-            }
-            result = request.put_u8(GSCAN_ATTRIBUTE_RSSI_HIGH, mParams.ap[i].high);
-            if (result < 0) {
-                return result;
-            }
-            result = request.put_u8(GSCAN_ATTRIBUTE_RSSI_LOW, mParams.ap[i].low);
-            if (result < 0) {
-                return result;
-            }
-            request.attr_end(attr2);
-        }
-
-        request.attr_end(attr);
-        request.attr_end(data);
-        return result;
-    }
-
-    int createTeardownRequest(WifiRequest& request) {
-        int result = request.create(GOOGLE_OUI, SLSI_NL80211_VENDOR_SUBCMD_RESET_BSSID_HOTLIST);
-        if (result < 0) {
-            return result;
-        }
-
-        return result;
-    }
-
-    int start() {
-        WifiRequest request(familyId(), ifaceId());
-        int result = createSetupRequest(request);
-        if (result < 0) {
-            return result;
-        }
-
-        result = requestResponse(request);
-        if (result < 0) {
-            ALOGE("Failed to execute hotlist setup request, result = %d", result);
-            unregisterVendorHandler(GOOGLE_OUI, GSCAN_EVENT_HOTLIST_RESULTS_FOUND);
-            unregisterVendorHandler(GOOGLE_OUI, GSCAN_EVENT_HOTLIST_RESULTS_LOST);
-            return result;
-        }
-
-        registerVendorHandler(GOOGLE_OUI, GSCAN_EVENT_HOTLIST_RESULTS_FOUND);
-        registerVendorHandler(GOOGLE_OUI, GSCAN_EVENT_HOTLIST_RESULTS_LOST);
-
-        return result;
-    }
-
-    virtual int cancel() {
-        /* unregister event handler */
-        unregisterVendorHandler(GOOGLE_OUI, GSCAN_EVENT_HOTLIST_RESULTS_FOUND);
-        unregisterVendorHandler(GOOGLE_OUI, GSCAN_EVENT_HOTLIST_RESULTS_LOST);
-        /* create set hotlist message with empty hotlist */
-        WifiRequest request(familyId(), ifaceId());
-        int result = createTeardownRequest(request);
-        if (result < 0) {
-            return result;
-        }
-
-        result = requestResponse(request);
-        if (result < 0) {
-            return result;
-        }
-
-        return result;
-    }
-
-    virtual int handleResponse(WifiEvent& reply) {
-        /* Nothing to do on response! */
-        return NL_SKIP;
-    }
-
-    virtual int handleEvent(WifiEvent& event) {
-        int event_id = event.get_vendor_subcmd();
-        //event.log();
-
-        nlattr *vendor_data = event.get_attribute(NL80211_ATTR_VENDOR_DATA);
-        int len = event.get_vendor_data_len();
-
-        if (vendor_data == NULL || len == 0) {
-            ALOGE("No scan results found");
-            return NL_SKIP;
-        }
-
-
-        int num = len / sizeof(wifi_scan_result);
-        num = min(MAX_RESULTS, num);
-        memcpy(mResults, event.get_vendor_data(), num * sizeof(wifi_scan_result));
-
-        if (event_id == GSCAN_EVENT_HOTLIST_RESULTS_FOUND) {
-            ALOGD("FOUND %d hotlist APs", num);
-            if (*mHandler.on_hotlist_ap_found)
-                (*mHandler.on_hotlist_ap_found)(id(), num, mResults);
-        } else if (event_id == GSCAN_EVENT_HOTLIST_RESULTS_LOST) {
-            ALOGD("LOST %d hotlist APs", num);
-            if (*mHandler.on_hotlist_ap_lost)
-                (*mHandler.on_hotlist_ap_lost)(id(), num, mResults);
-        }
-        return NL_SKIP;
-    }
-};
-
-wifi_error wifi_set_bssid_hotlist(wifi_request_id id, wifi_interface_handle iface,
-        wifi_bssid_hotlist_params params, wifi_hotlist_ap_found_handler handler)
-{
-    wifi_handle handle = getWifiHandle(iface);
-
-    BssidHotlistCommand *cmd = new BssidHotlistCommand(iface, id, params, handler);
-    wifi_register_cmd(handle, id, cmd);
-    return (wifi_error)cmd->start();
-}
-
-wifi_error wifi_reset_bssid_hotlist(wifi_request_id id, wifi_interface_handle iface)
-{
-    wifi_handle handle = getWifiHandle(iface);
-
-    WifiCommand *cmd = wifi_unregister_cmd(handle, id);
-    if (cmd) {
-        cmd->cancel();
-        cmd->releaseRef();
-        return WIFI_SUCCESS;
-    }
-
-    return WIFI_ERROR_INVALID_ARGS;
-}
-
-
-/////////////////////////////////////////////////////////////////////////////
-
-class SignificantWifiChangeCommand : public WifiCommand
-{
-    typedef struct {
-        mac_addr bssid;                     // BSSID
-        wifi_channel channel;               // channel frequency in MHz
-        int num_rssi;                       // number of rssi samples
-        wifi_rssi rssi[8];                   // RSSI history in db
-    } wifi_significant_change_result_internal;
-
-private:
-    wifi_significant_change_params mParams;
-    wifi_significant_change_handler mHandler;
-    static const int MAX_RESULTS = 64;
-    wifi_significant_change_result_internal mResultsBuffer[MAX_RESULTS];
-    wifi_significant_change_result *mResults[MAX_RESULTS];
-public:
-    SignificantWifiChangeCommand(wifi_interface_handle handle, int id,
-            wifi_significant_change_params params, wifi_significant_change_handler handler)
-        : WifiCommand(handle, id), mParams(params), mHandler(handler)
-    {
-        memset(mResultsBuffer,0,sizeof(mResultsBuffer));
-        memset(mResults,0,sizeof(mResults));
-    }
-
-    int createSetupRequest(WifiRequest& request) {
-        int result = request.create(GOOGLE_OUI, SLSI_NL80211_VENDOR_SUBCMD_SET_SIGNIFICANT_CHANGE);
-        if (result < 0) {
-            return result;
-        }
-
-        nlattr *data = request.attr_start(NL80211_ATTR_VENDOR_DATA);
-
-        result = request.put_u16(GSCAN_ATTRIBUTE_RSSI_SAMPLE_SIZE, mParams.rssi_sample_size);
-        if (result < 0) {
-            return result;
-        }
-        result = request.put_u16(GSCAN_ATTRIBUTE_LOST_AP_SAMPLE_SIZE, mParams.lost_ap_sample_size);
-        if (result < 0) {
-            return result;
-        }
-        result = request.put_u16(GSCAN_ATTRIBUTE_MIN_BREACHING, mParams.min_breaching);
-        if (result < 0) {
-            return result;
-        }
-
-        struct nlattr * attr = request.attr_start(GSCAN_ATTRIBUTE_SIGNIFICANT_CHANGE_BSSIDS);
-
-        for (int i = 0; i < mParams.num_bssid; i++) {
-
-            nlattr *attr2 = request.attr_start(i);
-            if (attr2 == NULL) {
-                return WIFI_ERROR_OUT_OF_MEMORY;
-            }
-            result = request.put_addr(GSCAN_ATTRIBUTE_BSSID, mParams.ap[i].bssid);
-            if (result < 0) {
-                return result;
-            }
-            result = request.put_u8(GSCAN_ATTRIBUTE_RSSI_HIGH, mParams.ap[i].high);
-            if (result < 0) {
-                return result;
-            }
-            result = request.put_u8(GSCAN_ATTRIBUTE_RSSI_LOW, mParams.ap[i].low);
-            if (result < 0) {
-                return result;
-            }
-            request.attr_end(attr2);
-        }
-
-        request.attr_end(attr);
-        request.attr_end(data);
-
-        return result;
-    }
-
-    int createTeardownRequest(WifiRequest& request) {
-        int result = request.create(GOOGLE_OUI, SLSI_NL80211_VENDOR_SUBCMD_RESET_SIGNIFICANT_CHANGE);
-        if (result < 0) {
-            return result;
-        }
-
-        return result;
-    }
-
-    int start() {
-        WifiRequest request(familyId(), ifaceId());
-
-        int result = createSetupRequest(request);
-        if (result < 0) {
-            return result;
-        }
-
-        result = requestResponse(request);
-        if (result < 0) {
-            ALOGE("failed to set significant wifi change %d", result);
-            return result;
-        }
-        registerVendorHandler(GOOGLE_OUI, GSCAN_EVENT_SIGNIFICANT_CHANGE_RESULTS);
-
-        return result;
-    }
-
-    virtual int cancel() {
-        /* unregister event handler */
-        unregisterVendorHandler(GOOGLE_OUI, GSCAN_EVENT_SIGNIFICANT_CHANGE_RESULTS);
-
-        /* create set significant change monitor message with empty hotlist */
-        WifiRequest request(familyId(), ifaceId());
-
-        int result = createTeardownRequest(request);
-        if (result < 0) {
-            return result;
-        }
-
-        result = requestResponse(request);
-        if (result < 0) {
-            return result;
-        }
-
-        return result;
-    }
-
-    virtual int handleResponse(WifiEvent& reply) {
-        /* Nothing to do on response! */
-        return NL_SKIP;
-    }
-
-    virtual int handleEvent(WifiEvent& event) {
-        nlattr *vendor_data = event.get_attribute(NL80211_ATTR_VENDOR_DATA);
-        int len = event.get_vendor_data_len();
-
-        if (vendor_data == NULL || len == 0) {
-            ALOGE("No scan results found");
-            return NL_SKIP;
-        }
-
-        typedef struct {
-            uint16_t channel;
-            mac_addr bssid;
-            int16_t rssi_history[8];
-        } ChangeInfo;
-
-        int num = min(len / sizeof(ChangeInfo), MAX_RESULTS);
-        ChangeInfo *ci = (ChangeInfo *)event.get_vendor_data();
-
-        for (int i = 0; i < num; i++) {
-            memcpy(mResultsBuffer[i].bssid, ci[i].bssid, sizeof(mac_addr));
-            mResultsBuffer[i].channel = ci[i].channel;
-            /* Driver sends N samples and the rest 8-N are filled 0x7FFF
-             * N = no of rssi samples to average sent in significant change request. */
-            int num_rssi = 0;
-            for (int j = 0; j < 8; j++) {
-                if (ci[i].rssi_history[j] == 0x7FFF) {
-                    num_rssi = j;
-                    break;
-                }
-                mResultsBuffer[i].rssi[j] = (int) ci[i].rssi_history[j];
-            }
-            mResultsBuffer[i].num_rssi = num_rssi;
-            mResults[i] = reinterpret_cast<wifi_significant_change_result *>(&(mResultsBuffer[i]));
-        }
-
-        if (num != 0) {
-            (*mHandler.on_significant_change)(id(), num, mResults);
-        } else {
-            ALOGW("No significant change reported");
-        }
-
-        return NL_SKIP;
-    }
-};
-
-wifi_error wifi_set_significant_change_handler(wifi_request_id id, wifi_interface_handle iface,
-        wifi_significant_change_params params, wifi_significant_change_handler handler)
-{
-    wifi_handle handle = getWifiHandle(iface);
-
-    SignificantWifiChangeCommand *cmd = new SignificantWifiChangeCommand(
-            iface, id, params, handler);
-    wifi_register_cmd(handle, id, cmd);
-    return (wifi_error)cmd->start();
-}
-
-wifi_error wifi_reset_significant_change_handler(wifi_request_id id, wifi_interface_handle iface)
-{
-    wifi_handle handle = getWifiHandle(iface);
-
-    WifiCommand *cmd = wifi_unregister_cmd(handle, id);
-    if (cmd) {
-        cmd->cancel();
-        cmd->releaseRef();
-        return WIFI_SUCCESS;
-    }
-
-    return WIFI_ERROR_INVALID_ARGS;
-}
-
 class ePNOCommand : public WifiCommand
 {
 private:
diff --git a/rtt.cpp b/rtt.cpp
index 2c9114d950a8f28758667b52dcbbf5bc97c56076..9a1ef3a31ed0af381f667b7faf622cd9ed12ae2d 100755 (executable)
--- a/rtt.cpp
+++ b/rtt.cpp
@@ -32,10 +32,7 @@ typedef enum {
     SLSI_RTT_ATTRIBUTE_TARGET_MAC,
     SLSI_RTT_ATTRIBUTE_TARGET_TYPE,
     SLSI_RTT_ATTRIBUTE_TARGET_PEER,
-    SLSI_RTT_ATTRIBUTE_TARGET_CHAN_WIDTH,
     SLSI_RTT_ATTRIBUTE_TARGET_CHAN_FREQ,
-    SLSI_RTT_ATTRIBUTE_TARGET_CHAN_FREQ0,
-    SLSI_RTT_ATTRIBUTE_TARGET_CHAN_FREQ1,
     SLSI_RTT_ATTRIBUTE_TARGET_PERIOD,
     SLSI_RTT_ATTRIBUTE_TARGET_NUM_BURST,
     SLSI_RTT_ATTRIBUTE_TARGET_NUM_FTM_BURST,
@@ -203,21 +200,6 @@ public:
                        ALOGI("\trtt_ primary channel_freq %d\n",rttParams[i].channel.center_freq);
             if (result < 0) {
                 return result;
-            }
-               result = request.put_u16(SLSI_RTT_ATTRIBUTE_TARGET_CHAN_WIDTH, rttParams[i].channel.width);
-                       ALOGI("\trtt_channel width:%d\n",rttParams[i].channel.width);
-            if (result < 0) {
-                return result;
-            }
-               result = request.put_u16(SLSI_RTT_ATTRIBUTE_TARGET_CHAN_FREQ0, rttParams[i].channel.center_freq0);
-                       ALOGI("\trtt_channel_freq 0:%d\n",rttParams[i].channel.center_freq0);
-            if (result < 0) {
-                return result;
-            }
-               result = request.put_u16(SLSI_RTT_ATTRIBUTE_TARGET_CHAN_FREQ1, rttParams[i].channel.center_freq1);
-                       ALOGI("\trtt_channel_freq 1: %d\n",rttParams[i].channel.center_freq1);
-            if (result < 0) {
-                return result;
             }
             result = request.put_u8(SLSI_RTT_ATTRIBUTE_TARGET_NUM_BURST, rttParams[i].num_burst);
                        ALOGI("\tnum_burst %d\n",rttParams[i].num_burst);
@@ -462,7 +444,7 @@ public:
                                   } else if (nl_nested_itr.get_type() == SLSI_RTT_EVENT_ATTR_TIMESTAMP_US) {
                                          rtt_result->ts = (wifi_timestamp)nl_nested_itr.get_u32();
                                   } else if (nl_nested_itr.get_type() == SLSI_RTT_EVENT_ATTR_BURST_DURATION_MSN) {
-                                         rtt_result->burst_duration = nl_nested_itr.get_u16();
+                                         rtt_result->burst_duration = nl_nested_itr.get_u8();
                                   } else if (nl_nested_itr.get_type() == SLSI_RTT_EVENT_ATTR_NEGOTIATED_BURST_NUM) {
                                          rtt_result->negotiated_burst_num = nl_nested_itr.get_u8();
                                   } else if (nl_nested_itr.get_type() == SLSI_RTT_EVENT_ATTR_LCI) {
index 8b84febf7a4a82868fdbec6e1fd5d331adc7fbea..86deac84eb255fae95290fb8682d10867b4b56b2 100755 (executable)
@@ -162,10 +162,6 @@ wifi_error init_wifi_vendor_hal_func_table(wifi_hal_fn *fn)
     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_valid_channels = wifi_get_valid_channels;
     fn->wifi_rtt_range_request = wifi_rtt_range_request;