diff options
-rw-r--r-- | wcn6740/qcwcn/wifi_hal/wifi_hal.cpp | 3 | ||||
-rw-r--r-- | wcn6740/qcwcn/wifi_hal/wificonfig.cpp | 75 |
2 files changed, 78 insertions, 0 deletions
diff --git a/wcn6740/qcwcn/wifi_hal/wifi_hal.cpp b/wcn6740/qcwcn/wifi_hal/wifi_hal.cpp index 4e0d0da..ae4c91c 100644 --- a/wcn6740/qcwcn/wifi_hal/wifi_hal.cpp +++ b/wcn6740/qcwcn/wifi_hal/wifi_hal.cpp @@ -146,6 +146,8 @@ static int wifi_is_nan_ext_cmd_supported(wifi_interface_handle handle); wifi_error wifi_init_tcp_param_change_event_handler(wifi_interface_handle iface); +wifi_error wifi_set_voip_mode(wifi_interface_handle iface, wifi_voip_mode mode); + /* Initialize/Cleanup */ wifi_interface_handle wifi_get_iface_handle(wifi_handle handle, char *name) @@ -1086,6 +1088,7 @@ wifi_error init_wifi_vendor_hal_func_table(wifi_hal_fn *fn) { fn->wifi_multi_sta_set_use_case = wifi_multi_sta_set_use_case; fn->wifi_set_coex_unsafe_channels = wifi_set_coex_unsafe_channels; fn->wifi_set_dtim_config = wifi_set_dtim_config; + fn->wifi_set_voip_mode = wifi_set_voip_mode; fn->wifi_get_usable_channels = wifi_get_usable_channels; return WIFI_SUCCESS; diff --git a/wcn6740/qcwcn/wifi_hal/wificonfig.cpp b/wcn6740/qcwcn/wifi_hal/wificonfig.cpp index 989399f..5aec138 100644 --- a/wcn6740/qcwcn/wifi_hal/wificonfig.cpp +++ b/wcn6740/qcwcn/wifi_hal/wificonfig.cpp @@ -1453,3 +1453,78 @@ cleanup: delete wifiConfigCommand; return (wifi_error)ret; } + +/** + * Invoked to set voip optimization mode for the provided STA iface + */ + wifi_error wifi_set_voip_mode(wifi_interface_handle iface, wifi_voip_mode mode) +{ + int requestId, ret = 0; + WiFiConfigCommand *wifiConfigCommand; + + struct nlattr *nlData; + interface_info *ifaceInfo = getIfaceInfo(iface); + + wifi_handle wifiHandle = getWifiHandle(iface); + if (!wifiHandle) { + ALOGE("%s: Error wifi_handle NULL", __FUNCTION__); + return WIFI_ERROR_UNKNOWN; + } + + requestId = get_requestid(); + ALOGV("%s: voip mode=%d", __FUNCTION__, mode); + wifiConfigCommand = new WiFiConfigCommand( + wifiHandle, + requestId, + OUI_QCA, + QCA_NL80211_VENDOR_SUBCMD_SET_WIFI_CONFIGURATION); + + if (wifiConfigCommand == NULL) { + ALOGE("%s: Error wifiConfigCommand NULL", __FUNCTION__); + return WIFI_ERROR_UNKNOWN; + } + + /* Create the NL message. */ + ret = wifiConfigCommand->create(); + if (ret < 0) { + ALOGE("%s: failed to create NL msg. Error:%d", + __FUNCTION__, ret); + goto cleanup; + } + + /* Set the interface Id of the message. */ + ret = wifiConfigCommand->set_iface_id(ifaceInfo->name); + if (ret < 0) { + ALOGE("%s: failed to set iface id. Error:%d", + __FUNCTION__, ret); + goto cleanup; + } + + /* Add the vendor specific attributes for the NL command. */ + nlData = wifiConfigCommand->attr_start(NL80211_ATTR_VENDOR_DATA); + if (!nlData) { + ALOGE("%s: failed attr_start for VENDOR_DATA. Error:%d", + __FUNCTION__, ret); + goto cleanup; + } + + if (wifiConfigCommand->put_u8( + QCA_WLAN_VENDOR_ATTR_CONFIG_WFC_STATE, (u8)mode)) { + ALOGE("%s: failed to put vendor data. Error:%d", + __FUNCTION__, ret); + goto cleanup; + } + wifiConfigCommand->attr_end(nlData); + + /* Send the NL msg. */ + wifiConfigCommand->waitForRsp(false); + ret = wifiConfigCommand->requestEvent(); + if (ret != 0) { + ALOGE("%s: requestEvent Error:%d", __FUNCTION__, ret); + goto cleanup; + } + +cleanup: + delete wifiConfigCommand; + return (wifi_error)ret; +} |