[APR-2053]wlbt: NAN R2 integration fxes
[GitHub/MotorolaMobilityLLC/hardware-samsung_slsi-scsc_wifibt-wifi_hal.git] / gscan.cpp
index 3c6d1042fd6c5829617c03e380045b0d49a69256..e3227e1b47a601210676d4d23b0aafb6b06406bd 100755 (executable)
--- a/gscan.cpp
+++ b/gscan.cpp
@@ -1,4 +1,3 @@
-
 #include <stdint.h>
 #include <stddef.h>
 #include <fcntl.h>
 
 #include "sync.h"
 
-#define LOG_TAG  "WifiHAL"
-
 #include <utils/Log.h>
 
 #include "wifi_hal.h"
 #include "common.h"
 #include "cpp_bindings.h"
 
-typedef enum {
-
-    GSCAN_ATTRIBUTE_NUM_BUCKETS = 10,
-    GSCAN_ATTRIBUTE_BASE_PERIOD,
-    GSCAN_ATTRIBUTE_BUCKETS_BAND,
-    GSCAN_ATTRIBUTE_BUCKET_ID,
-    GSCAN_ATTRIBUTE_BUCKET_PERIOD,
-    GSCAN_ATTRIBUTE_BUCKET_NUM_CHANNELS,
-    GSCAN_ATTRIBUTE_BUCKET_CHANNELS,
-    GSCAN_ATTRIBUTE_NUM_AP_PER_SCAN,
-    GSCAN_ATTRIBUTE_REPORT_THRESHOLD,
-    GSCAN_ATTRIBUTE_NUM_SCANS_TO_CACHE,
-    GSCAN_ATTRIBUTE_REPORT_THRESHOLD_NUM_SCANS,
-    GSCAN_ATTRIBUTE_BAND = GSCAN_ATTRIBUTE_BUCKETS_BAND,
-
-    GSCAN_ATTRIBUTE_ENABLE_FEATURE = 20,
-    GSCAN_ATTRIBUTE_SCAN_RESULTS_COMPLETE,              /* indicates no more results */
-    GSCAN_ATTRIBUTE_REPORT_EVENTS,
-
-    /* remaining reserved for additional attributes */
-    GSCAN_ATTRIBUTE_NUM_OF_RESULTS = 30,
-    GSCAN_ATTRIBUTE_SCAN_RESULTS,                       /* flat array of wifi_scan_result */
-    GSCAN_ATTRIBUTE_NUM_CHANNELS,
-    GSCAN_ATTRIBUTE_CHANNEL_LIST,
-    GSCAN_ATTRIBUTE_SCAN_ID,
-    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,
-    GSCAN_ATTRIBUTE_MIN_BREACHING,
-    GSCAN_ATTRIBUTE_SIGNIFICANT_CHANGE_BSSIDS,
-
-    GSCAN_ATTRIBUTE_BUCKET_STEP_COUNT = 70,
-    GSCAN_ATTRIBUTE_BUCKET_EXPONENT,
-    GSCAN_ATTRIBUTE_BUCKET_MAX_PERIOD,
-
-    GSCAN_ATTRIBUTE_NUM_BSSID,
-    GSCAN_ATTRIBUTE_BLACKLIST_BSSID,
-
-    GSCAN_ATTRIBUTE_MAX
-
-} GSCAN_ATTRIBUTE;
-
 typedef enum {
     EPNO_ATTRIBUTE_MINIMUM_5G_RSSI,
     EPNO_ATTRIBUTE_MINIMUM_2G_RSSI,
@@ -143,13 +76,10 @@ protected:
     virtual int handleResponse(WifiEvent& reply) {
 
         if (reply.get_cmd() != NL80211_CMD_VENDOR) {
-            ALOGD("Ignoring reply with cmd = %d", reply.get_cmd());
+            ALOGE("Ignoring reply with cmd = %d", reply.get_cmd());
             return NL_SKIP;
         }
 
-        int id = reply.get_vendor_id();
-        int subcmd = reply.get_vendor_subcmd();
-
         void *data = reply.get_vendor_data();
         int len = reply.get_vendor_data_len();
 
@@ -202,12 +132,10 @@ protected:
     virtual int handleResponse(WifiEvent& reply) {
 
         if (reply.get_cmd() != NL80211_CMD_VENDOR) {
-            ALOGD("Ignoring reply with cmd = %d", reply.get_cmd());
+            ALOGE("Ignoring reply with cmd = %d", reply.get_cmd());
             return NL_SKIP;
         }
 
-        int id = reply.get_vendor_id();
-        int subcmd = reply.get_vendor_subcmd();
         int num_channels_to_copy = 0;
 
         nlattr *vendor_data = reply.get_attribute(NL80211_ATTR_VENDOR_DATA);
@@ -248,6 +176,7 @@ wifi_error wifi_get_valid_channels(wifi_interface_handle handle,
 
 /* helper functions */
 
+/*
 static int parseScanResults(wifi_scan_result *results, int num, nlattr *attr)
 {
     memset(results, 0, sizeof(wifi_scan_result) * num);
@@ -255,7 +184,6 @@ static int parseScanResults(wifi_scan_result *results, int num, nlattr *attr)
     int i = 0;
     for (nl_iterator it(attr); it.has_next() && i < num; it.next(), i++) {
 
-        int index = it.get_type();
         nlattr *sc_data = (nlattr *) it.get_data();
         wifi_scan_result *result = results + i;
 
@@ -287,6 +215,7 @@ static int parseScanResults(wifi_scan_result *results, int num, nlattr *attr)
 
     return i;
 }
+*/
 
 int createFeatureRequest(WifiRequest& request, int subcmd) {
 
@@ -303,12 +232,10 @@ class ScanCommand : public WifiCommand
     wifi_scan_cmd_params *mParams;
     wifi_scan_result_handler mHandler;
     static unsigned mGlobalFullScanBuckets;
-    bool mLocalFullScanBuckets;
 public:
     ScanCommand(wifi_interface_handle iface, int id, wifi_scan_cmd_params *params,
                 wifi_scan_result_handler handler)
-        : WifiCommand(iface, id), mParams(params), mHandler(handler),
-          mLocalFullScanBuckets(0)
+        : WifiCommand(iface, id), mParams(params), mHandler(handler)
     { }
 
     int createSetupRequest(WifiRequest& request) {
@@ -359,6 +286,9 @@ public:
                 return result;
             }
 
+            if (mParams->buckets[i].report_events == 0) {
+                mParams->buckets[i].report_events = REPORT_EVENTS_EACH_SCAN;
+            }
             result = request.put_u32(GSCAN_ATTRIBUTE_REPORT_EVENTS,
                     mParams->buckets[i].report_events);
             if (result < 0) {
@@ -429,7 +359,7 @@ public:
 
         int nBuckets = 0;
         for (int i = 0; i < mParams->num_buckets; i++) {
-            if (mParams->buckets[i].report_events == 2) {
+            if (mParams->buckets[i].report_events & REPORT_EVENTS_FULL_RESULTS) {
                 nBuckets++;
             }
         }
@@ -477,7 +407,7 @@ public:
     }
 
     virtual int handleEvent(WifiEvent& event) {
-        event.log();
+        //event.log();
 
         nlattr *vendor_data = event.get_attribute(NL80211_ATTR_VENDOR_DATA);
         unsigned int len = event.get_vendor_data_len();
@@ -492,7 +422,7 @@ public:
 
             evt_type = (wifi_scan_event) event.get_u32(NL80211_ATTR_VENDOR_DATA);
             if(*mHandler.on_scan_event)
-                (*mHandler.on_scan_event)(evt_type, evt_type);
+                (*mHandler.on_scan_event)(id(), evt_type);
         } else if(event_id == GSCAN_EVENT_FULL_SCAN_RESULTS) {
             uint32_t bucket_scanned = 0;
             wifi_scan_result *scan_result = NULL;
@@ -507,7 +437,7 @@ public:
             if (scan_result) {
                 if(*mHandler.on_full_scan_result)
                     (*mHandler.on_full_scan_result)(id(), scan_result, bucket_scanned);
-
+/*
                     ALOGD("%-32s\t", scan_result->ssid);
                     ALOGD("%02x:%02x:%02x:%02x:%02x:%02x ", scan_result->bssid[0], scan_result->bssid[1],
                             scan_result->bssid[2], scan_result->bssid[3], scan_result->bssid[4], scan_result->bssid[5]);
@@ -516,6 +446,7 @@ public:
                     ALOGD("%lld\t", scan_result->ts);
                     ALOGD("%lld\t", scan_result->rtt);
                     ALOGD("%lld\n", scan_result->rtt_sd);
+*/
             }
         }
         return NL_SKIP;
@@ -544,7 +475,6 @@ wifi_error wifi_stop_gscan(wifi_request_id id, wifi_interface_handle iface)
     if(id == -1) {
         wifi_scan_result_handler handler;
         wifi_scan_cmd_params dummy_params;
-        wifi_handle handle = getWifiHandle(iface);
         memset(&handler, 0, sizeof(handler));
 
         ScanCommand *cmd = new ScanCommand(iface, id, &dummy_params, handler);
@@ -635,13 +565,10 @@ public:
     virtual int handleResponse(WifiEvent& reply) {
 
         if (reply.get_cmd() != NL80211_CMD_VENDOR) {
-            ALOGD("Ignoring reply with cmd = %d", reply.get_cmd());
+            ALOGE("Ignoring reply with cmd = %d", reply.get_cmd());
             return NL_SKIP;
         }
 
-        int id = reply.get_vendor_id();
-        int subcmd = reply.get_vendor_subcmd();
-
         nlattr *vendor_data = reply.get_attribute(NL80211_ATTR_VENDOR_DATA);
         int len = reply.get_vendor_data_len();
 
@@ -653,19 +580,19 @@ public:
         for (nl_iterator it(vendor_data); it.has_next(); it.next()) {
             if (it.get_type() == GSCAN_ATTRIBUTE_SCAN_RESULTS_COMPLETE) {
                 mCompleted = it.get_u8();
-                ALOGD("retrieved mCompleted flag : %d", mCompleted);
+                //ALOGD("retrieved mCompleted flag : %d", mCompleted);
             } else if (it.get_type() == GSCAN_ATTRIBUTE_SCAN_RESULTS || it.get_type() == 0) {
                 int scan_id = 0, flags = 0, num = 0;
                 for (nl_iterator it2(it.get()); it2.has_next(); it2.next()) {
                     if (it2.get_type() == GSCAN_ATTRIBUTE_SCAN_ID) {
                         scan_id = it2.get_u32();
-                        ALOGD("retrieved scan_id : 0x%0x", scan_id);
+                        //ALOGD("retrieved scan_id : 0x%0x", scan_id);
                     } else if (it2.get_type() == GSCAN_ATTRIBUTE_SCAN_FLAGS) {
                         flags = it2.get_u8();
-                        ALOGD("retrieved scan_flags : 0x%0x", flags);
+                        //ALOGD("retrieved scan_flags : 0x%0x", flags);
                     } else if (it2.get_type() == GSCAN_ATTRIBUTE_NUM_OF_RESULTS) {
                         num = it2.get_u32();
-                        ALOGD("retrieved num_results: %d", num);
+                        //ALOGD("retrieved num_results: %d", num);
                     } else if (it2.get_type() == GSCAN_ATTRIBUTE_SCAN_RESULTS) {
                         if (mRetrieved >= mMax) {
                             ALOGW("Stored %d scans, ignoring excess results", mRetrieved);
@@ -676,7 +603,7 @@ public:
                         num = min((int)MAX_AP_CACHE_PER_SCAN, num);
                         memcpy(mScanResults + mNextScanResult, it2.get_data(),
                                 sizeof(wifi_scan_result) * num);
-                        ALOGD("Retrieved %d scan results", num);
+                        /*
                         wifi_scan_result *results = (wifi_scan_result *)it2.get_data();
                         for (int i = 0; i < num; i++) {
                             wifi_scan_result *result = results + i;
@@ -684,11 +611,11 @@ public:
                                 result->ssid, result->bssid[0], result->bssid[1], result->bssid[2],
                                 result->bssid[3], result->bssid[4], result->bssid[5],
                                 result->rssi);
-                        }
+                        }*/
                         mScans[mRetrieved].scan_id = scan_id;
                         mScans[mRetrieved].flags = flags;
                         mScans[mRetrieved].num_results = num;
-                        ALOGD("Setting result of scan_id : 0x%0x", mScans[mRetrieved].scan_id);
+                        //ALOGD("Setting result of scan_id : 0x%0x", mScans[mRetrieved].scan_id);
                         memcpy(mScans[mRetrieved].results,
                                 &(mScanResults[mNextScanResult]), num * sizeof(wifi_scan_result));
                         mNextScanResult += num;
@@ -715,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) {
-            ALOGD("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) {
-            ALOGD("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:
@@ -1213,7 +778,6 @@ public:
     }
 
     virtual int handleEvent(WifiEvent& event) {
-        int event_id = event.get_vendor_subcmd();
         // event.log();
 
         nlattr *vendor_data = event.get_attribute(NL80211_ATTR_VENDOR_DATA);
@@ -1422,72 +986,3 @@ wifi_error wifi_reset_passpoint_list(wifi_request_id id, wifi_interface_handle i
     wifi_unregister_cmd(handle, id);
     return result;
 }
-
-#if 0 // TODO: (IP) removed to make it build
-
-class BssidBlacklistCommand : public WifiCommand
-{
-private:
-    wifi_bssid_params *mParams;
-public:
-    BssidBlacklistCommand(wifi_interface_handle handle, int id,
-            wifi_bssid_params *params)
-        : WifiCommand(handle, id), mParams(params)
-    { }
-     int createRequest(WifiRequest& request) {
-        int result = request.create(GOOGLE_OUI, SLSI_NL80211_VENDOR_SUBCMD_SET_BSSID_BLACKLIST);
-        if (result < 0) {
-            return result;
-        }
-
-        nlattr *data = request.attr_start(NL80211_ATTR_VENDOR_DATA);
-        result = request.put_u32(GSCAN_ATTRIBUTE_NUM_BSSID, mParams->num_bssid);
-        if (result < 0) {
-            return result;
-        }
-
-        for (int i = 0; i < mParams->num_bssid; i++) {
-            result = request.put_addr(GSCAN_ATTRIBUTE_BLACKLIST_BSSID, mParams->bssids[i]);
-            if (result < 0) {
-                return result;
-            }
-        }
-        request.attr_end(data);
-        return result;
-    }
-
-    int start() {
-        WifiRequest request(familyId(), ifaceId());
-        int result = createRequest(request);
-        if (result < 0) {
-            return result;
-        }
-
-        result = requestResponse(request);
-        if (result < 0) {
-            ALOGE("Failed to execute bssid blacklist request, result = %d", result);
-            return result;
-        }
-
-        return result;
-    }
-
-
-    virtual int handleResponse(WifiEvent& reply) {
-        /* Nothing to do on response! */
-        return NL_SKIP;
-    }
-};
-
-wifi_error wifi_set_bssid_blacklist(wifi_request_id id, wifi_interface_handle iface,
-        wifi_bssid_params params)
-{
-    wifi_handle handle = getWifiHandle(iface);
-
-    BssidBlacklistCommand *cmd = new BssidBlacklistCommand(iface, id, &params);
-    wifi_error result = (wifi_error)cmd->start();
-    //release the reference of command as well
-    cmd->releaseRef();
-    return result;
-}
-#endif