From 1c5125facb20c7f511d840c94c13a0c9a81ca437 Mon Sep 17 00:00:00 2001 From: Seonah Moon Date: Thu, 14 Apr 2016 11:15:40 +0900 Subject: [PATCH] Remove 'reserved (wifi ap)' type The Softap supprots Wi-Fi AP type. Change-Id: I41679aed63d329f08093c42f317b03fec79d7408 Signed-off-by: Seonah Moon --- include/tethering.h | 157 +-------- include/tethering.xml | 33 -- include/tethering_private.h | 11 - packaging/capi-network-tethering.spec | 2 +- src/tethering.c | 579 +--------------------------------- test/tethering_test.c | 202 +----------- 6 files changed, 10 insertions(+), 974 deletions(-) diff --git a/include/tethering.h b/include/tethering.h index aba8f71..52bac1b 100644 --- a/include/tethering.h +++ b/include/tethering.h @@ -61,11 +61,10 @@ typedef enum { * @since_tizen 2.3 */ typedef enum { - TETHERING_TYPE_ALL = 0, /**< All type except for TETHERING_TYPE_RESERVED */ + TETHERING_TYPE_ALL = 0, /**< All type */ TETHERING_TYPE_USB, /**< USB type */ TETHERING_TYPE_WIFI, /**< Wi-Fi type */ TETHERING_TYPE_BT, /**< BT type */ - TETHERING_TYPE_RESERVED, /**< Reserved type */ } tethering_type_e; /** @@ -250,15 +249,6 @@ typedef void (*tethering_wifi_passphrase_changed_cb)(void *user_data); typedef void (*tethering_wifi_settings_reloaded_cb)(tethering_error_e result, void *user_data); /** - * @brief Called when Wi-Fi AP settings are reloaded. - * @since_tizen 2.3 - * @param[in] result The result of reloading the settings - * @param[in] user_data The user data passed from the request function - * @pre tethering_wifi_ap_reload_settings() will invoke this callback. - */ -typedef void (*tethering_wifi_ap_settings_reloaded_cb)(tethering_error_e result, void *user_data); - -/** * @brief Creates the handle for tethering. * @since_tizen 2.3 * @privlevel platform @@ -999,7 +989,7 @@ int tethering_wifi_set_channel(tethering_h tethering, int channel); * @return 0 on success, otherwise negative error value * @retval #TETHERING_ERROR_NONE Successful * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter - * @see tethering_wifi_ap_set_channel() + * @see tethering_wifi_set_channel() */ int tethering_wifi_get_channel(tethering_h tethering, int *channel); @@ -1034,149 +1024,6 @@ int tethering_wifi_set_mode(tethering_h tethering, tethering_wifi_mode_type_e ty int tethering_wifi_get_mode(tethering_h tethering, tethering_wifi_mode_type_e *type); /** - * @brief Sets the security type of Wi-Fi AP. - * @details If security type is not set, WPA2_PSK is used. - * @since_tizen 2.3 - * @privlevel platform - * @privilege %http://tizen.org/privilege/tethering.admin - * @param[in] tethering The tethering handle - * @param[in] type The security type - * @return 0 on success, otherwise negative error value - * @retval #TETHERING_ERROR_NONE Successful - * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed - * @see tethering_wifi_ap_get_security_type() - */ -int tethering_wifi_ap_set_security_type(tethering_h tethering, tethering_wifi_security_type_e type); - -/** - * @brief Gets the security type of Wi-Fi AP. - * @details If security type is not set, WPA2_PSK is used. - * @since_tizen 2.3 - * @privlevel platform - * @privilege %http://tizen.org/privilege/tethering.admin - * @param[in] tethering The tethering handle - * @param[out] type The security type - * @return 0 on success, otherwise negative error value - * @retval #TETHERING_ERROR_NONE Successful - * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter - * @see tethering_wifi_ap_set_security_type() - */ -int tethering_wifi_ap_get_security_type(tethering_h tethering, tethering_wifi_security_type_e *type); - -/** - * @brief Sets the SSID (service set identifier) for Wi-Fi AP. - * @details The SSID cannot exceed 32 bytes. If SSID is not set, device name is used as SSID. - * @since_tizen 2.3 - * @privlevel platform - * @privilege %http://tizen.org/privilege/tethering.admin - * @param[in] tethering The tethering handle - * @param[in] ssid The SSID - * @return 0 on success, otherwise negative error value - * @retval #TETHERING_ERROR_NONE Successful - * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory - */ -int tethering_wifi_ap_set_ssid(tethering_h tethering, const char *ssid); - -/** - * @brief Gets the SSID (service set identifier) for Wi-Fi AP. - * @details If SSID is not set, Device name is used as SSID. - * @since_tizen 2.3 - * @privlevel platform - * @privilege %http://tizen.org/privilege/tethering.admin - * @remarks @a ssid must be released using free(). - * @param[in] tethering The tethering handle - * @param[out] ssid The SSID - * @return 0 on success, otherwise negative error value - * @retval #TETHERING_ERROR_NONE Successful - * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory - */ -int tethering_wifi_ap_get_ssid(tethering_h tethering, char **ssid); - -/** - * @brief Sets the visibility of SSID (service set identifier) for Wi-Fi AP. - * @details If you set the visibility to invisible, then the SSID of this device is hidden and Wi-Fi scan won't find your device. - * @details By default visibility is set to @c true. - * @since_tizen 2.3 - * @privlevel platform - * @privilege %http://tizen.org/privilege/tethering.admin - * @remarks This change is applied next time Wi-Fi tethering is enabled. - * @param[in] tethering The tethering handle - * @param[in] visible The visibility of SSID: (@c true = visible, @c false = invisible) - * @return 0 on success, otherwise negative error value - * @retval #TETHERING_ERROR_NONE Successful - * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed - * @see tethering_wifi_ap_get_ssid_visibility() - */ -int tethering_wifi_ap_set_ssid_visibility(tethering_h tethering, bool visible); - -/** - * @brief Gets the visibility of SSID (service set identifier) for Wi-Fi AP. - * @details If the visibility is set to invisible, then the SSID of this device is hidden and Wi-Fi scan won't find your device. - * @details By default visibility is set to @c true. - * @since_tizen 2.3 - * @privlevel platform - * @privilege %http://tizen.org/privilege/tethering.admin - * @param[in] tethering The tethering handle - * @param[out] visible The visibility of SSID: (@c true = visible, @c false = invisible) - * @return 0 on success, otherwise negative error value - * @retval #TETHERING_ERROR_NONE Successful - * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter - * @see tethering_wifi_ap_set_ssid_visibility() - */ -int tethering_wifi_ap_get_ssid_visibility(tethering_h tethering, bool *visible); - -/** - * @brief Sets the passphrase for Wi-Fi AP. - * @details If the passphrase is not set, random string of 8 characters will be used. - * @since_tizen 2.3 - * @privlevel platform - * @privilege %http://tizen.org/privilege/tethering.admin - * @param[in] tethering The tethering handle - * @param[in] passphrase The passphrase - * @return 0 on success, otherwise negative error value - * @retval #TETHERING_ERROR_NONE Successful - * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter - * @see tethering_wifi_ap_get_passphrase() - */ -int tethering_wifi_ap_set_passphrase(tethering_h tethering, const char *passphrase); - -/** - * @brief Gets the passphrase for Wi-Fi AP. - * @details If the passphrase is not set, random string of 8 characters will be used. - * @since_tizen 2.3 - * @privlevel platform - * @privilege %http://tizen.org/privilege/tethering.admin - * @remarks @a passphrase must be released using free(). - * @param[in] tethering The tethering handle - * @param[out] passphrase The passphrase - * @return 0 on success, otherwise negative error value - * @retval #TETHERING_ERROR_NONE Successful - * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory - * @see tethering_wifi_ap_set_passphrase() - */ -int tethering_wifi_ap_get_passphrase(tethering_h tethering, char **passphrase); - -/** - * @brief Reloads the settings (SSID / Passphrase / Security type / SSID visibility) for Wi-Fi AP. - * @since_tizen 2.3 - * @privlevel platform - * @privilege %http://tizen.org/privilege/tethering.admin - * @remarks Devices connected via MobileAP will be disconnected when the settings are reloaded. - * @param[in] tethering The tethering handle - * @param[in] callback The callback function to invoke - * @param[in] user_data The user data to be passed to the callback function - * @return 0 on success, otherwise negative error value - * @retval #TETHERING_ERROR_NONE Successful - * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed - */ -int tethering_wifi_ap_reload_settings(tethering_h tethering, tethering_wifi_ap_settings_reloaded_cb callback, void *user_data); -/** * @} */ diff --git a/include/tethering.xml b/include/tethering.xml index 4636834..ac8d415 100644 --- a/include/tethering.xml +++ b/include/tethering.xml @@ -55,22 +55,6 @@ - - - - - - - - - - - - - - - - @@ -80,15 +64,6 @@ - - - - - - - - - @@ -139,14 +114,6 @@ - - - - - - - - diff --git a/include/tethering_private.h b/include/tethering_private.h index 3572e13..3f64d28 100644 --- a/include/tethering_private.h +++ b/include/tethering_private.h @@ -155,9 +155,6 @@ typedef enum { MOBILE_AP_ENABLE_BT_TETHERING_CFM, MOBILE_AP_DISABLE_BT_TETHERING_CFM, - MOBILE_AP_ENABLE_WIFI_AP_CFM, - MOBILE_AP_DISABLE_WIFI_AP_CFM, - MOBILE_AP_GET_STATION_INFO_CFM, MOBILE_AP_GET_DATA_PACKET_USAGE_CFM } mobile_ap_event_e; @@ -166,7 +163,6 @@ typedef enum { MOBILE_AP_TYPE_WIFI, MOBILE_AP_TYPE_USB, MOBILE_AP_TYPE_BT, - MOBILE_AP_TYPE_WIFI_AP, MOBILE_AP_TYPE_MAX, } mobile_ap_type_e; @@ -178,8 +174,6 @@ typedef enum { E_SIGNAL_USB_TETHER_OFF, E_SIGNAL_BT_TETHER_ON, E_SIGNAL_BT_TETHER_OFF, - E_SIGNAL_WIFI_AP_ON, - E_SIGNAL_WIFI_AP_OFF, E_SIGNAL_NO_DATA_TIMEOUT, E_SIGNAL_LOW_BATTERY_MODE, E_SIGNAL_FLIGHT_MODE, @@ -207,8 +201,6 @@ typedef enum { #define SIGNAL_NAME_USB_TETHER_OFF "usb_off" #define SIGNAL_NAME_BT_TETHER_ON "bluetooth_on" #define SIGNAL_NAME_BT_TETHER_OFF "bluetooth_off" -#define SIGNAL_NAME_WIFI_AP_ON "wifi_ap_on" -#define SIGNAL_NAME_WIFI_AP_OFF "wifi_ap_off" #define SIGNAL_NAME_NO_DATA_TIMEOUT "no_data_timeout" #define SIGNAL_NAME_LOW_BATTERY_MODE "low_batt_mode" #define SIGNAL_NAME_FLIGHT_MODE "flight_mode" @@ -288,10 +280,7 @@ typedef struct { void *passphrase_user_data; tethering_wifi_settings_reloaded_cb settings_reloaded_cb; void *settings_reloaded_user_data; - tethering_wifi_ap_settings_reloaded_cb ap_settings_reloaded_cb; - void *ap_settings_reloaded_user_data; char *ssid; - char *ap_ssid; char passphrase[TETHERING_WIFI_KEY_MAX_LEN + 1]; tethering_wifi_security_type_e sec_type; tethering_wifi_mode_type_e mode_type; diff --git a/packaging/capi-network-tethering.spec b/packaging/capi-network-tethering.spec index 02894c1..cb3cd74 100644 --- a/packaging/capi-network-tethering.spec +++ b/packaging/capi-network-tethering.spec @@ -1,6 +1,6 @@ Name: capi-network-tethering Summary: Tethering Framework -Version: 1.0.33 +Version: 1.0.34 Release: 1 Group: System/Network License: Apache-2.0 diff --git a/src/tethering.c b/src/tethering.c index 8e5a043..632f057 100755 --- a/src/tethering.c +++ b/src/tethering.c @@ -61,14 +61,6 @@ static void __handle_bt_tether_off(GDBusConnection *connection, const gchar *sen const gchar *object_path, const gchar *interface_name, const gchar *signal_name, GVariant *parameters, gpointer user_data); -static void __handle_wifi_ap_on(GDBusConnection *connection, const gchar *sender_name, - const gchar *object_path, const gchar *interface_name, const gchar *signal_name, - GVariant *parameters, gpointer user_data); - -static void __handle_wifi_ap_off(GDBusConnection *connection, const gchar *sender_name, - const gchar *object_path, const gchar *interface_name, const gchar *signal_name, - GVariant *parameters, gpointer user_data); - static void __handle_net_closed(GDBusConnection *connection, const gchar *sender_name, const gchar *object_path, const gchar *interface_name, const gchar *signal_name, GVariant *parameters, gpointer user_data); @@ -109,8 +101,6 @@ static __tethering_sig_t sigs[] = { {0, SIGNAL_NAME_USB_TETHER_OFF, __handle_usb_tether_off}, {0, SIGNAL_NAME_BT_TETHER_ON, __handle_bt_tether_on}, {0, SIGNAL_NAME_BT_TETHER_OFF, __handle_bt_tether_off}, - {0, SIGNAL_NAME_WIFI_AP_ON, __handle_wifi_ap_on}, - {0, SIGNAL_NAME_WIFI_AP_OFF, __handle_wifi_ap_off}, {0, SIGNAL_NAME_NO_DATA_TIMEOUT, __handle_no_data_timeout}, {0, SIGNAL_NAME_LOW_BATTERY_MODE, __handle_low_battery_mode}, {0, SIGNAL_NAME_FLIGHT_MODE, __handle_flight_mode}, @@ -146,8 +136,7 @@ static bool __any_tethering_is_enabled(tethering_h tethering) { if (tethering_is_enabled(tethering, TETHERING_TYPE_USB) || tethering_is_enabled(tethering, TETHERING_TYPE_WIFI) || - tethering_is_enabled(tethering, TETHERING_TYPE_BT) || - tethering_is_enabled(tethering, TETHERING_TYPE_RESERVED)) + tethering_is_enabled(tethering, TETHERING_TYPE_BT)) return true; return false; @@ -356,9 +345,7 @@ static void __handle_dhcp(GDBusConnection *connection, const gchar *sender_name, type = TETHERING_TYPE_WIFI; else if (ap_type == MOBILE_AP_TYPE_BT) type = TETHERING_TYPE_BT; - else if (ap_type == MOBILE_AP_TYPE_WIFI_AP) { - type = TETHERING_TYPE_RESERVED; - } else { + else { ERR("Not supported tethering type [%d]\n", ap_type); goto DONE; } @@ -571,60 +558,6 @@ static void __handle_bt_tether_off(GDBusConnection *connection, const gchar *sen DBG("-\n"); } -static void __handle_wifi_ap_on(GDBusConnection *connection, const gchar *sender_name, - const gchar *object_path, const gchar *interface_name, const gchar *signal_name, - GVariant *parameters, gpointer user_data) -{ - DBG("+\n"); - - _retm_if(user_data == NULL, "parameter(user_data) is NULL\n"); - - __tethering_h *th = (__tethering_h *)user_data; - tethering_type_e type = TETHERING_TYPE_RESERVED; - bool is_requested = false; - tethering_enabled_cb ecb = NULL; - void *data = NULL; - - ecb = th->enabled_cb[type]; - if (ecb == NULL) - return; - data = th->enabled_user_data[type]; - - ecb(TETHERING_ERROR_NONE, type, is_requested, data); - DBG("-\n"); -} - -static void __handle_wifi_ap_off(GDBusConnection *connection, const gchar *sender_name, - const gchar *object_path, const gchar *interface_name, const gchar *signal_name, - GVariant *parameters, gpointer user_data) -{ - DBG("+\n"); - - _retm_if(user_data == NULL, "parameter(user_data) is NULL\n"); - - __tethering_h *th = (__tethering_h *)user_data; - tethering_type_e type = TETHERING_TYPE_RESERVED; - tethering_disabled_cause_e code = TETHERING_DISABLED_BY_OTHERS; - tethering_disabled_cb dcb = NULL; - void *data = NULL; - char *buf = NULL; - - dcb = th->disabled_cb[type]; - if (dcb == NULL) - return; - data = th->disabled_user_data[type]; - g_variant_get(parameters, "(s)", &buf); - if (!g_strcmp0(buf, SIGNAL_MSG_NOT_AVAIL_INTERFACE)) - code = TETHERING_DISABLED_BY_WIFI_ON; - else if (!g_strcmp0(buf, SIGNAL_MSG_TIMEOUT)) - code = TETHERING_DISABLED_BY_TIMEOUT; - g_free(buf); - - dcb(TETHERING_ERROR_NONE, type, code, data); - - DBG("-\n"); -} - static void __handle_no_data_timeout(GDBusConnection *connection, const gchar *sender_name, const gchar *object_path, const gchar *interface_name, const gchar *signal_name, GVariant *parameters, gpointer user_data) @@ -664,7 +597,7 @@ static void __handle_low_battery_mode(GDBusConnection *connection, const gchar * void *data = NULL; tethering_disabled_cause_e code = TETHERING_DISABLED_BY_LOW_BATTERY; - for (type = TETHERING_TYPE_USB; type <= TETHERING_TYPE_RESERVED; type++) { + for (type = TETHERING_TYPE_USB; type <= TETHERING_TYPE_BT; type++) { dcb = th->disabled_cb[type]; if (dcb == NULL) continue; @@ -689,7 +622,7 @@ static void __handle_flight_mode(GDBusConnection *connection, const gchar *sende void *data = NULL; tethering_disabled_cause_e code = TETHERING_DISABLED_BY_FLIGHT_MODE; - for (type = TETHERING_TYPE_USB; type <= TETHERING_TYPE_RESERVED; type++) { + for (type = TETHERING_TYPE_USB; type <= TETHERING_TYPE_BT; type++) { dcb = th->disabled_cb[type]; if (dcb == NULL) continue; @@ -934,56 +867,6 @@ static void __usb_enabled_cfm_cb(GObject *source_object, GAsyncResult *res, DBG("-\n"); } -static void __wifi_ap_enabled_cfm_cb(GObject *source_object, GAsyncResult *res, - gpointer user_data) -{ - DBG("+\n"); - - _retm_if(user_data == NULL, "parameter(user_data) is NULL\n"); - __tethering_h *th = (__tethering_h *)user_data; - GError *g_error = NULL; - GVariant *g_var; - guint info; - tethering_error_e error; - tethering_enabled_cb ecb = th->enabled_cb[TETHERING_TYPE_RESERVED]; - void *data = th->enabled_user_data[TETHERING_TYPE_RESERVED]; - - g_var = g_dbus_proxy_call_finish(th->client_bus_proxy, res, &g_error); - if (g_error) { - ERR("DBus error [%s]\n", g_error->message); - if (g_error->code == G_DBUS_ERROR_NO_REPLY && - ++retry < TETHERING_ERROR_RECOVERY_MAX) { - g_error_free(g_error); - tethering_enable((tethering_h)th, TETHERING_TYPE_RESERVED); - DBG("-\n"); - return; - } - if (g_error->code == G_DBUS_ERROR_ACCESS_DENIED) - error = TETHERING_ERROR_PERMISSION_DENIED; - else - error = TETHERING_ERROR_OPERATION_FAILED; - g_error_free(g_error); - } else { - g_variant_get(g_var, "(u)", &info); - g_variant_unref(g_var); - error = __get_error(info); - } - retry = 0; - - sigs[E_SIGNAL_WIFI_AP_ON].sig_id = g_dbus_connection_signal_subscribe(th->client_bus, - NULL, TETHERING_SERVICE_INTERFACE, sigs[E_SIGNAL_WIFI_AP_ON].name, - TETHERING_SERVICE_OBJECT_PATH, NULL, G_DBUS_SIGNAL_FLAGS_NONE, - sigs[E_SIGNAL_WIFI_AP_ON].cb, (gpointer)th, NULL); - - if (!ecb) { - DBG("-\n"); - return; - } - - ecb(error, TETHERING_TYPE_RESERVED, true, data); - DBG("-\n"); -} - static void __disabled_cfm_cb(GObject *source_object, GAsyncResult *res, gpointer user_data) { @@ -1052,19 +935,6 @@ static void __disabled_cfm_cb(GObject *source_object, GAsyncResult *res, dcb(error, type, code, data); break; - case MOBILE_AP_DISABLE_WIFI_AP_CFM: - sigs[E_SIGNAL_WIFI_AP_OFF].sig_id = g_dbus_connection_signal_subscribe(th->client_bus, - NULL, TETHERING_SERVICE_INTERFACE, sigs[E_SIGNAL_WIFI_AP_OFF].name, - TETHERING_SERVICE_OBJECT_PATH, NULL, G_DBUS_SIGNAL_FLAGS_NONE, - sigs[E_SIGNAL_WIFI_AP_OFF].cb, (gpointer)th, NULL); - - type = TETHERING_TYPE_RESERVED; - dcb = th->disabled_cb[type]; - data = th->disabled_user_data[type]; - if (dcb) - dcb(error, type, code, data); - break; - case MOBILE_AP_DISABLE_CFM: sigs[E_SIGNAL_WIFI_TETHER_OFF].sig_id = g_dbus_connection_signal_subscribe(th->client_bus, @@ -1177,43 +1047,6 @@ static void __settings_reloaded_cb(GObject *source_object, GAsyncResult *res, DBG("-\n"); } -static void __ap_settings_reloaded_cb(GObject *source_object, GAsyncResult *res, - gpointer user_data) -{ - DBG("+\n"); - - _retm_if(user_data == NULL, "parameter(user_data) is NULL\n"); - GError *g_error = NULL; - GVariant *g_var; - guint info; - __tethering_h *th = (__tethering_h *)user_data; - tethering_error_e tethering_error; - - g_var = g_dbus_proxy_call_finish(th->client_bus_proxy, res, &g_error); - if (g_error) { - ERR("DBus fail [%s]\n", g_error->message); - if (g_error->code == G_DBUS_ERROR_ACCESS_DENIED) - tethering_error = TETHERING_ERROR_PERMISSION_DENIED; - else - tethering_error = TETHERING_ERROR_OPERATION_FAILED; - g_error_free(g_error); - } - if (th->ap_settings_reloaded_cb == NULL) { - DBG("There is no settings_reloaded_cb\n-\n"); - return; - } - g_variant_get(g_var, "(u)", &info); - tethering_error = __get_error(info); - g_variant_unref(g_var); - - th->ap_settings_reloaded_cb(tethering_error, - th->ap_settings_reloaded_user_data); - - th->ap_settings_reloaded_cb = NULL; - th->ap_settings_reloaded_user_data = NULL; - DBG("-\n"); -} - static void __connect_signals(tethering_h tethering) { DBG("+\n"); @@ -1267,10 +1100,6 @@ static bool __get_intf_name(tethering_type_e type, char *buf, unsigned int len) g_strlcpy(buf, TETHERING_BT_IF, len); break; - case TETHERING_TYPE_RESERVED: - g_strlcpy(buf, TETHERING_WIFI_IF, len); - break; - default: ERR("Not supported type : %d\n", type); return false; @@ -1295,10 +1124,6 @@ static bool __get_gateway_addr(tethering_type_e type, char *buf, unsigned int le g_strlcpy(buf, TETHERING_BT_GATEWAY, len); break; - case TETHERING_TYPE_RESERVED: - g_strlcpy(buf, TETHERING_WIFI_GATEWAY, len); - break; - default: ERR("Not supported type : %d\n", type); return false; @@ -1427,30 +1252,6 @@ static int __prepare_wifi_settings(tethering_h tethering, _softap_settings_t *se return TETHERING_ERROR_NONE; } -static int __prepare_wifi_ap_settings(tethering_h tethering, _softap_settings_t *set) -{ - DBG("+\n"); - - __tethering_h *th = (__tethering_h *)tethering; - - if (th == NULL || set == NULL) { - ERR("null parameter\n"); - return TETHERING_ERROR_INVALID_PARAMETER; - } - - g_strlcpy(set->ssid, th->ap_ssid, sizeof(set->ssid)); - set->sec_type = th->sec_type; - set->visibility = th->visibility; - - if (set->sec_type == TETHERING_WIFI_SECURITY_TYPE_NONE) - g_strlcpy(set->key, "", sizeof(set->key)); - else - g_strlcpy(set->key, th->passphrase, sizeof(set->key)); - - DBG("-\n"); - return TETHERING_ERROR_NONE; -} - static bool __check_precondition(tethering_type_e type) { int dnet_state = 0; @@ -1533,13 +1334,6 @@ API int tethering_create(tethering_h *tethering) return TETHERING_ERROR_OPERATION_FAILED; } - th->ap_ssid = g_strdup(ssid); - if (th->ap_ssid == NULL) { - ERR("g_strdup failed\n"); - free(th); - return TETHERING_ERROR_OPERATION_FAILED; - } - #if !GLIB_CHECK_VERSION(2, 36, 0) g_type_init(); #endif @@ -1550,7 +1344,6 @@ API int tethering_create(tethering_h *tethering) g_error_free(error); g_cancellable_cancel(cancellable); g_object_unref(cancellable); - g_free(th->ap_ssid); free(th); return TETHERING_ERROR_OPERATION_FAILED; } @@ -1565,7 +1358,6 @@ API int tethering_create(tethering_h *tethering) g_cancellable_cancel(th->cancellable); g_object_unref(th->cancellable); g_object_unref(th->client_bus); - g_free(th->ap_ssid); free(th); return TETHERING_ERROR_OPERATION_FAILED; } @@ -1604,8 +1396,6 @@ API int tethering_destroy(tethering_h tethering) if (th->ssid) free(th->ssid); - if (th->ap_ssid) - free(th->ap_ssid); g_object_unref(th->cancellable); g_object_unref(th->client_bus_proxy); @@ -1650,8 +1440,7 @@ API int tethering_enable(tethering_h tethering, tethering_type_e type) g_dbus_proxy_set_default_timeout(proxy, DBUS_TIMEOUT_INFINITE); - if (type != TETHERING_TYPE_RESERVED - && __check_precondition(type) == FALSE) { + if (__check_precondition(type) == FALSE) { DBG("-\n"); return TETHERING_ERROR_OPERATION_FAILED; } @@ -1695,23 +1484,6 @@ API int tethering_enable(tethering_h tethering, tethering_type_e type) break; - case TETHERING_TYPE_RESERVED: { - _softap_settings_t set = {"", "", "", 0, false}; - - ret = __prepare_wifi_ap_settings(tethering, &set); - if (ret != TETHERING_ERROR_NONE) { - ERR("softap settings initialization failed\n"); - return TETHERING_ERROR_OPERATION_FAILED; - } - - g_dbus_connection_signal_unsubscribe(connection, - sigs[E_SIGNAL_WIFI_AP_ON].sig_id); - - g_dbus_proxy_call(proxy, "enable_wifi_ap", - g_variant_new("(ssii)", set.ssid, set.key, set.visibility, set.sec_type), - G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable, (GAsyncReadyCallback) __wifi_ap_enabled_cfm_cb, (gpointer)tethering); - break; - } case TETHERING_TYPE_ALL: { _softap_settings_t set = {"", "", "", 0, false}; @@ -1821,15 +1593,6 @@ API int tethering_disable(tethering_h tethering, tethering_type_e type) (GAsyncReadyCallback) __disabled_cfm_cb, (gpointer)tethering); break; - case TETHERING_TYPE_RESERVED: - g_dbus_connection_signal_unsubscribe(connection, - sigs[E_SIGNAL_WIFI_AP_OFF].sig_id); - - g_dbus_proxy_call(proxy, "disable_wifi_ap", - NULL, G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable, - (GAsyncReadyCallback) __disabled_cfm_cb, (gpointer)tethering); - break; - case TETHERING_TYPE_ALL: g_dbus_connection_signal_unsubscribe(connection, sigs[E_SIGNAL_USB_TETHER_OFF].sig_id); @@ -1895,10 +1658,6 @@ API bool tethering_is_enabled(tethering_h tethering, tethering_type_e type) vconf_type = VCONFKEY_MOBILE_HOTSPOT_MODE_BT; break; - case TETHERING_TYPE_RESERVED: - vconf_type = VCONFKEY_MOBILE_HOTSPOT_MODE_WIFI_AP; - break; - default: ERR("Not supported type : %d\n", type); break; @@ -2278,8 +2037,6 @@ API int tethering_foreach_connected_clients(tethering_h tethering, tethering_typ client.interface = TETHERING_TYPE_WIFI; else if (interface == MOBILE_AP_TYPE_BT) client.interface = TETHERING_TYPE_BT; - else if (interface == MOBILE_AP_TYPE_WIFI_AP) - client.interface = TETHERING_TYPE_RESERVED; else { ERR("Invalid interface\n"); g_free(key); @@ -2287,8 +2044,7 @@ API int tethering_foreach_connected_clients(tethering_h tethering, tethering_typ break; } DBG("interface is %d\n", client.interface); - if (client.interface != type && (TETHERING_TYPE_ALL != type && - client.interface != TETHERING_TYPE_RESERVED)) { + if (client.interface != type && (TETHERING_TYPE_ALL != type)) { g_free(key); g_variant_unref(value); break; @@ -3444,326 +3200,3 @@ API int tethering_wifi_is_dhcp_enabled(tethering_h tethering, bool *dhcp_enabled return TETHERING_ERROR_NONE; } - -/** - * @internal - * @brief Sets the security type of Wi-Fi AP. - * @since_tizen 2.3 - * @privlevel platform - * @privilege http://tizen.org/privilege/tethering.admin - * @details If security type is not set, WPA2_PSK is used - * @param[in] tethering The handle of tethering - * @param[in] type The security type - * @return 0 on success, otherwise negative error value. - * @retval #TETHERING_ERROR_NONE Successful - * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed - * @see tethering_wifi_ap_get_security_type() - */ -API int tethering_wifi_ap_set_security_type(tethering_h tethering, tethering_wifi_security_type_e type) -{ - CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE, TETHERING_WIFI_FEATURE); - - _retvm_if(tethering == NULL, TETHERING_ERROR_INVALID_PARAMETER, - "parameter(tethering) is NULL\n"); - - __tethering_h *th = (__tethering_h *)tethering; - th->sec_type = type; - return TETHERING_ERROR_NONE; -} - -/** - * @internal - * @brief Gets the security type of Wi-Fi AP. - * @since_tizen 2.3 - * @privlevel platform - * @privilege http://tizen.org/privilege/tethering.admin - * @details If security type is not set, WPA2_PSK is used - * @param[in] tethering The handle of tethering - * @param[out] type The security type - * @return 0 on success, otherwise negative error value. - * @retval #TETHERING_ERROR_NONE Successful - * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter - * @see tethering_wifi_ap_set_security_type() - */ -API int tethering_wifi_ap_get_security_type(tethering_h tethering, tethering_wifi_security_type_e *type) -{ - CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE, TETHERING_WIFI_FEATURE); - - _retvm_if(type == NULL, TETHERING_ERROR_INVALID_PARAMETER, - "parameter(type) is NULL\n"); - - __tethering_h *th = (__tethering_h *)tethering; - - *type = th->sec_type; - return TETHERING_ERROR_NONE; -} - -/** - * @internal - * @brief Sets the SSID (service set identifier) for Wi-Fi AP. The SSID cannot exceed 32 bytes. - * @since_tizen 2.3 - * @privlevel platform - * @privilege http://tizen.org/privilege/tethering.admin - * @details If SSID is not set, Device name is used as SSID - * @param[in] tethering The handle of tethering - * @param[in] ssid The SSID - * @return 0 on success, otherwise negative error value. - * @retval #TETHERING_ERROR_NONE Successful - * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory - */ -API int tethering_wifi_ap_set_ssid(tethering_h tethering, const char *ssid) -{ - CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE, TETHERING_WIFI_FEATURE); - - _retvm_if(tethering == NULL, TETHERING_ERROR_INVALID_PARAMETER, - "parameter(tethering) is NULL\n"); - _retvm_if(ssid == NULL, TETHERING_ERROR_INVALID_PARAMETER, - "parameter(ssid) is NULL\n"); - - __tethering_h *th = (__tethering_h *)tethering; - char *p_ssid = NULL; - int ssid_len = 0; - - ssid_len = strlen(ssid); - if (ssid_len > TETHERING_WIFI_SSID_MAX_LEN) { - ERR("parameter(ssid) is too long"); - return TETHERING_ERROR_INVALID_PARAMETER; - } - - p_ssid = strdup(ssid); - if (p_ssid == NULL) { - ERR("strdup failed\n"); - return TETHERING_ERROR_OUT_OF_MEMORY; - } - - if (th->ap_ssid) - g_free(th->ap_ssid); - th->ap_ssid = p_ssid; - - return TETHERING_ERROR_NONE; -} - -/** - * @internal - * @brief Gets the SSID (service set identifier) for Wi-Fi AP. - * @since_tizen 2.3 - * @privlevel platform - * @privilege http://tizen.org/privilege/tethering.admin - * @details If SSID is not set, Device name is used as SSID - * @remarks @a ssid must be released with free() by you. - * @param[in] tethering The handle of tethering - * @param[out] ssid The SSID - * @return 0 on success, otherwise negative error value. - * @retval #TETHERING_ERROR_NONE Successful - * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory - */ -API int tethering_wifi_ap_get_ssid(tethering_h tethering, char **ssid) -{ - CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE, TETHERING_WIFI_FEATURE); - - _retvm_if(tethering == NULL, TETHERING_ERROR_INVALID_PARAMETER, - "parameter(tethering) is NULL\n"); - _retvm_if(ssid == NULL, TETHERING_ERROR_INVALID_PARAMETER, - "parameter(ssid) is NULL\n"); - - __tethering_h *th = (__tethering_h *)tethering; - - *ssid = g_strdup(th->ap_ssid); - if (*ssid == NULL) { - ERR("strdup failed\n"); - return TETHERING_ERROR_OUT_OF_MEMORY; - } - - return TETHERING_ERROR_NONE; -} - -/** - * @internal - * @brief Sets the visibility of SSID(service set identifier) for Wi-Fi AP. - * @since_tizen 2.3 - * @privlevel platform - * @privilege http://tizen.org/privilege/tethering.admin - * @details If you set the visibility invisible, then the SSID of this device is hidden. So, Wi-Fi scan can't find your device. - * @details by default visibility is set to true. - * @remarks This change is applied next time Wi-Fi tethering is enabled - * @param[in] tethering The handle of tethering - * @param[in] visible The visibility of SSID: (@c true = visible, @c false = invisible) - * @return 0 on success, otherwise negative error value. - * @retval #TETHERING_ERROR_NONE Successful - * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed - * @see tethering_wifi_ap_get_ssid_visibility() - */ -API int tethering_wifi_ap_set_ssid_visibility(tethering_h tethering, bool visible) -{ - CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE, TETHERING_WIFI_FEATURE); - - _retvm_if(tethering == NULL, TETHERING_ERROR_INVALID_PARAMETER, - "parameter(tethering) is NULL\n"); - - __tethering_h *th = (__tethering_h *)tethering; - th->visibility = visible; - return TETHERING_ERROR_NONE; -} - -/** - * @internal - * @brief Gets the visibility of SSID(service set identifier) for Wi-Fi AP. - * @since_tizen 2.3 - * @privlevel platform - * @privilege http://tizen.org/privilege/tethering.admin - * @details If the visibility is set invisible, then the SSID of this device is hidden. So, Wi-Fi scan can't find your device. - * @details by default visibility is set to true. - * @param[in] tethering The handle of tethering - * @param[out] visible The visibility of SSID: (@c true = visible, @c false = invisible) - * @return 0 on success, otherwise negative error value. - * @retval #TETHERING_ERROR_NONE Successful - * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter - * @see tethering_wifi_ap_set_ssid_visibility() - */ -API int tethering_wifi_ap_get_ssid_visibility(tethering_h tethering, bool *visible) -{ - CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE, TETHERING_WIFI_FEATURE); - - _retvm_if(visible == NULL, TETHERING_ERROR_INVALID_PARAMETER, - "parameter(visible) is NULL\n"); - - __tethering_h *th = (__tethering_h *)tethering; - - *visible = th->visibility; - return TETHERING_ERROR_NONE; -} - -/** - * @internal - * @brief Sets the passphrase for Wi-Fi AP. - * @since_tizen 2.3 - * @privlevel platform - * @privilege http://tizen.org/privilege/tethering.admin - * @details If the passphrase is not set, random string of 8 alphabets will be used. - * @param[in] tethering The handle of tethering - * @param[in] passphrase The passphrase - * @return 0 on success, otherwise negative error value. - * @retval #TETHERING_ERROR_NONE Successful - * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter - * @see tethering_wifi_ap_get_passphrase() - */ -API int tethering_wifi_ap_set_passphrase(tethering_h tethering, const char *passphrase) -{ - CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE, TETHERING_WIFI_FEATURE); - - _retvm_if(tethering == NULL, TETHERING_ERROR_INVALID_PARAMETER, - "parameter(tethering) is NULL\n"); - _retvm_if(passphrase == NULL, TETHERING_ERROR_INVALID_PARAMETER, - "parameter(passphrase) is NULL\n"); - - __tethering_h *th = (__tethering_h *)tethering; - int passphrase_len = 0; - - passphrase_len = strlen(passphrase); - - if (passphrase_len < TETHERING_WIFI_KEY_MIN_LEN || - passphrase_len > TETHERING_WIFI_KEY_MAX_LEN) { - ERR("parameter(passphrase) is too short or long\n"); - return TETHERING_ERROR_INVALID_PARAMETER; - } - - if (!g_strcmp0(passphrase, th->passphrase)) - return TETHERING_ERROR_NONE; - - g_strlcpy(th->passphrase, passphrase, sizeof(th->passphrase)); - return TETHERING_ERROR_NONE; -} - -/** - * @internal - * @brief Gets the passphrase for Wi-Fi AP. - * @since_tizen 2.3 - * @privlevel platform - * @privilege http://tizen.org/privilege/tethering.admin - * @details If the passphrase is not set, random string of 8 alphabets will be used. - * @remarks @a passphrase must be released with free() by you. - * @param[in] tethering The handle of tethering - * @param[out] passphrase The passphrase - * @return 0 on success, otherwise negative error value. - * @retval #TETHERING_ERROR_NONE Successful - * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #TETHERING_ERROR_OUT_OF_MEMORY Out of memory - * @see tethering_wifi_ap_set_passphrase() - */ -API int tethering_wifi_ap_get_passphrase(tethering_h tethering, char **passphrase) -{ - CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE, TETHERING_WIFI_FEATURE); - - _retvm_if(tethering == NULL, TETHERING_ERROR_INVALID_PARAMETER, - "parameter(tethering) is NULL\n"); - _retvm_if(passphrase == NULL, TETHERING_ERROR_INVALID_PARAMETER, - "parameter(passphrase) is NULL\n"); - - __tethering_h *th = (__tethering_h *)tethering; - - *passphrase = g_strdup(th->passphrase); - if (*passphrase == NULL) { - ERR("strdup is failed\n"); - return TETHERING_ERROR_OUT_OF_MEMORY; - } - - return TETHERING_ERROR_NONE; -} - -/** - * @internal - * @brief Reload the settings (SSID / Passphrase / Security type / SSID visibility) for Wi-Fi AP. - * @since_tizen 2.3 - * @privlevel platform - * @privilege http://tizen.org/privilege/tethering.admin - * @remarks Connected devices via MobileAP will be disconnected when the settings are reloaded - * @param[in] tethering The handle of tethering - * @param[in] callback The callback function to invoke - * @param[in] user_data The user data to be passed to the callback function - * @return 0 on success, otherwise negative error value. - * @retval #TETHERING_ERROR_NONE Successful - * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #TETHERING_ERROR_OPERATION_FAILED Operation failed - */ -API int tethering_wifi_ap_reload_settings(tethering_h tethering, tethering_wifi_ap_settings_reloaded_cb callback, void *user_data) - -{ - CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE, TETHERING_WIFI_FEATURE); - - _retvm_if(tethering == NULL, TETHERING_ERROR_INVALID_PARAMETER, - "parameter(tethering) is NULL\n"); - _retvm_if(callback == NULL, TETHERING_ERROR_INVALID_PARAMETER, - "parameter(callback) is NULL\n"); - - __tethering_h *th = (__tethering_h *)tethering; - _softap_settings_t set = {"", "", "", 0, false}; - GDBusProxy *proxy = th->client_bus_proxy; - int ret = 0; - - DBG("+\n"); - - if (th->ap_settings_reloaded_cb) { - ERR("Operation in progress\n"); - return TETHERING_ERROR_OPERATION_FAILED; - } - - ret = __prepare_wifi_ap_settings(tethering, &set); - if (ret != TETHERING_ERROR_NONE) { - ERR("softap settings initialization failed\n"); - return TETHERING_ERROR_OPERATION_FAILED; - } - - th->ap_settings_reloaded_cb = callback; - th->ap_settings_reloaded_user_data = user_data; - - g_dbus_proxy_call(proxy, "reload_wifi_ap_settings", - g_variant_new("(ssii)", set.ssid, set.key, set.visibility, set.sec_type), - G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable, - (GAsyncReadyCallback) __ap_settings_reloaded_cb, (gpointer)tethering); - - return TETHERING_ERROR_NONE; -} diff --git a/test/tethering_test.c b/test/tethering_test.c index 1f9982b..96d768b 100755 --- a/test/tethering_test.c +++ b/test/tethering_test.c @@ -99,10 +99,6 @@ static const char *__convert_tethering_type_to_str(const tethering_type_e type) g_strlcpy(str_buf, "Bluetooth Tethering", sizeof(str_buf)); break; - case TETHERING_TYPE_RESERVED: - g_strlcpy(str_buf, "Wi-Fi AP", sizeof(str_buf)); - break; - default: g_strlcpy(str_buf, "Unknown", sizeof(str_buf)); break; @@ -169,31 +165,16 @@ static void __register_cbs(tethering_h th, __tethering_cbs *cbs, void *user_data if (__is_err(ret) == true) g_print("tethering_set_enabled_cb is failed\n"); - ret = tethering_set_enabled_cb(th, TETHERING_TYPE_RESERVED, - cbs->enabled_cb, user_data); - if (__is_err(ret) == true) - g_print("tethering_set_enabled_cb is failed\n"); - ret = tethering_set_disabled_cb(th, TETHERING_TYPE_ALL, cbs->disabled_cb, user_data); if (__is_err(ret) == true) g_print("tethering_set_disabled_cb is failed\n"); - ret = tethering_set_disabled_cb(th, TETHERING_TYPE_RESERVED, - cbs->disabled_cb, user_data); - if (__is_err(ret) == true) - g_print("tethering_set_disabled_cb is failed\n"); - ret = tethering_set_connection_state_changed_cb(th, TETHERING_TYPE_ALL, cbs->changed_cb, user_data); if (__is_err(ret) == true) g_print("tethering_set_connection_state_changed_cb is failed\n"); - ret = tethering_set_connection_state_changed_cb(th, TETHERING_TYPE_RESERVED, - cbs->changed_cb, user_data); - if (__is_err(ret) == true) - g_print("tethering_set_connection_state_changed_cb is failed\n"); - ret = tethering_wifi_set_security_type_changed_cb(th, cbs->security_type_changed_cb, user_data); if (__is_err(ret) == true) @@ -220,26 +201,14 @@ static void __deregister_cbs(tethering_h th) if (__is_err(ret) == true) g_print("tethering_unset_enabled_cb is failed\n"); - ret = tethering_unset_enabled_cb(th, TETHERING_TYPE_RESERVED); - if (__is_err(ret) == true) - g_print("tethering_unset_enabled_cb is failed\n"); - ret = tethering_unset_disabled_cb(th, TETHERING_TYPE_ALL); if (__is_err(ret) == true) g_print("tethering_unset_disabled_cb is failed\n"); - ret = tethering_unset_disabled_cb(th, TETHERING_TYPE_RESERVED); - if (__is_err(ret) == true) - g_print("tethering_unset_disabled_cb is failed\n"); - ret = tethering_unset_connection_state_changed_cb(th, TETHERING_TYPE_ALL); if (__is_err(ret) == true) g_print("tethering_unset_connection_state_changed_cb is failed\n"); - ret = tethering_unset_connection_state_changed_cb(th, TETHERING_TYPE_RESERVED); - if (__is_err(ret) == true) - g_print("tethering_unset_connection_state_changed_cb is failed\n"); - ret = tethering_wifi_unset_security_type_changed_cb(th); if (__is_err(ret) == true) g_print("tethering_wifi_unset_security_type_changed_cb is failed\n"); @@ -549,57 +518,12 @@ static void __print_wifi_tethering_setting(tethering_h th) return; } -static void __print_wifi_ap_setting(tethering_h th) -{ - char *ssid = NULL; - char *passphrase = NULL; - bool visibility = false; - tethering_wifi_security_type_e security_type = TETHERING_WIFI_SECURITY_TYPE_NONE; - - int error = TETHERING_ERROR_NONE; - - error = tethering_wifi_ap_get_ssid(th, &ssid); - if (error != TETHERING_ERROR_NONE) - __is_err(error); - else - g_print("\n\t** WiFi AP SSID : %s\n", ssid); - - error = tethering_wifi_ap_get_passphrase(th, &passphrase); - if (error != TETHERING_ERROR_NONE) - __is_err(error); - else - g_print("\t** WiFi AP passphrase : %s\n", passphrase); - - error = tethering_wifi_ap_get_ssid_visibility(th, &visibility); - if (error != TETHERING_ERROR_NONE) - __is_err(error); - else - g_print("\t** WiFi AP ssid visibility : %s\n", - visibility ? "visible" : "invisible"); - - error = tethering_wifi_ap_get_security_type(th, &security_type); - if (error != TETHERING_ERROR_NONE) - __is_err(error); - else - g_print("\t** WiFi AP security_type : %s\n", - security_type == - TETHERING_WIFI_SECURITY_TYPE_NONE ? - "open" : "wpa2-psk"); - - if (ssid) - free(ssid); - if (passphrase) - free(passphrase); - - return; -} - bool __get_tethering_type(tethering_type_e *type) { int sel; int ret; - printf("Select tethering type (1:Wi-Fi, 2:BT, 3:USB 4:WiFi AP, 5:ALL)\n"); + printf("Select tethering type (1:Wi-Fi, 2:BT, 3:USB 4:ALL)\n"); ret = scanf("%9d", &sel); if (ret < 0) { printf("scanf is failed!!\n"); @@ -617,9 +541,6 @@ bool __get_tethering_type(tethering_type_e *type) *type = TETHERING_TYPE_USB; break; case 4: - *type = TETHERING_TYPE_RESERVED; - break; - case 5: *type = TETHERING_TYPE_ALL; break; default: @@ -743,12 +664,6 @@ static int test_tethering_wifi_get_setting(void) return 1; } -static int test_tethering_wifi_ap_get_setting(void) -{ - __print_wifi_ap_setting(th); - return 1; -} - static int test_tethering_wifi_set_ssid(void) { int ret; @@ -978,86 +893,6 @@ static int test_tethering_manage_mac_list(void) return 1; } -static int test_tethering_wifi_ap_set_ssid(void) -{ - int ret; - char ssid[100]; - - printf("Input SSID for Wi-Fi AP tethering: "); - ret = scanf("%99s", ssid); - if (ret < 0) { - printf("scanf is failed!!\n"); - return -1; - } - - ret = tethering_wifi_ap_set_ssid(th, ssid); - if (__is_err(ret) == true) { - printf("Fail to set wifi ap ssid!!\n"); - return -1; - } - return 1; -} - -static int test_tethering_wifi_ap_set_security_type(void) -{ - int ret; - int security_type; - - printf("Input security type for Wi-Fi AP tethering (0:NONE, 1:WPA2_PSK)"); - ret = scanf("%9d", &security_type); - if (ret < 0) { - printf("scanf is failed!!\n"); - return -1; - } - - ret = tethering_wifi_ap_set_security_type(th, security_type); - if (__is_err(ret) == true) { - printf("Fail to set security type!!\n"); - return -1; - } - return 1; -} - -static int test_tethering_wifi_ap_set_visibility(void) -{ - int ret; - int visibility; - - printf("Input security type for Wi-Fi tethering (0:invisible, 1:visible)"); - ret = scanf("%9d", &visibility); - if (ret < 0) { - printf("scanf is failed!!\n"); - return -1; - } - - ret = tethering_wifi_ap_set_ssid_visibility(th, visibility); - if (__is_err(ret) == true) { - printf("Fail to set visibility!!\n"); - return -1; - } - return 1; -} - -static int test_tethering_wifi_ap_set_passphrase(void) -{ - int ret; - char passphrase[100]; - - printf("Input passphrase for Wi-Fi tethering: "); - ret = scanf("%99s", passphrase); - if (ret < 0) { - printf("scanf is failed!!\n"); - return -1; - } - - ret = tethering_wifi_ap_set_passphrase(th, passphrase); - if (__is_err(ret) == true) { - printf("Fail to set passphrase!!\n"); - return -1; - } - return 1; -} - static int test_tethering_wifi_reload_settings(void) { int ret = tethering_wifi_reload_settings(th, __settings_reloaded_cb, NULL); @@ -1069,17 +904,6 @@ static int test_tethering_wifi_reload_settings(void) return 1; } -static int test_tethering_wifi_ap_reload_settings(void) -{ - int ret = tethering_wifi_ap_reload_settings(th, __settings_reloaded_cb, NULL); - - if (__is_err(ret) == true) { - printf("Fail to reload wifi tethering!!\n"); - return -1; - } - return 1; -} - int main(int argc, char **argv) { GMainLoop *mainloop; @@ -1120,19 +944,13 @@ gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data) printf("6 - Get interface information\n"); printf("7 - Get data usage\n"); printf("8 - Get Wi-Fi tethering setting\n"); - printf("9 - Get Wi-Fi AP setting\n"); printf("a - Set Wi-Fi tethering SSID\n"); printf("b - Set Wi-Fi tethering security type\n"); printf("c - Set Wi-Fi tethering visibility\n"); printf("d - Set Wi-Fi tethering passphrase\n"); printf("e - Set Wi-Fi tethering mac filtering\n"); printf("f - Add/Remove MAC adress to/from allowed/blocked list\n"); - printf("g - Set Wi-Fi AP SSID\n"); - printf("h - Set Wi-Fi AP security type\n"); - printf("i - Set Wi-Fi AP visibility\n"); - printf("j - Set Wi-Fi AP passphrase\n"); printf("k - Reload Wi-Fi tethering\n"); - printf("l - Reload Wi-Fi AP\n"); printf("m - Set Wi-Fi channel\n"); printf("n - Set Wi-Fi hw_mode\n"); printf("o - Enable dhcp server\n"); @@ -1167,9 +985,6 @@ gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data) case '8': rv = test_tethering_wifi_get_setting(); break; - case '9': - rv = test_tethering_wifi_ap_get_setting(); - break; case 'a': rv = test_tethering_wifi_set_ssid(); break; @@ -1188,24 +1003,9 @@ gboolean test_thread(GIOChannel *source, GIOCondition condition, gpointer data) case 'f': rv = test_tethering_manage_mac_list(); break; - case 'g': - rv = test_tethering_wifi_ap_set_ssid(); - break; - case 'h': - rv = test_tethering_wifi_ap_set_security_type(); - break; - case 'i': - rv = test_tethering_wifi_ap_set_visibility(); - break; - case 'j': - rv = test_tethering_wifi_ap_set_passphrase(); - break; case 'k': rv = test_tethering_wifi_reload_settings(); break; - case 'l': - rv = test_tethering_wifi_ap_reload_settings(); - break; case 'm': rv = test_tethering_wifi_set_channel(); break; -- 2.7.4