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
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));
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;
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 */
}
/**
+ * @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)
+{
+ _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
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);
__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");
#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
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;
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;