merge with master
authorJinkun Jang <jinkun.jang@samsung.com>
Fri, 15 Mar 2013 16:12:14 +0000 (01:12 +0900)
committerJinkun Jang <jinkun.jang@samsung.com>
Fri, 15 Mar 2013 16:12:14 +0000 (01:12 +0900)
CMakeLists.txt
include/tethering.h
include/tethering_private.h
packaging/capi-network-tethering.spec
src/tethering.c
src/tethering_client.c
test/tethering_test.c

index a5e6c0d..474670b 100644 (file)
@@ -11,13 +11,17 @@ INCLUDE_DIRECTORIES(${INC_DIR})
 
 SET(dependents "dlog glib-2.0 capi-base-common dbus-glib-1 vconf")
 
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+       SET(CMAKE_BUILD_TYPE "Release")
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+
 INCLUDE(FindPkgConfig)
 pkg_check_modules(${fw_name} REQUIRED ${dependents})
 FOREACH(flag ${${fw_name}_CFLAGS})
     SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -fvisibility=hidden")
 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
 
 IF("${ARCH}" STREQUAL "arm")
@@ -27,7 +31,7 @@ ENDIF("${ARCH}" STREQUAL "arm")
 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
 ADD_DEFINITIONS("-DTIZEN_DEBUG")
 
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")
+SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--as-needed -Wl,--rpath=%{_libdir}")
 
 FIND_PROGRAM(MARSHALTOOL NAMES glib-genmarshal)
 EXEC_PROGRAM("${MARSHALTOOL}" ARGS "--prefix=marshal ${INC_DIR}/marshal.list --header > ${INC_DIR}/marshal.h")
@@ -43,7 +47,7 @@ TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
 
 SET_TARGET_PROPERTIES(${fw_name} PROPERTIES SOVERSION 0.1.0)
 
-INSTALL(TARGETS ${fw_name} DESTINATION lib)
+INSTALL(TARGETS ${fw_name} DESTINATION ${LIB_INSTALL_DIR})
 INSTALL(
         DIRECTORY ${INC_DIR}/ DESTINATION include/network
         FILES_MATCHING
@@ -63,7 +67,7 @@ CONFIGURE_FILE(
     ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
     @ONLY
 )
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION lib/pkgconfig)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
 
 ADD_SUBDIRECTORY(test)
 
