[7570] wlbt : Adding support for android_net_wifi_set_Country_Code_Hal.
authorMohit Ghuley <mohit.ghuley@samsung.com>
Mon, 7 Nov 2016 06:16:17 +0000 (11:46 +0530)
committerTarun Karela <t.karela@samsung.com>
Mon, 4 Jun 2018 09:40:47 +0000 (10:40 +0100)
Adding support for setting the country code in Wifi HAL.

Change-Id: I5517158cd2fa95f088e902a4b60c6dabdae29558
SCSC-Bug-Id:SSB-22869
Signed-off-by: Mohit Ghuley <mohit.ghuley@samsung.com>
common.h
wifi_hal.cpp

index b978f438731a42c382eb9d13673340534fcfa37a..679919673a694756f5e79f8435b7d285f93ca798 100755 (executable)
--- a/common.h
+++ b/common.h
@@ -87,7 +87,8 @@ typedef enum {
     SLSI_NL80211_VENDOR_SUBCMD_LLS_SET_INFO,
     SLSI_NL80211_VENDOR_SUBCMD_LLS_GET_INFO,
     SLSI_NL80211_VENDOR_SUBCMD_LLS_CLEAR_INFO,
-    SLSI_NL80211_VENDOR_SUBCMD_GET_FEATURE_SET
+    SLSI_NL80211_VENDOR_SUBCMD_GET_FEATURE_SET,
+    SLSI_NL80211_VENDOR_SUBCMD_SET_COUNTRY_CODE
 } WIFI_SUB_COMMAND;
 
 typedef enum {
index c984538d7be8e0f827a9a6a931544901e9a01bf5..28512edb553d550a36db06c1d2646b4dd801ae63 100755 (executable)
@@ -37,6 +37,7 @@
 #define FEATURE_SET                  0
 #define FEATURE_SET_MATRIX           1
 #define ATTR_NODFS_VALUE             3
+#define ATTR_COUNTRY_CODE            4
 
 static void internal_event_handler(wifi_handle handle, int events);
 static int internal_no_seq_check(nl_msg *msg, void *arg);
@@ -130,6 +131,7 @@ wifi_error init_wifi_vendor_hal_func_table(wifi_hal_fn *fn)
     fn->wifi_set_link_stats = wifi_set_link_stats;
     fn->wifi_get_link_stats = wifi_get_link_stats;
     fn->wifi_clear_link_stats = wifi_clear_link_stats;
+    fn->wifi_set_country_code = wifi_set_country_code;
 
     return WIFI_SUCCESS;
 }
@@ -728,6 +730,35 @@ public:
 
 };
 
+class SetCountryCodeCommand : public WifiCommand {
+private:
+    const char *mCountryCode;
+public:
+    SetCountryCodeCommand(wifi_interface_handle handle, const char *country_code)
+        : WifiCommand(handle, 0) {
+        mCountryCode = country_code;
+        }
+    virtual int create() {
+        int ret;
+
+        ret = mMsg.create(GOOGLE_OUI, SLSI_NL80211_VENDOR_SUBCMD_SET_COUNTRY_CODE);
+        if (ret < 0) {
+             ALOGE("Can't create message to send to driver - %d", ret);
+             return ret;
+        }
+
+        nlattr *data = mMsg.attr_start(NL80211_ATTR_VENDOR_DATA);
+        ret = mMsg.put_string(ATTR_COUNTRY_CODE, mCountryCode);
+        if (ret < 0) {
+            return ret;
+        }
+
+        mMsg.attr_end(data);
+        return WIFI_SUCCESS;
+
+    }
+};
+
 class GetFeatureSetCommand : public WifiCommand {
 
 private:
@@ -938,4 +969,10 @@ wifi_error wifi_get_supported_feature_set(wifi_interface_handle handle, feature_
     return (wifi_error) command.requestResponse();
 }
 
+wifi_error wifi_set_country_code(wifi_interface_handle handle, const char *country_code)
+{
+    SetCountryCodeCommand command(handle, country_code);
+    return (wifi_error) command.requestResponse();
+}
+
 /////////////////////////////////////////////////////////////////////////////