int _net_dbus_device_policy_get_wifi(int *state);
int _net_dbus_device_policy_get_wifi_profile(int *state);
+int _net_dbus_resume_bgscan(void);
+int _net_dbus_pause_bgscan(void);
+int _net_dbus_get_autoscanmode(unsigned int *autoscanmode);
+int _net_dbus_get_autoscan(gboolean *autoscan);
+
+
#ifdef __cplusplus
}
int net_delete_profile(const char *profile_name);
int net_get_wifi_state(net_wifi_state_e *current_state);
-int net_wifi_set_background_scan_mode(net_wifi_background_scan_mode_e scan_mode);
int net_init_profile_info(net_profile_info_s *ProfInfo);
int net_specific_scan_wifi(const char *ssid);
int net_get_wps_pin(char **wps_pin);
int net_get_device_policy_wifi(void);
int net_get_device_policy_wifi_profile(void);
+int net_wifi_set_autoscan(gboolean autoscan);
+int net_wifi_set_background_scan_mode(net_wifi_background_scan_mode_e scan_mode);
+int net_wifi_get_autoscan(gboolean *autoscan);
+int net_wifi_get_autoscanmode(unsigned int *autoscanmode);
+
+
int net_config_get_id_list(GSList **list);
int net_config_set_field(const gchar *config_id, const gchar *key, const gchar *value);
#include <glib-object.h>
#include "network_interface.h"
+#include "wifi_manager_extension.h"
#ifdef __cplusplus
extern "C" {
*/
int wifi_manager_unset_rssi_level_changed_cb(wifi_manager_h wifi);
+
/**
* @}
*/
#include "wifi-manager.h"
#include "network_interface.h"
+#include "wifi_manager_extension.h"
#ifdef __cplusplus
extern "C" {
wifi_eap_config_s *eap_config, gboolean is_hidden);
gchar *_wifi_eap_type_to_string(wifi_manager_eap_type_e eap_type);
gchar *_wifi_eap_auth_type_to_string(wifi_manager_eap_auth_type_e eap_auth_type);
+int _wifi_set_autoscan(bool autoscan);
+int _wifi_set_background_scan_mode(wifi_manager_autoscan_mode_e mode);
+int _wifi_get_autoscan(bool *autoscan);
+int _wifi_get_autoscanmode(wifi_manager_autoscan_mode_e *autoscanmode);
+
+
/* WIFI Privilege Check */
int _wifi_check_get_privilege();
--- /dev/null
+/*
+ * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __TIZEN_WIFI_MANAGER_EXTENSION_H__
+#define __TIZEN_WIFI_MANAGER_EXTENSION_H__
+
+#include "wifi-manager.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file wifi_manager_extension.h
+ */
+
+
+/**
+ * @brief Enumeration for the Wi-Fi autoscan mode.
+ * @since_tizen 4.0
+ */
+typedef enum {
+ /**
+ * Auto scan interval is increased exponentially like 4, 8, 16, ...128secs
+ */
+ WIFI_MANAGER_AUTOSCAN_MODE_EXPONENTIAL = 0x00,
+ /**
+ * Auto scan interval is fixed with 10secs(for mobile) / 15secs(for wearable)
+ */
+ WIFI_MANAGER_AUTOSCAN_MODE_PERIODIC
+} wifi_manager_autoscan_mode_e;
+
+/**
+* @}
+*/
+
+/**
+* @addtogroup CAPI_NETWORK_WIFI_MANAGER_MANAGEMENT_MODULE
+* @{
+*/
+
+/**
+ * @brief Enables or disables auto-scanning
+ * @details If auto-scanning is disabled, then background scan and wps scan don't work.
+ * By default, the auto-scanning is enabled automatically until disabling auto-scanning.
+ * Don't forget to enable again when you finish your works with disabled auto-scanning.
+ * @since_tizen 4.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/network.set \n
+ * %http://tizen.org/privilege/network.get
+ * @remarks This API needs both privileges.
+ *
+ * @param[in] autoscan true to enable and false to disable
+ *
+ * @return 0 on success, otherwise negative error value
+ * @retval #WIFI_ERROR_NONE Successful
+ * @retval #WIFI_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #WIFI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WIFI_ERROR_OPERATION_FAILED Operation failed
+ * @retval #WIFI_ERROR_PERMISSION_DENIED Permission Denied
+ * @pre This API needs wifi_initialize() before use.
+ */
+int wifi_manager_set_autoscan(wifi_manager_h wifi, bool autoscan);
+
+/**
+ * @brief Sets the mode of autoscan.
+ * @since_tizen 4.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/network.set
+ *
+ * @param[in] mode The auto scan mode
+ *
+ * @return 0 on success, otherwise negative error value
+ * @retval #WIFI_ERROR_NONE Successful
+ * @retval #WIFI_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WIFI_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #WIFI_ERROR_PERMISSION_DENIED Permission Denied
+ * @pre This API needs wifi_initialize() before use.
+ */
+int wifi_manager_set_autoscan_mode(wifi_manager_h wifi, wifi_manager_autoscan_mode_e mode);
+
+/**
+ * @brief Gets the autoscan state.
+ * @since_tizen 4.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/network.get
+ * @param[in] wifi The wifi handle
+ * @param[out] autoscan The autoscan state(enable or disable)
+ * @return 0 on success, otherwise negative error value
+ * @retval #WIFI_MANAGER_ERROR_NONE Successful
+ * @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(wifi_manager_h wifi,
+ bool *autoscan);
+
+/**
+ * @brief Gets the autoscan mode.
+ * @since_tizen 4.0
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/network.get
+ * @param[in] wifi The wifi handle
+ * @param[out] mode The mode of autoscan
+ * @return 0 on success, otherwise negative error value
+ * @retval #WIFI_MANAGER_ERROR_NONE Successful
+ * @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_mode(wifi_manager_h wifi,
+ wifi_manager_autoscan_mode_e *mode);
+
+/**
+* @}
+*/
+
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TIZEN_WIFI_MANAGER_EXTENSION_H__ */
goto error;
}
- } else
+ } else {
Error = _net_dbus_open_connection(prof_info->ProfileName);
//LCOV_EXCL_STOP
+ }
error:
if (NET_ERR_NONE != Error) {
__NETWORK_FUNC_EXIT__;
return Error;
}
+
+int _net_dbus_resume_bgscan(void)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ net_err_e Error = NET_ERR_NONE;
+ GVariant *message = NULL;
+
+ char path[CONNMAN_MAX_BUFLEN] = NETCONFIG_WIFI_PATH;
+
+ message = _net_invoke_dbus_method(NETCONFIG_SERVICE, path,
+ NETCONFIG_WIFI_INTERFACE, "ResumeBgscan", NULL, &Error);
+
+ if (Error != NET_ERR_NONE)
+ WIFI_LOG(WIFI_ERROR, "_net_invoke_dbus_method failed");
+
+ if (message != NULL)
+ g_variant_unref(message);
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+}
+
+int _net_dbus_pause_bgscan(void)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ net_err_e Error = NET_ERR_NONE;
+ GVariant *message = NULL;
+
+ char path[CONNMAN_MAX_BUFLEN] = NETCONFIG_WIFI_PATH;
+
+ message = _net_invoke_dbus_method(NETCONFIG_SERVICE, path,
+ NETCONFIG_WIFI_INTERFACE, "PauseBgscan", NULL, &Error);
+
+ if (Error != NET_ERR_NONE)
+ WIFI_LOG(WIFI_ERROR, "_net_invoke_dbus_method failed");
+
+ if (message != NULL)
+ g_variant_unref(message);
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+}
+
+int _net_dbus_get_autoscan(gboolean *autoscan)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ GVariant *message = NULL;
+ net_err_e Error = NET_ERR_NONE;
+
+ message = _net_invoke_dbus_method(NETCONFIG_SERVICE,
+ NETCONFIG_WIFI_PATH, NETCONFIG_WIFI_INTERFACE,
+ "GetAutoscan", NULL, &Error);
+ if (message == NULL) {
+ WIFI_LOG(WIFI_ERROR, "Failed to Get Passpoint");
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+ }
+
+ /** Check Reply */
+ int result = 0;
+ g_variant_get(message, "(b)", &result);
+ *autoscan = result;
+
+ WIFI_LOG(WIFI_INFO, "Get Auto scan state Result: %d", result);
+
+ g_variant_unref(message);
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+}
+
+int _net_dbus_get_autoscanmode(unsigned int *autoscanmode)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ GVariant *message = NULL;
+ net_err_e Error = NET_ERR_NONE;
+
+ message = _net_invoke_dbus_method(NETCONFIG_SERVICE,
+ NETCONFIG_WIFI_PATH, NETCONFIG_WIFI_INTERFACE,
+ "GetAutoscanmode", NULL, &Error);
+ if (message == NULL) {
+ WIFI_LOG(WIFI_ERROR, "Failed to Get Passpoint");
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+ }
+
+ /** Check Reply */
+ int result = 0;
+ g_variant_get(message, "(u)", &result);
+ *autoscanmode = result;
+
+ WIFI_LOG(WIFI_INFO, "Get Auto scan Mode Result: %d", result);
+
+ g_variant_unref(message);
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+}
+
//LCOV_EXCL_STOP
__NETWORK_FUNC_EXIT__;
return Error;
}
-
-int net_wifi_set_background_scan_mode(net_wifi_background_scan_mode_e scan_mode)
-{
- __NETWORK_FUNC_ENTER__;
-
- net_err_e Error = NET_ERR_NONE;
-
- if (NetworkInfo.ref_count < 1) {
- WIFI_LOG(WIFI_ERROR, "Application is not registered");
- __NETWORK_FUNC_EXIT__;
- return NET_ERR_APP_NOT_REGISTERED;
- }
-
- if (NetworkInfo.wifi_state == WIFI_OFF) {
- if ((NetworkInfo.wifi_state = _net_get_wifi_state(&Error)) == WIFI_OFF) {
- WIFI_LOG(WIFI_ERROR, "Wi-Fi is powered off!");
- __NETWORK_FUNC_EXIT__;
- return NET_ERR_INVALID_OPERATION;
- }
- }
-
- if ((Error = _net_dbus_set_bgscan_mode(scan_mode)) != NET_ERR_NONE) {
- WIFI_LOG(WIFI_ERROR,
- "Failed to set bgscan mode. Error [%s]",
- _net_print_error(Error));
-
- __NETWORK_FUNC_EXIT__;
- return Error;
- }
-
- __NETWORK_FUNC_EXIT__;
- return NET_ERR_NONE;
-}
//LCOV_EXCL_STOP
int net_check_get_privilege()
}
//LCOV_EXCL_STOP
+int net_wifi_set_autoscan(gboolean autoscan)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ net_err_e Error = NET_ERR_NONE;
+
+ if (NetworkInfo.ref_count < 1) {
+ WIFI_LOG(WIFI_ERROR, "Application is not registered");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_APP_NOT_REGISTERED;
+ }
+
+ WIFI_LOG(WIFI_INFO, "[%s] auto scan", autoscan ? "enable" : "disable");
+
+ if (autoscan)
+ Error = _net_dbus_resume_bgscan();
+ else
+ Error = _net_dbus_pause_bgscan();
+
+ if (Error != NET_ERR_NONE) {
+ WIFI_LOG(WIFI_ERROR,
+ "Failed to enable/disable auto scan Error [%s]",
+ _net_print_error(Error));
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+ }
+
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_NONE;
+}
+
+int net_wifi_set_background_scan_mode(net_wifi_background_scan_mode_e scan_mode)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ net_err_e Error = NET_ERR_NONE;
+
+ if (NetworkInfo.ref_count < 1) {
+ WIFI_LOG(WIFI_ERROR, "Application is not registered");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_APP_NOT_REGISTERED;
+ }
+
+ if (NetworkInfo.wifi_state == WIFI_OFF) {
+ if ((NetworkInfo.wifi_state = _net_get_wifi_state(&Error)) == WIFI_OFF) {
+ WIFI_LOG(WIFI_ERROR, "Wi-Fi is powered off!");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_INVALID_OPERATION;
+ }
+ }
+
+ if ((Error = _net_dbus_set_bgscan_mode(scan_mode)) != NET_ERR_NONE) {
+ WIFI_LOG(WIFI_ERROR,
+ "Failed to set bgscan mode. Error [%s]",
+ _net_print_error(Error));
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+ }
+
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_NONE;
+}
+
+int net_wifi_get_autoscan(gboolean *autoscan)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ net_err_e Error = NET_ERR_NONE;
+
+ if (NetworkInfo.ref_count < 1) {
+ WIFI_LOG(WIFI_ERROR, "Application is not registered");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_APP_NOT_REGISTERED;
+ }
+
+ if (NetworkInfo.wifi_state == WIFI_OFF) {
+ if ((NetworkInfo.wifi_state = _net_get_wifi_state(&Error)) == WIFI_OFF) {
+ WIFI_LOG(WIFI_ERROR, "Wi-Fi is powered off!");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_INVALID_OPERATION;
+ }
+ }
+
+ if (_net_dbus_is_pending_call_used() == TRUE) {
+ WIFI_LOG(WIFI_ERROR, "pending call in progress");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_INVALID_OPERATION;
+ }
+
+ Error = _net_dbus_get_autoscan(autoscan);
+ if (Error != NET_ERR_NONE) {
+ WIFI_LOG(WIFI_ERROR,
+ "_net_dbus_get_autoscan() failed. Error [%s]",
+ _net_print_error(Error));
+ }
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+}
+
+int net_wifi_get_autoscanmode(unsigned int *autoscanmode)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ net_err_e Error = NET_ERR_NONE;
+
+ if (NetworkInfo.ref_count < 1) {
+ WIFI_LOG(WIFI_ERROR, "Application is not registered");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_APP_NOT_REGISTERED;
+ }
+
+ if (NetworkInfo.wifi_state == WIFI_OFF) {
+ if ((NetworkInfo.wifi_state = _net_get_wifi_state(&Error)) == WIFI_OFF) {
+ WIFI_LOG(WIFI_ERROR, "Wi-Fi is powered off!");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_INVALID_OPERATION;
+ }
+ }
+
+ if (_net_dbus_is_pending_call_used() == TRUE) {
+ WIFI_LOG(WIFI_ERROR, "pending call in progress");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_INVALID_OPERATION;
+ }
+
+ Error = _net_dbus_get_autoscanmode(autoscanmode);
+ if (Error != NET_ERR_NONE) {
+ WIFI_LOG(WIFI_ERROR,
+ "_net_dbus_get_autoscanmode() failed. Error [%s]",
+ _net_print_error(Error));
+ }
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+}
return profile;
}
+
+int _wifi_set_autoscan(bool autoscan)
+{
+ int rv = 0;
+
+ rv = net_wifi_set_autoscan(autoscan);
+ 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_background_scan_mode(wifi_manager_autoscan_mode_e mode)
+{
+ int rv = 0;
+
+ rv = net_wifi_set_background_scan_mode(mode);
+ 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_get_autoscan(bool *autoscan)
+{
+ int rv;
+ gboolean auto_scan = 0;;
+
+ rv = net_wifi_get_autoscan(&auto_scan);
+ 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 Wi-Fi state"); //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ }
+
+ *autoscan = auto_scan;
+ return WIFI_MANAGER_ERROR_NONE;
+}
+
+int _wifi_get_autoscanmode(wifi_manager_autoscan_mode_e *autoscanmode)
+{
+ int rv;
+
+ rv = net_wifi_get_autoscanmode(autoscanmode);
+ 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 Wi-Fi state"); //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ }
+
+ return WIFI_MANAGER_ERROR_NONE;
+}
#include <glib.h>
#include "wifi_internal.h"
+#include "wifi_manager_extension.h"
#define WIFI_MAC_ADDR_LENGTH 17
#define WIFI_MAC_ADDR_PATH "/sys/class/net/wlan0/address"
return __wifi_set_rssi_level_changed_cb(wifi, NULL, NULL);
}
+EXPORT_API int wifi_manager_set_autoscan(wifi_manager_h wifi, bool autoscan)
+{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
+ if (!(__wifi_check_handle_validity(wifi))) {
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+ }
+
+ return _wifi_set_autoscan(autoscan);
+}
+
+EXPORT_API int wifi_manager_set_autoscan_mode(wifi_manager_h wifi, wifi_manager_autoscan_mode_e mode)
+{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
+ int rv;
+
+ if (!(__wifi_check_handle_validity(wifi))) {
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+ }
+
+
+ if (mode < WIFI_MANAGER_AUTOSCAN_MODE_EXPONENTIAL || mode > WIFI_MANAGER_AUTOSCAN_MODE_PERIODIC) {
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter");
+ return WIFI_MANAGER_ERROR_INVALID_PARAMETER;
+ }
+
+ rv = _wifi_set_background_scan_mode(mode);
+ if (rv != WIFI_MANAGER_ERROR_NONE)
+ WIFI_LOG(WIFI_ERROR, "Set background scan mode failed");
+
+ return rv;
+}
+
+EXPORT_API int wifi_manager_get_autoscan(wifi_manager_h wifi,
+ bool *autoscan)
+{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
+ if (autoscan == NULL || !(__wifi_check_handle_validity(wifi))) {
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+ }
+
+ return _wifi_get_autoscan(autoscan);
+}
+
+EXPORT_API int wifi_manager_get_autoscan_mode(wifi_manager_h wifi,
+ wifi_manager_autoscan_mode_e *mode)
+{
+ CHECK_FEATURE_SUPPORTED(WIFI_FEATURE);
+
+ if (mode == NULL || !(__wifi_check_handle_validity(wifi))) {
+ WIFI_LOG(WIFI_ERROR, "Invalid parameter"); //LCOV_EXCL_LINE
+ return WIFI_MANAGER_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
+ }
+
+ return _wifi_get_autoscanmode(mode);
+}
#include <wifi-manager.h>
#include <tizen_error.h>
+#include "wifi_manager_extension.h"
+
#define LOG_RED "\033[0;31m"
#define LOG_GREEN "\033[0;32m"
#define LOG_BROWN "\033[0;33m"
return 1;
}
+int test_wifi_manager_set_autoscan_state(void)
+{
+ int autoscan = 0;
+ int rv = 0;
+
+ printf("Input enable/disable for autoscan (0:enable, 1:disable) :\n");
+ rv = scanf("%9d", &autoscan);
+
+ if (rv <= 0) {
+ printf("Invalid input!\n");
+ return -1;
+ }
+
+ switch (autoscan) {
+ case 0:
+ rv = wifi_manager_set_autoscan(wifi, true);
+ break;
+
+ case 1:
+ rv = wifi_manager_set_autoscan(wifi, false);
+ break;
+
+ default:
+ printf("Invalid input!\n");
+ return -1;
+ }
+
+ if (rv != WIFI_MANAGER_ERROR_NONE) {
+ printf("failed to set autoscan [%s]\n", __test_convert_error_to_string(rv));
+ return -1;
+ }
+
+ return 1;
+}
+
+int test_wifi_manager_set_autoscan_mode(void)
+{
+ int mode = 0;
+ int rv = 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_set_autoscan_mode(wifi, mode);
+ if (rv != WIFI_MANAGER_ERROR_NONE) {
+ printf("failed to set autoscan mode [%s]\n", __test_convert_error_to_string(rv));
+ return -1;
+ }
+
+ return 1;
+}
+
+int test_wifi_manager_get_autoscan_state(void)
+{
+ int rv = 0;
+ bool autoscan = FALSE;
+
+ rv = wifi_manager_get_autoscan(wifi, &autoscan);
+
+ if (rv != WIFI_MANAGER_ERROR_NONE) {
+ printf("Fail to get auto scan status [%s]\n", __test_convert_error_to_string(rv));
+ return -1;
+ }
+
+ printf("Auto Scan Status (0:enable, 1:disable) : %d\n", autoscan);
+ return 1;
+}
+
+int test_wifi_manager_get_autoscan_mode(void)
+{
+ int rv = 0;
+ wifi_manager_autoscan_mode_e autoscan_mode;
+
+ rv = wifi_manager_get_autoscan_mode(wifi, &autoscan_mode);
+
+ if (rv != WIFI_MANAGER_ERROR_NONE) {
+ printf("Fail to get auto scan mode [%s]\n", __test_convert_error_to_string(rv));
+ return -1;
+ }
+
+ printf("Auto Scan Mode (0:exponential, 1:periodic) : %d\n", autoscan_mode);
+ return 1;
+}
+
int main(int argc, char **argv)
{
GMainLoop *mainloop;
printf("o - TDLS TearDown\n");
printf("p - TDLS Get Connected Peer\n");
printf("q - Connect Hidden AP\n");
+ printf("r - Set Auto Scan Enable-Disable\n");
+ printf("s - Set Auto Scan Mode\n");
+ printf("t - Get Auto Scan Enable-Disable\n");
+ printf("u - Get Auto Scan Mode\n");
printf(LOG_RED "0 - Exit \n" LOG_END);
printf("ENTER - Show options menu.......\n");
}
switch (a[0]) {
+/* Public API */
case '1':
rv = test_wifi_manager_init();
break;
case 'q':
rv = test_wifi_manager_connect_hidden_ap();
break;
+/* Extension API */
+ case 'r':
+ rv = test_wifi_manager_set_autoscan_state();
+ break;
+ case 's':
+ rv = test_wifi_manager_set_autoscan_mode();
+ break;
+ case 't':
+ rv = test_wifi_manager_get_autoscan_state();
+ break;
+ case 'u':
+ rv = test_wifi_manager_get_autoscan_mode();
+ break;
default:
break;