index 9c7aa1e..f68dc5e 100644 (file)
@@ -371,7 +371,7 @@ int tethering_get_subnet_mask(tethering_h tethering, tethering_type_e type, teth
 int tethering_get_data_usage(tethering_h tethering, tethering_data_usage_cb callback, void *user_data);
 
 /**
- * @brief Gets the client which is connected by USB tethering.
+ * @brief Gets the clients which are connected.
  * @param[in]  tethering  The handle of tethering
  * @param[in]  type  The type of tethering
  * @param[in]  callback  The callback function to invoke
@@ -525,16 +525,13 @@ int tethering_wifi_unset_passphrase_changed_cb(tethering_h tethering);
 
 /**
  * @brief Sets the security type of Wi-Fi tethering.
- * @remarks You must set this value when Wi-Fi tethering is disabled.
+ * @remarks This change is applied next time Wi-Fi tethering is enabled
  * @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
- * @retval  #TETHERING_ERROR_INVALID_OPERATION  Invalid operation
- * @pre  Wi-Fi tethering must be disabled.
- * @see  tethering_is_enabled()
  * @see  tethering_wifi_get_security_type()
  */
 int tethering_wifi_set_security_type(tethering_h tethering, tethering_wifi_security_type_e type);
@@ -552,6 +549,19 @@ int tethering_wifi_set_security_type(tethering_h tethering, tethering_wifi_secur
 int tethering_wifi_get_security_type(tethering_h tethering, tethering_wifi_security_type_e *type);
 
 /**
+ * @brief Sets the SSID (service set identifier).
+ * @details If SSID is not set, Device name is used as SSID
+ * @remarks This change is applied next time Wi-Fi tethering is enabled with same @a tethering handle
+ * @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
+ */
+int tethering_wifi_set_ssid(tethering_h tethering, const char *ssid);
+
+/**
  * @brief Gets the SSID (service set identifier).
  * @remarks @a ssid must be released with free() by you.
  * @param[in]  tethering  The handle of tethering
@@ -567,16 +577,13 @@ int tethering_wifi_get_ssid(tethering_h tethering, char **ssid);
 /**
  * @brief Sets the visibility of SSID(service set identifier).
  * @details If you set the visibility invisible, then the SSID of this device is hidden. So, Wi-Fi scan can't find your device.
- * @remarks You must set this value when Wi-Fi tethering is disabled.
+ * @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
- * @retval  #TETHERING_ERROR_INVALID_OPERATION  Invalid operation
- * @pre  Wi-Fi tethering must be disabled.
- * @see  tethering_is_enabled()
  * @see  tethering_wifi_get_ssid_visibility()
  */
 int tethering_wifi_set_ssid_visibility(tethering_h tethering, bool visible);
@@ -596,16 +603,13 @@ int tethering_wifi_get_ssid_visibility(tethering_h tethering, bool *visible);
 
 /**
  * @brief Sets the passphrase.
- * @remarks You must set this value when Wi-Fi tethering is disabled.
+ * @remarks This change is applied next time Wi-Fi tethering is enabled
  * @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
  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
- * @retval  #TETHERING_ERROR_INVALID_OPERATION  Invalid operation
- * @pre  Wi-Fi tethering must be disabled.
- * @see  tethering_is_enabled()
  * @see  tethering_wifi_get_passphrase()
  */
 int tethering_wifi_set_passphrase(tethering_h tethering, const char *passphrase);
index be57713..8ad1150 100644 (file)
@@ -17,7 +17,7 @@
 #ifndef __TETHERING_PRIVATE_H__
 #define __TETHERING_PRIVATE_H__
 
-#define LOG_TAG        "tethering"
+#define LOG_TAG        "CAPI_NETWORK_TETHERING"
 
 #include <glib.h>
 #include <dbus/dbus-glib.h>
@@ -37,9 +37,9 @@ extern "C" {
 #  define DEPRECATED_API __attribute__ ((deprecated))
 #endif
 
-#define DBG(fmt, args...) LOGD("[%s()][Ln:%d] "fmt, __func__, __LINE__, ##args)
-#define WARN(fmt, args...) LOGW("[%s()][Ln:%d] "fmt, __func__, __LINE__, ##args)
-#define ERR(fmt, args...) LOGE("[%s()][Ln:%d] "fmt, __func__, __LINE__, ##args)
+#define DBG(fmt, args...) LOGD(fmt, ##args)
+#define WARN(fmt, args...) LOGW(fmt, ##args)
+#define ERR(fmt, args...) LOGE(fmt, ##args)
 
 #define _warn_if(expr, fmt, arg...) do { \
                if (expr) { \
@@ -195,6 +195,10 @@ typedef enum {
 
 #define TETHERING_BT_IF                        "bnep0"
 #define TETHERING_BT_GATEWAY           "192.168.130.1"
+
+#define TETHERING_WIFI_SSID_MAX_LEN    31      /**< Maximum length of ssid */
+#define TETHERING_WIFI_KEY_MIN_LEN     8       /**< Minimum length of wifi key */
+#define TETHERING_WIFI_KEY_MAX_LEN     63      /**< Maximum length of wifi key */
 /**
 * End of mobileap-agent common values
 */
@@ -229,6 +233,8 @@ typedef struct {
        void *ssid_visibility_user_data;
        tethering_wifi_passphrase_changed_cb passphrase_changed_cb;
        void *passphrase_user_data;
+
+       char *ssid;
 } __tethering_h;
 
 typedef struct {
index dbe0c77..ca0b4e8 100644 (file)
@@ -1,9 +1,9 @@
 Name:       capi-network-tethering
 Summary:    Tethering Framework
-Version:    0.0.11
+Version:    0.0.13
 Release:    1
 Group:      TO_BE/FILLED_IN
-License:    Apache License Version 2.0
+License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
 Requires(post):   /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
@@ -29,12 +29,10 @@ Development package for Tethering framework library
 %setup -q
 
 %build
-cmake . -DCMAKE_INSTALL_PREFIX=/usr
-
+%cmake .
 make %{?jobs:-j%jobs}
 
 %install
-rm -rf %{buildroot}
 %make_install
 
 %post -p /sbin/ldconfig
@@ -53,6 +51,15 @@ rm -rf %{buildroot}
 %{_libdir}/*.so
 
 %changelog
+* Sat Feb 16 2013 Seungyoun Ju <sy39.ju@samsung.com> 0.0.13-1
+- Wrong linker flags are fixed
+- Add API : tethering_wifi_set_ssid()
+
+* Thu Feb 14 2013 Seungyoun Ju <sy39.ju@samsung.com> 0.0.12-1
+- APIs are exported
+- LOG Format is changed
+- fvisibility=hidden is applied and API's return value is checked
+
 * Thu Jan 24 2013 Seungyoun Ju <sy39.ju@samsung.com> 0.0.11-1
 - Indications for Wi-Fi tethering setting change are added
 - Dbus service / interface / object names are changed
index 262dcfd..a4c8284 100644 (file)
@@ -838,7 +838,9 @@ API int tethering_create(tethering_h *tethering)
                        "malloc is failed\n");
        memset(th, 0x00, sizeof(__tethering_h));
 
+#if !GLIB_CHECK_VERSION(2,35,0)
        g_type_init();
+#endif
        th->client_bus = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
        if (error) {
                ERR("Couldn't connect to the System bus[%s]", error->message);
@@ -887,6 +889,8 @@ API int tethering_destroy(tethering_h tethering)
        org_tizen_tethering_deinit_async(th->client_bus_proxy, __deinit_cb,
                        (gpointer)tethering);
 
+       if (th->ssid)
+               free(th->ssid);
        g_object_unref(th->client_bus_proxy);
        dbus_g_connection_unref(th->client_bus);
        memset(th, 0x00, sizeof(__tethering_h));
@@ -906,7 +910,7 @@ API int tethering_destroy(tethering_h tethering)
  * @see  tethering_is_enabled()
  * @see  tethering_disable()
  */
-int tethering_enable(tethering_h tethering, tethering_type_e type)
+API int tethering_enable(tethering_h tethering, tethering_type_e type)
 {
        DBG("+\n");
 
@@ -929,7 +933,8 @@ int tethering_enable(tethering_h tethering, tethering_type_e type)
                dbus_g_proxy_disconnect_signal(proxy, SIGNAL_NAME_WIFI_TETHER_ON,
                                G_CALLBACK(__handle_wifi_tether_on),
                                (gpointer)tethering);
-               org_tizen_tethering_enable_wifi_tethering_async(proxy, "", "", false,
+               org_tizen_tethering_enable_wifi_tethering_async(proxy,
+                               th->ssid ? th->ssid : "", "", false,
                                __cfm_cb, (gpointer)tethering);
                break;
 
@@ -954,7 +959,8 @@ int tethering_enable(tethering_h tethering, tethering_type_e type)
                dbus_g_proxy_disconnect_signal(proxy, SIGNAL_NAME_WIFI_TETHER_ON,
                                G_CALLBACK(__handle_wifi_tether_on),
                                (gpointer)tethering);
-               org_tizen_tethering_enable_wifi_tethering_async(proxy, "", "", false,
+               org_tizen_tethering_enable_wifi_tethering_async(proxy,
+                               th->ssid ? th->ssid : "", "", false,
                                __cfm_cb, (gpointer)tethering);
 
                /* TETHERING_TYPE_BT */
@@ -1097,7 +1103,7 @@ API bool tethering_is_enabled(tethering_h tethering, tethering_type_e type)
  * @see  tethering_is_enabled()
  * @see  tethering_enable()
  */
-int tethering_get_mac_address(tethering_h tethering, tethering_type_e type, char **mac_address)
+API int tethering_get_mac_address(tethering_h tethering, tethering_type_e type, char **mac_address)
 {
        _retvm_if(tethering == NULL, TETHERING_ERROR_INVALID_PARAMETER,
                        "parameter(tethering) is NULL\n");
@@ -1287,7 +1293,7 @@ API int tethering_get_gateway_address(tethering_h tethering, tethering_type_e ty
  * @see  tethering_is_enabled()
  * @see  tethering_enable()
  */
-int tethering_get_subnet_mask(tethering_h tethering, tethering_type_e type, tethering_address_family_e address_family, char **subnet_mask)
+API int tethering_get_subnet_mask(tethering_h tethering, tethering_type_e type, tethering_address_family_e address_family, char **subnet_mask)
 {
        _retvm_if(tethering == NULL, TETHERING_ERROR_INVALID_PARAMETER,
                        "parameter(tethering) is NULL\n");
@@ -1759,16 +1765,13 @@ API int tethering_wifi_unset_passphrase_changed_cb(tethering_h tethering)
 
 /**
  * @brief Sets the security type of Wi-Fi tethering.
- * @remarks You must set this value when Wi-Fi tethering is disabled.
+ * @remarks This change is applied next time Wi-Fi tethering is enabled
  * @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
- * @retval  #TETHERING_ERROR_INVALID_OPERATION  Invalid operation
- * @pre  Wi-Fi tethering must be disabled.
- * @see  tethering_is_enabled()
  * @see  tethering_wifi_get_security_type()
  */
 API int tethering_wifi_set_security_type(tethering_h tethering, tethering_wifi_security_type_e type)
@@ -1852,6 +1855,45 @@ API int tethering_wifi_get_security_type(tethering_h tethering, tethering_wifi_s
 }
 
 /**
+ * @brief Sets the SSID (service set identifier).
+ * @details If SSID is not set, Device name is used as SSID
+ * @remarks This change is applied next time Wi-Fi tethering is enabled with same @a tethering handle
+ * @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_set_ssid(tethering_h tethering, const char *ssid)
+{
+       _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;
+       int ssid_len;
+
+       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);
+       _retvm_if(p_ssid == NULL, TETHERING_ERROR_OUT_OF_MEMORY,
+                       "strdup is failed\n");
+
+       if (th->ssid)
+               free(th->ssid);
+       th->ssid = p_ssid;
+
+       return TETHERING_ERROR_NONE;
+}
+
+/**
  * @brief Gets the SSID (service set identifier).
  * @remarks @a ssid must be released with free() by you.
  * @param[in]  tethering  The handle of tethering
@@ -1875,6 +1917,18 @@ API int tethering_wifi_get_ssid(tethering_h tethering, char **ssid)
        GError *error = NULL;
        char *ssid_buf = NULL;
 
+       if (tethering_is_enabled(NULL, TETHERING_TYPE_WIFI) == false &&
+                       th->ssid != NULL) {
+               DBG("Private SSID is set : %s\n", th->ssid);
+               *ssid = strdup(th->ssid);
+               if (*ssid == NULL) {
+                       ERR("Memory allocation failed\n");
+                       return TETHERING_ERROR_OUT_OF_MEMORY;
+               }
+               DBG("-\n");
+               return TETHERING_ERROR_NONE;
+       }
+
        org_tizen_tethering_get_wifi_tethering_ssid(proxy, &ssid_buf, &error);
        if (error != NULL) {
                ERR("dbus fail : %s\n", error->message);
@@ -1900,19 +1954,16 @@ API int tethering_wifi_get_ssid(tethering_h tethering, char **ssid)
 /**
  * @brief Sets the visibility of SSID(service set identifier).
  * @details If you set the visibility invisible, then the SSID of this device is hidden. So, Wi-Fi scan can't find your device.
- * @remarks You must set this value when Wi-Fi tethering is disabled.
+ * @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
- * @retval  #TETHERING_ERROR_INVALID_OPERATION  Invalid operation
- * @pre  Wi-Fi tethering must be disabled.
- * @see  tethering_is_enabled()
  * @see  tethering_wifi_get_ssid_visibility()
  */
-int tethering_wifi_set_ssid_visibility(tethering_h tethering, bool visible)
+API int tethering_wifi_set_ssid_visibility(tethering_h tethering, bool visible)
 {
        _retvm_if(tethering == NULL, TETHERING_ERROR_INVALID_PARAMETER,
                        "parameter(tethering) is NULL\n");
@@ -1981,16 +2032,13 @@ API int tethering_wifi_get_ssid_visibility(tethering_h tethering, bool *visible)
 
 /**
  * @brief Sets the passphrase.
- * @remarks You must set this value when Wi-Fi tethering is disabled.
+ * @remarks This change is applied next time Wi-Fi tethering is enabled
  * @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
  * @retval  #TETHERING_ERROR_OPERATION_FAILED  Operation failed
- * @retval  #TETHERING_ERROR_INVALID_OPERATION  Invalid operation
- * @pre  Wi-Fi tethering must be disabled.
- * @see  tethering_is_enabled()
  * @see  tethering_wifi_get_passphrase()
  */
 API int tethering_wifi_set_passphrase(tethering_h tethering, const char *passphrase)
@@ -2003,13 +2051,21 @@ API int tethering_wifi_set_passphrase(tethering_h tethering, const char *passphr
 
        __tethering_h *th = (__tethering_h *)tethering;
        DBusGProxy *proxy = th->client_bus_proxy;
+       int passphrase_len;
+
+       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;
+       }
 
        dbus_g_proxy_disconnect_signal(proxy, SIGNAL_NAME_PASSPHRASE_CHANGED,
                        G_CALLBACK(__handle_passphrase_changed),
                        (gpointer)tethering);
 
        org_tizen_tethering_set_wifi_tethering_passphrase_async(proxy,
-                       passphrase, strlen(passphrase),
+                       passphrase, passphrase_len,
                        __wifi_set_passphrase_cb, (gpointer)tethering);
 
        DBG("-\n");
index 3dca574..64cd78b 100644 (file)
@@ -18,7 +18,7 @@
 #include <string.h>
 #include "tethering_private.h"
 
-int tethering_client_clone(tethering_client_h *dest, tethering_client_h origin)
+API int tethering_client_clone(tethering_client_h *dest, tethering_client_h origin)
 {
        _retvm_if(dest == NULL, TETHERING_ERROR_INVALID_PARAMETER,
                        "Parameter(dest) is NULL\n");
@@ -39,7 +39,7 @@ int tethering_client_clone(tethering_client_h *dest, tethering_client_h origin)
        return TETHERING_ERROR_NONE;
 }
 
-int tethering_client_destroy(tethering_client_h client)
+API int tethering_client_destroy(tethering_client_h client)
 {
        _retvm_if(client == NULL, TETHERING_ERROR_INVALID_PARAMETER,
                        "Parameter(client) is NULL\n");
@@ -49,7 +49,7 @@ int tethering_client_destroy(tethering_client_h client)
        return TETHERING_ERROR_NONE;
 }
 
-int tethering_client_get_tethering_type(tethering_client_h client, tethering_type_e *type)
+API int tethering_client_get_tethering_type(tethering_client_h client, tethering_type_e *type)
 {
        _retvm_if(client == NULL, TETHERING_ERROR_INVALID_PARAMETER,
                        "Parameter(client) is NULL\n");
@@ -63,7 +63,7 @@ int tethering_client_get_tethering_type(tethering_client_h client, tethering_typ
        return TETHERING_ERROR_NONE;
 }
 
-int tethering_client_get_name(tethering_client_h client, char **name)
+API int tethering_client_get_name(tethering_client_h client, char **name)
 {
        _retvm_if(client == NULL, TETHERING_ERROR_INVALID_PARAMETER,
                        "Parameter(client) is NULL\n");
@@ -81,7 +81,7 @@ int tethering_client_get_name(tethering_client_h client, char **name)
        return TETHERING_ERROR_NONE;
 }
 
-int tethering_client_get_ip_address(tethering_client_h client, tethering_address_family_e address_family, char **ip_address)
+API int tethering_client_get_ip_address(tethering_client_h client, tethering_address_family_e address_family, char **ip_address)
 {
        _retvm_if(client == NULL, TETHERING_ERROR_INVALID_PARAMETER,
                        "Parameter(client) is NULL\n");
@@ -99,7 +99,7 @@ int tethering_client_get_ip_address(tethering_client_h client, tethering_address
        return TETHERING_ERROR_NONE;
 }
 
-int tethering_client_get_mac_address(tethering_client_h client, char **mac_address)
+API int tethering_client_get_mac_address(tethering_client_h client, char **mac_address)
 {
        _retvm_if(client == NULL, TETHERING_ERROR_INVALID_PARAMETER,
                        "Parameter(client) is NULL\n");
index a79651d..33578c6 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "tethering.h"
 
-#define INPUT_BUF_LEN          32
+#define INPUT_BUF_LEN          128
 #define DISABLE_REASON_TEXT_LEN        64
 #define COMMON_STR_BUF_LEN     32
 
@@ -538,6 +538,7 @@ void print_menu(void)
        g_print("\nTo get Wi-Fi tethering setting, enter 'get wifi_setting'");
        g_print("\nTo set Wi-Fi tethering setting, enter '[set_security_type | set_visibility] [0 | 1]'");
        g_print("\nTo set Wi-Fi tethering passphrase, enter 'set_passphrase [passphrase]'");
+       g_print("\nTo set Wi-Fi tethering SSID, enter 'set_ssid [SSID]'");
        g_print("\nTo quit, enter 'quit'\n> ");
 
        return;
@@ -560,12 +561,17 @@ gboolean input(GIOChannel *channel, GIOCondition condition, gpointer data)
        }
 #else
        GError *err = NULL;
+       GIOStatus ios;
 
-       g_io_channel_read_chars(channel, buf, INPUT_BUF_LEN, &read, &err);
+       ios = g_io_channel_read_chars(channel, buf, INPUT_BUF_LEN, &read, &err);
        if (err != NULL) {
-               g_print("g_io_channel_read is failed : %s\n", err->message);
+               g_print("g_io_channel_read_chars is failed : %s\n",
+                               err->message);
                g_error_free(err);
                return FALSE;
+       } else if (ios != G_IO_STATUS_NORMAL) {
+               g_print("g_io_channel_read_chars is failed : %d\n", ios);
+               return FALSE;
        }
 #endif
 
@@ -627,6 +633,14 @@ gboolean input(GIOChannel *channel, GIOCondition condition, gpointer data)
                goto DONE;
        }
 
+       if (!strcmp(cmd, "set_ssid")) {
+               error = tethering_wifi_set_ssid(th, param);
+               if (error != TETHERING_ERROR_NONE)
+                       g_print("tethering_wifi_set_ssid is failed [0x%X]\n",
+                                       error);
+               goto DONE;
+       }
+
        /* One parameter(type) */
        if (!strcmp(param, "USB"))
                type = TETHERING_TYPE_USB;
@@ -671,7 +685,9 @@ int main(int argc, char *argv[])
                __connection_state_changed_cb, __security_type_changed_cb,
                __ssid_visibility_changed_cb, __passphrase_changed_cb};
 
+#if !GLIB_CHECK_VERSION(2,35,0)
        g_type_init();
+#endif
 
        /* Create tethering handle */
        ret = tethering_create(&th);