net: wifi: Properly namespace public APIs
The twt and ps helper functions were not namespaced (were missing wifi_ prefix). Also change wifi_get_twt_... to more logical wifi_twt_get... like the other twt prefixed functions and wifi_get_ps... to wifi_ps_get... like the other ps prefixed functions. Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
This commit is contained in:
parent
6e785a4886
commit
7d3dabf07b
3 changed files with 21 additions and 20 deletions
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018 Texas Instruments, Incorporated
|
* Copyright (c) 2018 Texas Instruments, Incorporated
|
||||||
|
* Copyright (c) 2023 Nordic Semiconductor ASA
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
@ -455,7 +456,7 @@ enum wifi_twt_fail_reason {
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @cond INTERNAL_HIDDEN */
|
/** @cond INTERNAL_HIDDEN */
|
||||||
static const char * const twt_err_code_tbl[] = {
|
static const char * const wifi_twt_err_code_tbl[] = {
|
||||||
[WIFI_TWT_FAIL_UNSPECIFIED] = "Unspecified",
|
[WIFI_TWT_FAIL_UNSPECIFIED] = "Unspecified",
|
||||||
[WIFI_TWT_FAIL_CMD_EXEC_FAIL] = "Command Execution failed",
|
[WIFI_TWT_FAIL_CMD_EXEC_FAIL] = "Command Execution failed",
|
||||||
[WIFI_TWT_FAIL_OPERATION_NOT_SUPPORTED] =
|
[WIFI_TWT_FAIL_OPERATION_NOT_SUPPORTED] =
|
||||||
|
@ -478,17 +479,17 @@ static const char * const twt_err_code_tbl[] = {
|
||||||
/** @endcond */
|
/** @endcond */
|
||||||
|
|
||||||
/** Helper function to get user-friendly TWT error code name. */
|
/** Helper function to get user-friendly TWT error code name. */
|
||||||
static inline const char *get_twt_err_code_str(int16_t err_no)
|
static inline const char *wifi_twt_get_err_code_str(int16_t err_no)
|
||||||
{
|
{
|
||||||
if ((err_no) < (int16_t)ARRAY_SIZE(twt_err_code_tbl)) {
|
if ((err_no) < (int16_t)ARRAY_SIZE(wifi_twt_err_code_tbl)) {
|
||||||
return twt_err_code_tbl[err_no];
|
return wifi_twt_err_code_tbl[err_no];
|
||||||
}
|
}
|
||||||
|
|
||||||
return "<unknown>";
|
return "<unknown>";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Wi-Fi power save parameters. */
|
/** Wi-Fi power save parameters. */
|
||||||
enum ps_param_type {
|
enum wifi_ps_param_type {
|
||||||
/** Power save state. */
|
/** Power save state. */
|
||||||
WIFI_PS_PARAM_STATE,
|
WIFI_PS_PARAM_STATE,
|
||||||
/** Power save listen interval. */
|
/** Power save listen interval. */
|
||||||
|
@ -535,7 +536,7 @@ enum wifi_config_ps_param_fail_reason {
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @cond INTERNAL_HIDDEN */
|
/** @cond INTERNAL_HIDDEN */
|
||||||
static const char * const ps_param_config_err_code_tbl[] = {
|
static const char * const wifi_ps_param_config_err_code_tbl[] = {
|
||||||
[WIFI_PS_PARAM_FAIL_UNSPECIFIED] = "Unspecified",
|
[WIFI_PS_PARAM_FAIL_UNSPECIFIED] = "Unspecified",
|
||||||
[WIFI_PS_PARAM_FAIL_CMD_EXEC_FAIL] = "Command Execution failed",
|
[WIFI_PS_PARAM_FAIL_CMD_EXEC_FAIL] = "Command Execution failed",
|
||||||
[WIFI_PS_PARAM_FAIL_OPERATION_NOT_SUPPORTED] =
|
[WIFI_PS_PARAM_FAIL_OPERATION_NOT_SUPPORTED] =
|
||||||
|
@ -552,10 +553,10 @@ static const char * const ps_param_config_err_code_tbl[] = {
|
||||||
/** @endcond */
|
/** @endcond */
|
||||||
|
|
||||||
/** Helper function to get user-friendly power save error code name. */
|
/** Helper function to get user-friendly power save error code name. */
|
||||||
static inline const char *get_ps_config_err_code_str(int16_t err_no)
|
static inline const char *wifi_ps_get_config_err_code_str(int16_t err_no)
|
||||||
{
|
{
|
||||||
if ((err_no) < (int16_t)ARRAY_SIZE(ps_param_config_err_code_tbl)) {
|
if ((err_no) < (int16_t)ARRAY_SIZE(wifi_ps_param_config_err_code_tbl)) {
|
||||||
return ps_param_config_err_code_tbl[err_no];
|
return wifi_ps_param_config_err_code_tbl[err_no];
|
||||||
}
|
}
|
||||||
|
|
||||||
return "<unknown>";
|
return "<unknown>";
|
||||||
|
|
|
@ -339,7 +339,7 @@ struct wifi_ps_params {
|
||||||
*/
|
*/
|
||||||
unsigned int timeout_ms;
|
unsigned int timeout_ms;
|
||||||
/** Wi-Fi power save type */
|
/** Wi-Fi power save type */
|
||||||
enum ps_param_type type;
|
enum wifi_ps_param_type type;
|
||||||
/** Wi-Fi power save fail reason */
|
/** Wi-Fi power save fail reason */
|
||||||
enum wifi_config_ps_param_fail_reason fail_reason;
|
enum wifi_config_ps_param_fail_reason fail_reason;
|
||||||
};
|
};
|
||||||
|
|
|
@ -782,7 +782,7 @@ static int cmd_wifi_ps(const struct shell *sh, size_t argc, char *argv[])
|
||||||
shell_fprintf(sh, SHELL_WARNING,
|
shell_fprintf(sh, SHELL_WARNING,
|
||||||
"PS %s failed. Reason: %s\n",
|
"PS %s failed. Reason: %s\n",
|
||||||
params.enabled ? "enable" : "disable",
|
params.enabled ? "enable" : "disable",
|
||||||
get_ps_config_err_code_str(params.fail_reason));
|
wifi_ps_get_config_err_code_str(params.fail_reason));
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -812,7 +812,7 @@ static int cmd_wifi_ps_mode(const struct shell *sh, size_t argc, char *argv[])
|
||||||
if (net_mgmt(NET_REQUEST_WIFI_PS, iface, ¶ms, sizeof(params))) {
|
if (net_mgmt(NET_REQUEST_WIFI_PS, iface, ¶ms, sizeof(params))) {
|
||||||
shell_fprintf(sh, SHELL_WARNING, "%s failed Reason : %s\n",
|
shell_fprintf(sh, SHELL_WARNING, "%s failed Reason : %s\n",
|
||||||
wifi_ps_mode2str[params.mode],
|
wifi_ps_mode2str[params.mode],
|
||||||
get_ps_config_err_code_str(params.fail_reason));
|
wifi_ps_get_config_err_code_str(params.fail_reason));
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -843,7 +843,7 @@ static int cmd_wifi_ps_timeout(const struct shell *sh, size_t argc, char *argv[]
|
||||||
if (net_mgmt(NET_REQUEST_WIFI_PS, iface, ¶ms, sizeof(params))) {
|
if (net_mgmt(NET_REQUEST_WIFI_PS, iface, ¶ms, sizeof(params))) {
|
||||||
shell_fprintf(sh, SHELL_WARNING,
|
shell_fprintf(sh, SHELL_WARNING,
|
||||||
"Setting PS timeout failed. Reason : %s\n",
|
"Setting PS timeout failed. Reason : %s\n",
|
||||||
get_ps_config_err_code_str(params.fail_reason));
|
wifi_ps_get_config_err_code_str(params.fail_reason));
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -897,7 +897,7 @@ static int cmd_wifi_twt_setup_quick(const struct shell *sh, size_t argc,
|
||||||
shell_fprintf(sh, SHELL_WARNING, "%s with %s failed, reason : %s\n",
|
shell_fprintf(sh, SHELL_WARNING, "%s with %s failed, reason : %s\n",
|
||||||
wifi_twt_operation2str[params.operation],
|
wifi_twt_operation2str[params.operation],
|
||||||
wifi_twt_negotiation_type2str[params.negotiation_type],
|
wifi_twt_negotiation_type2str[params.negotiation_type],
|
||||||
get_twt_err_code_str(params.fail_reason));
|
wifi_twt_get_err_code_str(params.fail_reason));
|
||||||
|
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
@ -984,7 +984,7 @@ static int cmd_wifi_twt_setup(const struct shell *sh, size_t argc,
|
||||||
shell_fprintf(sh, SHELL_WARNING, "%s with %s failed. reason : %s\n",
|
shell_fprintf(sh, SHELL_WARNING, "%s with %s failed. reason : %s\n",
|
||||||
wifi_twt_operation2str[params.operation],
|
wifi_twt_operation2str[params.operation],
|
||||||
wifi_twt_negotiation_type2str[params.negotiation_type],
|
wifi_twt_negotiation_type2str[params.negotiation_type],
|
||||||
get_twt_err_code_str(params.fail_reason));
|
wifi_twt_get_err_code_str(params.fail_reason));
|
||||||
|
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
@ -1040,7 +1040,7 @@ static int cmd_wifi_twt_teardown(const struct shell *sh, size_t argc,
|
||||||
shell_fprintf(sh, SHELL_WARNING, "%s with %s failed, reason : %s\n",
|
shell_fprintf(sh, SHELL_WARNING, "%s with %s failed, reason : %s\n",
|
||||||
wifi_twt_operation2str[params.operation],
|
wifi_twt_operation2str[params.operation],
|
||||||
wifi_twt_negotiation_type2str[params.negotiation_type],
|
wifi_twt_negotiation_type2str[params.negotiation_type],
|
||||||
get_twt_err_code_str(params.fail_reason));
|
wifi_twt_get_err_code_str(params.fail_reason));
|
||||||
|
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
@ -1067,7 +1067,7 @@ static int cmd_wifi_twt_teardown_all(const struct shell *sh, size_t argc,
|
||||||
shell_fprintf(sh, SHELL_WARNING, "%s with %s failed, reason : %s\n",
|
shell_fprintf(sh, SHELL_WARNING, "%s with %s failed, reason : %s\n",
|
||||||
wifi_twt_operation2str[params.operation],
|
wifi_twt_operation2str[params.operation],
|
||||||
wifi_twt_negotiation_type2str[params.negotiation_type],
|
wifi_twt_negotiation_type2str[params.negotiation_type],
|
||||||
get_twt_err_code_str(params.fail_reason));
|
wifi_twt_get_err_code_str(params.fail_reason));
|
||||||
|
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
@ -1204,13 +1204,13 @@ static int cmd_wifi_listen_interval(const struct shell *sh, size_t argc, char *a
|
||||||
WIFI_PS_PARAM_LISTEN_INTERVAL_RANGE_INVALID) {
|
WIFI_PS_PARAM_LISTEN_INTERVAL_RANGE_INVALID) {
|
||||||
shell_fprintf(sh, SHELL_WARNING,
|
shell_fprintf(sh, SHELL_WARNING,
|
||||||
"Setting listen interval failed. Reason :%s\n",
|
"Setting listen interval failed. Reason :%s\n",
|
||||||
get_ps_config_err_code_str(params.fail_reason));
|
wifi_ps_get_config_err_code_str(params.fail_reason));
|
||||||
shell_fprintf(sh, SHELL_WARNING,
|
shell_fprintf(sh, SHELL_WARNING,
|
||||||
"Hardware support valid range : 3 - 65535\n");
|
"Hardware support valid range : 3 - 65535\n");
|
||||||
} else {
|
} else {
|
||||||
shell_fprintf(sh, SHELL_WARNING,
|
shell_fprintf(sh, SHELL_WARNING,
|
||||||
"Setting listen interval failed. Reason :%s\n",
|
"Setting listen interval failed. Reason :%s\n",
|
||||||
get_ps_config_err_code_str(params.fail_reason));
|
wifi_ps_get_config_err_code_str(params.fail_reason));
|
||||||
}
|
}
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
@ -1245,7 +1245,7 @@ static int cmd_wifi_ps_wakeup_mode(const struct shell *sh, size_t argc, char *ar
|
||||||
shell_fprintf(sh, SHELL_WARNING,
|
shell_fprintf(sh, SHELL_WARNING,
|
||||||
"Setting PS wake up mode to %s failed..Reason :%s\n",
|
"Setting PS wake up mode to %s failed..Reason :%s\n",
|
||||||
params.wakeup_mode ? "Listen interval" : "DTIM interval",
|
params.wakeup_mode ? "Listen interval" : "DTIM interval",
|
||||||
get_ps_config_err_code_str(params.fail_reason));
|
wifi_ps_get_config_err_code_str(params.fail_reason));
|
||||||
return -ENOEXEC;
|
return -ENOEXEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue