wifi_manager_autoscan_mode_e *mode);
/**
+ * @brief Sets the interval of autoscan.
+ * @since_tizen 7.5
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/network.set
+ *
+ * @param[in] wifi The Wi-Fi handle
+ * @param[in] mode The auto scan mode
+ * @param[in] interval The interval of autoscan
+ *
+ * @return 0 on success, otherwise negative error value
+ * @retval #WIFI_MANAGER_ERROR_NONE Successful
+ * @retval #WIFI_MANAGER_ERROR_NOT_INITIALIZED Not initialized
+ * @retval #WIFI_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WIFI_MANAGER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #WIFI_MANAGER_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval #WIFI_MANAGER_ERROR_NOT_SUPPORTED Not supported
+ * @pre This API needs wifi_manager_initialize() before use.
+ */
+int wifi_manager_set_autoscan_interval(wifi_manager_h wifi,
+ wifi_manager_autoscan_mode_e mode, int interval);
+
+/**
+ * @brief Gets the autoscan interval.
+ * @since_tizen 7.5
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/network.get
+ *
+ * @param[in] wifi The Wi-Fi handle
+ * @param[in] mode The auto scan mode
+ * @param[out] interval The interval of autoscan
+ *
+ * @return 0 on success, otherwise negative error value
+ * @retval #WIFI_MANAGER_ERROR_NONE Successful
+ * @retval #WIFI_MANAGER_ERROR_NOT_INITIALIZED Not initialized
+ * @retval #WIFI_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WIFI_MANAGER_ERROR_OPERATION_FAILED Operation failed
+ * @retval #WIFI_MANAGER_ERROR_PERMISSION_DENIED Permission Denied
+ * @retval #WIFI_MANAGER_ERROR_NOT_SUPPORTED Not supported
+ */
+int wifi_manager_get_autoscan_interval(wifi_manager_h wifi,
+ wifi_manager_autoscan_mode_e mode, int *interval);
+
+/**
* @brief Set BSSID to connman to be connected
* @since_tizen 5.0
* @param[in] wifi The Wi-Fi handle
Name: capi-network-wifi-manager
Summary: Network Wi-Fi library in TIZEN C API
-Version: 1.3.20
+Version: 1.3.21
Release: 0
Group: System/Network
License: Apache-2.0
return Error;
}
+int _net_dbus_set_bgscan_interval(network_info_s *network_info,
+ net_wifi_background_scan_mode_e mode, int interval)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ net_err_e Error = NET_ERR_NONE;
+ GVariant *message = NULL;
+ GVariant *params;
+
+ if (mode == WIFI_BGSCAN_MODE_EXPONENTIAL)
+ params = g_variant_new("(ssu)", network_info->interface_name, "Exponential", interval);
+ else
+ params = g_variant_new("(ssu)", network_info->interface_name, "Periodic", interval);
+
+ message = _net_invoke_dbus_method(network_info,
+ NETCONFIG_SERVICE, NETCONFIG_WIFI_PATH,
+ NETCONFIG_WIFI_INTERFACE, "SetBgscanInterval",
+ params, &Error);
+
+ if (Error != NET_ERR_NONE)
+ WIFI_LOG(WIFI_ERROR, "_net_invoke_dbus_method failed"); //LCOV_EXCL_LINE
+
+ if (message != NULL)
+ g_variant_unref(message); //LCOV_EXCL_LINE
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+}
+
int _net_dbus_set_ip_conflict_period(network_info_s *network_info, unsigned int initial_time)
{
__NETWORK_FUNC_ENTER__;
return Error;
}
+int _net_dbus_get_autoscan_interval(network_info_s *network_info,
+ unsigned int autoscanmode, int *interval)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ GVariant *params = NULL;
+ GVariant *message = NULL;
+ net_err_e Error = NET_ERR_NONE;
+
+ if (autoscanmode == WIFI_BGSCAN_MODE_EXPONENTIAL)
+ params = g_variant_new("(ss)", network_info->interface_name, "Exponential");
+ else
+ params = g_variant_new("(ss)", network_info->interface_name, "Periodic");
+
+ message = _net_invoke_dbus_method(network_info,
+ NETCONFIG_SERVICE, NETCONFIG_WIFI_PATH,
+ NETCONFIG_WIFI_INTERFACE, "GetBgscanInterval",
+ params, &Error);
+ if (message == NULL) {
+ WIFI_LOG(WIFI_ERROR, "Failed to Get Bgscan Interval");
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+ }
+
+ /** Check Reply */
+ int result = 0;
+ g_variant_get(message, "(u)", &result);
+ *interval = result;
+
+ WIFI_LOG(WIFI_INFO, "Get Auto scan Interval Result: %d", result);
+
+ g_variant_unref(message);
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+}
+
static void __net_multi_scan_request_reply(GObject *source_object, GAsyncResult *res,
gpointer user_data)
{
int _net_dbus_get_scan_state(network_info_s *network_info, int *state);
int _net_dbus_set_bgscan_mode(network_info_s *network_info,
net_wifi_background_scan_mode_e mode);
+int _net_dbus_set_bgscan_interval(network_info_s *network_info,
+ net_wifi_background_scan_mode_e mode, int interval);
int _net_dbus_set_agent_passphrase_and_connect(network_info_s *network_info,
const char *passphrase, const char *profilename);
int _net_dbus_get_wps_generated_pin(network_info_s *network_info, char **wps_pin);
int _net_dbus_pause_bgscan(network_info_s *network_info);
int _net_dbus_get_autoscanmode(network_info_s *network_info,
unsigned int *autoscanmode);
+int _net_dbus_get_autoscan_interval(network_info_s *network_info,
+ unsigned int autoscanmode, int *interval);
int _net_dbus_get_autoscan(network_info_s *network_info, gboolean *autoscan);
int _net_dbus_add_vsie(network_info_s *network_info,
return NET_ERR_NONE;
}
+int net_wifi_set_background_scan_interval(network_info_s *network_info,
+ net_wifi_background_scan_mode_e scan_mode, int interval)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ net_err_e Error = NET_ERR_NONE;
+
+ Error = __net_get_wifi_state(network_info);
+ if (Error != NET_ERR_NONE) {
+ WIFI_LOG(WIFI_ERROR, "Failed to get Wi-Fi state"); //LCOV_EXCL_LINE
+ __NETWORK_FUNC_EXIT__; //LCOV_EXCL_LINE
+ return Error; //LCOV_EXCL_LINE
+ }
+
+ if (network_info->wifi_state == WIFI_OFF) {
+ WIFI_LOG(WIFI_ERROR, "Wi-Fi powered off!"); //LCOV_EXCL_LINE
+ __NETWORK_FUNC_EXIT__; //LCOV_EXCL_LINE
+ return NET_ERR_INVALID_OPERATION; //LCOV_EXCL_LINE
+ }
+
+ if ((Error = _net_dbus_set_bgscan_interval(network_info, scan_mode, interval)) != NET_ERR_NONE) {
+ WIFI_LOG(WIFI_ERROR,
+ "Failed to set bgscan interval. Error [%s]",
+ _net_print_error(Error));
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+ }
+
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_NONE;
+}
+
int net_wifi_set_ip_conflict_period(network_info_s *network_info,
unsigned int initial_time)
{
return Error;
}
+int net_wifi_get_autoscan_interval(network_info_s *network_info,
+ unsigned int autoscanmode, int *interval)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ net_err_e Error = NET_ERR_NONE;
+
+ Error = _net_dbus_get_autoscan_interval(network_info, autoscanmode, interval);
+ if (Error != NET_ERR_NONE) {
+ WIFI_LOG(WIFI_ERROR,
+ "_net_dbus_get_autoscan_interval() failed. Error [%s]",
+ _net_print_error(Error));
+ }
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+}
+
int net_wifi_get_module_state(network_info_s *network_info, int *module_state)
{
GVariant *message = NULL, *variant;
int net_wifi_set_autoscan(network_info_s *network_info, gboolean autoscan);
int net_wifi_set_background_scan_mode(network_info_s *network_info,
net_wifi_background_scan_mode_e scan_mode);
+int net_wifi_set_background_scan_interval(network_info_s *network_info,
+ net_wifi_background_scan_mode_e scan_mode, int interval);
int net_wifi_get_autoscan(network_info_s *network_info, gboolean *autoscan);
int net_wifi_get_autoscanmode(network_info_s *network_info, unsigned int *autoscanmode);
+int net_wifi_get_autoscan_interval(network_info_s *network_info,
+ unsigned int autoscanmode, int *interval);
int net_wifi_get_module_state(network_info_s *network_info, int *module_state);
int net_foreach_ipv6_address(GSList **ipv6_address_list);
return WIFI_MANAGER_ERROR_NONE;
}
+int _wifi_set_background_scan_interval(wifi_manager_h wifi,
+ wifi_manager_autoscan_mode_e mode, int interval)
+{
+ int rv = 0;
+ wifi_manager_handle_s *wifi_handle = wifi;
+
+ rv = net_wifi_set_background_scan_interval(wifi_handle->network_info, mode, interval);
+ if (rv == NET_ERR_ACCESS_DENIED) {
+ WIFI_LOG(WIFI_ERROR, "Access denied");
+ return WIFI_MANAGER_ERROR_PERMISSION_DENIED;
+ } else if (rv != NET_ERR_NONE)
+ return WIFI_MANAGER_ERROR_OPERATION_FAILED;
+
+ return WIFI_MANAGER_ERROR_NONE;
+}
+
int _wifi_set_ip_conflict_period(wifi_manager_h wifi, unsigned int initial_time)
{
int rv = 0;
return WIFI_MANAGER_ERROR_NONE;
}
+int _wifi_get_autoscan_interval(wifi_manager_h wifi,
+ wifi_manager_autoscan_mode_e autoscanmode, int *interval)
+{
+ int rv;
+ wifi_manager_handle_s *wifi_handle = wifi;
+
+ rv = net_wifi_get_autoscan_interval(wifi_handle->network_info, autoscanmode, interval);
+ if (rv == NET_ERR_ACCESS_DENIED) {
+ WIFI_LOG(WIFI_ERROR, "Access denied"); //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
+ } else if (rv != NET_ERR_NONE) {
+ WIFI_LOG(WIFI_ERROR, "Failed to get auto scan interval"); //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ }
+
+ return WIFI_MANAGER_ERROR_NONE;
+}
+
int _wifi_set_passpoint(wifi_manager_h wifi, int passpoint)
{
int rv;
int _wifi_set_autoscan(wifi_manager_h wifi, bool autoscan);
int _wifi_set_background_scan_mode(wifi_manager_h wifi,
wifi_manager_autoscan_mode_e mode);
+int _wifi_set_background_scan_interval(wifi_manager_h wifi,
+ wifi_manager_autoscan_mode_e mode, int interval);
int _wifi_get_autoscan(wifi_manager_h wifi, bool *autoscan);
int _wifi_get_autoscanmode(wifi_manager_h wifi, wifi_manager_autoscan_mode_e *autoscanmode);
+int _wifi_get_autoscan_interval(wifi_manager_h wifi,
+ wifi_manager_autoscan_mode_e autoscanmode, int *interval);
int _wifi_get_passpoint(wifi_manager_h wifi, int *passpoint);
int _wifi_set_passpoint(wifi_manager_h wifi, int passpoint);
int _wifi_get_module_state(wifi_manager_h wifi, wifi_manager_module_state_e *state);
return rv;
}
+EXPORT_API int wifi_manager_set_autoscan_interval(wifi_manager_h wifi,
+ wifi_manager_autoscan_mode_e mode, int interval)
+{
+ int rv;
+
+ __NETWORK_CAPI_FUNC_ENTER__;
+
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
+ RET_ERR_IF_HANDLE_IS_NOT_VALID_OR_NOT_INITIALIZED(wifi, __NETWORK_CAPI_FUNC_EXIT__);
+
+ if (mode < WIFI_MANAGER_AUTOSCAN_MODE_EXPONENTIAL ||
+ mode > WIFI_MANAGER_AUTOSCAN_MODE_PERIODIC ||
+ interval < 0) {
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+ __NETWORK_CAPI_FUNC_EXIT__; //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+ }
+
+ rv = _wifi_set_background_scan_interval(wifi, mode, interval);
+ if (rv != WIFI_MANAGER_ERROR_NONE)
+ WIFI_LOG(WIFI_ERROR, "Set background scan interval failed");
+
+ __NETWORK_CAPI_FUNC_EXIT__;
+ return rv;
+}
+
EXPORT_API int wifi_manager_get_autoscan(wifi_manager_h wifi,
bool *autoscan)
{
return rv;
}
+EXPORT_API int wifi_manager_get_autoscan_interval(wifi_manager_h wifi,
+ wifi_manager_autoscan_mode_e mode, int *interval)
+{
+ int rv;
+
+ __NETWORK_CAPI_FUNC_ENTER__;
+
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
+ RET_ERR_IF_HANDLE_IS_NOT_VALID_OR_NOT_INITIALIZED(wifi, __NETWORK_CAPI_FUNC_EXIT__);
+
+ if (mode < WIFI_MANAGER_AUTOSCAN_MODE_EXPONENTIAL ||
+ mode > WIFI_MANAGER_AUTOSCAN_MODE_PERIODIC ||
+ interval == NULL) {
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+ __NETWORK_CAPI_FUNC_EXIT__; //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+ }
+
+ rv = _wifi_get_autoscan_interval(wifi, mode, interval);
+
+ __NETWORK_CAPI_FUNC_EXIT__;
+ return rv;
+}
+
EXPORT_API int wifi_manager_set_passpoint(wifi_manager_h wifi, int passpoint)
{
__NETWORK_CAPI_FUNC_ENTER__;
return 1;
}
+int wman_test_set_autoscan_interval(wifi_manager_h wifi)
+{
+ int mode = 0;
+ int rv = 0;
+ int autoscan_interval = 0;
+
+ printf("Input autoscan mode (0:exponential, 1:periodic): \n");
+ rv = scanf(" %9d", &mode);
+
+ if (rv <= 0) {
+ printf("Invalid input!\n");
+ return -1;
+ }
+
+ printf("Input autoscan interval: \n");
+ rv = scanf(" %9d", &autoscan_interval);
+
+ if (rv <= 0) {
+ printf("Invalid input!\n");
+ return -1;
+ }
+
+ rv = wifi_manager_set_autoscan_interval(wifi, mode, autoscan_interval);
+ if (rv != WIFI_MANAGER_ERROR_NONE) {
+ printf("failed to set autoscan mode [%s]\n", wman_test_strerror(rv));
+ return -1;
+ }
+
+ return 1;
+}
+
int wman_test_get_autoscan_state(wifi_manager_h wifi)
{
int rv = 0;
return 1;
}
+int wman_test_get_autoscan_interval(wifi_manager_h wifi)
+{
+ int mode = 0;
+ int rv = 0;
+ int autoscan_interval = 0;
+
+ printf("Input autoscan mode (0:exponential, 1:periodic): \n");
+ rv = scanf(" %9d", &mode);
+
+ if (rv <= 0) {
+ printf("Invalid input!\n");
+ return -1;
+ }
+
+ rv = wifi_manager_get_autoscan_interval(wifi, mode, &autoscan_interval);
+
+ if (rv != WIFI_MANAGER_ERROR_NONE) {
+ printf("Fail to get auto scan interval [%s]\n", wman_test_strerror(rv));
+ return -1;
+ }
+
+ printf("Auto Scan Interval: %d\n", autoscan_interval);
+ return 1;
+}
+
int wman_test_flush_bss(wifi_manager_h wifi)
{
int rv;
int wman_test_set_autoscan_state(wifi_manager_h wifi);
int wman_test_set_autoscan_mode(wifi_manager_h wifi);
+int wman_test_set_autoscan_interval(wifi_manager_h wifi);
int wman_test_get_autoscan_state(wifi_manager_h wifi);
int wman_test_get_autoscan_mode(wifi_manager_h wifi);
+int wman_test_get_autoscan_interval(wifi_manager_h wifi);
int wman_test_flush_bss(wifi_manager_h wifi);
int wman_test_set_auto_connect(wifi_manager_h wifi);
int wman_test_get_auto_connect(wifi_manager_h wifi);
printf("- - Get power-save mode\n");
printf("= - Set power-save mode\n");
#endif /* TIZEN_DA */
+ printf("[ - Get Interval of Auto Scan\n");
+ printf("] - Set Interval of Auto Scan\n");
printf(LOG_RED "0 - Exit \n" LOG_END);
printf("ENTER - Show options menu.......\n");
rv = wman_test_set_power_save_mode(wifi);
break;
#endif /* TIZEN_DA */
+ case '[':
+ rv = wman_test_get_autoscan_interval(wifi);
+ break;
+ case ']':
+ rv = wman_test_set_autoscan_interval(wifi);
+ break;
default:
break;
}