#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);
fn->wifi_set_nodfs_flag = wifi_set_nodfs_flag;
fn->wifi_start_sending_offloaded_packet = wifi_start_sending_offloaded_packet;
fn->wifi_stop_sending_offloaded_packet = wifi_stop_sending_offloaded_packet;
-#if 0
+#ifdef ANDROID_N_EPNO
fn->wifi_set_epno_list = wifi_set_epno_list;
fn->wifi_set_passpoint_list = wifi_set_passpoint_list;
fn->wifi_reset_passpoint_list = wifi_reset_passpoint_list;
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;
}
};
+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:
+ int feature_type;
+ feature_set *fset;
+ int *fm_size;
+ int set_size_max;
+public:
+ GetFeatureSetCommand(wifi_interface_handle handle, feature_set *set)
+ : WifiCommand(handle, 0)
+ {
+ fset = set;
+ }
+
+ virtual int create() {
+ int ret;
+
+ ret = mMsg.create(GOOGLE_OUI, SLSI_NL80211_VENDOR_SUBCMD_GET_FEATURE_SET);
+ if (ret < 0) {
+ ALOGE("create failed - %d", ret);
+ }
+
+ return ret;
+ }
+
+protected:
+ virtual int handleResponse(WifiEvent& reply) {
+
+ int id = reply.get_vendor_id();
+ int subcmd = reply.get_vendor_subcmd();
+
+ if (reply.get_cmd() != NL80211_CMD_VENDOR) {
+ ALOGD("Ignore reply; cmd = %d", reply.get_cmd());
+ return NL_SKIP;
+ }
+
+ nlattr *vendor_data = reply.get_attribute(NL80211_ATTR_VENDOR_DATA);
+ int len = reply.get_vendor_data_len();
+
+ if (vendor_data == NULL || len == 0) {
+ ALOGE("vendor data in GetFeatureSetCommand missing!!");
+ return NL_SKIP;
+ }
+
+ void *data = reply.get_vendor_data();
+ if(!fset) {
+ ALOGE("feature_set Pointer not set");
+ return NL_SKIP;
+ }
+ memcpy(fset, data, min(len, (int) sizeof(*fset)));
+ return NL_OK;
+ }
+
+};
static int wifi_get_multicast_id(wifi_handle handle, const char *name, const char *group)
{
return WIFI_SUCCESS;
}
-wifi_error wifi_get_supported_feature_set(wifi_interface_handle handle, feature_set *set)
-{
- return WIFI_ERROR_NOT_SUPPORTED;
-}
-
wifi_error wifi_get_concurrency_matrix(wifi_interface_handle handle, int set_size_max,
feature_set set[], int *set_size)
{
return wifi_cancel_cmd(id, iface);
}
+wifi_error wifi_get_supported_feature_set(wifi_interface_handle handle, feature_set *set)
+{
+ GetFeatureSetCommand command(handle, set);
+ 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();
+}
+
/////////////////////////////////////////////////////////////////////////////