} tethering_wifi_security_type_e;
/**
+ * @brief Enumeration for the Wi-Fi mode
+ * @since_tizen 3.0
+ */
+typedef enum {
+ TETHERING_WIFI_MODE_TYPE_B = 0, /**< mode b */
+ TETHERING_WIFI_MODE_TYPE_G, /**< mode g */
+ TETHERING_WIFI_MODE_TYPE_A, /**< mode a */
+ TETHERING_WIFI_MODE_TYPE_AD, /**< mode ad */
+} tethering_wifi_mode_type_e;
+
+/**
* @}
*/
int tethering_wifi_get_blocked_mac_list(tethering_h tethering, void **blocked_mac_list);
/**
+ * @brief Enables/disables the dhcp server.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/tethering.admin
+ * @details Enable/disable the dhcp server.
+ * @param[in] tethering The handle of tethering
+ * @param[in] enable Enable/disable the dhcp server
+ * @return 0 on success, otherwise negative error value.
+ * @retval #TETHERING_ERROR_NONE Successful
+ * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int tethering_wifi_enable_dhcp(tethering_h tethering, bool enable);
+
+/**
+ * @brief Enables the dhcp server with the address range.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/tethering.admin
+ * @details Enable the dhcp server with the address range.
+ * @param[in] tethering The handle of tethering
+ * @param[in] rangestart Start address range
+ * @param[in] rangestop End address range
+ * @return 0 on success, otherwise negative error value.
+ * @retval #TETHERING_ERROR_NONE Successful
+ * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int tethering_wifi_set_dhcp_range(tethering_h tethering, char *rangestart, char *rangestop);
+
+/**
+ * @brief Checks whether the dhcp is enabled or not.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/tethering.admin
+ * @param[in] tethering The tethering handle
+ * @param[out] dhcp_enabled @c true if dhcp is enabled, \n @c false if dhcp is disabled
+ * @return 0 on success, otherwise a negative error value
+ * @retval #TETHERING_ERROR_NONE Successful
+ * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int tethering_wifi_is_dhcp_enabled(tethering_h tethering, bool *dhcp_enabled);
+
+/**
+ * @brief Sets the Channel for Wi-Fi.
+ * @details The Channel should be in between 1-14. If channel is not set, Wi-Fi sets default channel.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/tethering.admin
+ * @param[in] tethering The tethering handle
+ * @param[in] channel The channel number
+ * @return 0 on success, otherwise negative error value
+ * @retval #TETHERING_ERROR_NONE Successful
+ * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int tethering_wifi_set_channel(tethering_h tethering, int channel);
+
+/**
+ * @brief Gets the channel for Wi-Fi.
+ * @details If channel is not set, Wi-Fi gets default channel.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/tethering.admin
+ * @param[in] tethering The tethering handle
+ * @param[out] channel The channel number
+ * @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()
+ */
+int tethering_wifi_get_channel(tethering_h tethering, int *channel);
+
+/**
+ * @brief Sets the mode for Wi-Fi.
+ * @details The mobile AP mode (ex: b only, g only, ad, a). If mode is not set, Wi-Fi sets default mode.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/tethering.admin
+ * @param[in] tethering The tethering handle
+ * @param[in] type The mobile AP mode
+ * @return 0 on success, otherwise negative error value
+ * @retval #TETHERING_ERROR_NONE Successful
+ * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+int tethering_wifi_set_mode(tethering_h tethering, tethering_wifi_mode_type_e type);
+
+/**
+ * @brief Gets the mode for Wi-Fi.
+ * @details If the mode is not set, Wi-Fi gets default mode.
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/tethering.admin
+ * @remarks @a mode must be released using free().
+ * @param[in] tethering The tethering handle
+ * @param[out] type The mode of Wi-Fi AP
+ * @return 0 on success, otherwise negative error value
+ * @retval #TETHERING_ERROR_NONE Successful
+ * @retval #TETHERING_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see tethering_wifi_set_mode()
+ */
+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
* @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);
-
/**
* @}
*/
return TETHERING_ERROR_NONE;
}
+static bool __get_wifi_mode_type(tethering_wifi_mode_type_e type, char **buf)
+{
+ _retvm_if(buf == NULL, false, "parameter(buf) is NULL\n");
+
+ switch (type) {
+ case TETHERING_WIFI_MODE_TYPE_B:
+ *buf = g_strdup("b");
+ break;
+ case TETHERING_WIFI_MODE_TYPE_G:
+ *buf = g_strdup("g");
+ break;
+ case TETHERING_WIFI_MODE_TYPE_A:
+ *buf = g_strdup("a");
+ break;
+ case TETHERING_WIFI_MODE_TYPE_AD:
+ *buf = g_strdup("ad");
+ break;
+ default:
+ ERR("Not supported type : %d\n", type);
+ return false;
+ }
+ return true;
+}
+
static int __prepare_wifi_settings(tethering_h tethering, _softap_settings_t *set)
{
DBG("+\n");
__tethering_h *th = (__tethering_h *)tethering;
tethering_error_e ret = TETHERING_ERROR_NONE;
+ char *ptr = NULL;
if (th == NULL || set == NULL) {
ERR("null parameter\n-\n");
if (ret != TETHERING_ERROR_NONE)
set->visibility = th->visibility;
+ set->channel = th->channel;
+
+ __get_wifi_mode_type (th->mode_type, &ptr);
+ if (ptr == NULL) {
+ g_strlcpy(set->mode, "", sizeof(set->mode));
+ } else {
+ g_strlcpy(set->mode, ptr, sizeof(set->mode));
+ free(ptr);
+ }
+
if (set->sec_type == TETHERING_WIFI_SECURITY_TYPE_NONE) {
g_strlcpy(set->key, "", sizeof(set->key));
} else {
memset(th, 0x00, sizeof(__tethering_h));
th->sec_type = TETHERING_WIFI_SECURITY_TYPE_WPA2_PSK;
th->visibility = true;
+ th->channel = 6;
+ th->mode_type = TETHERING_WIFI_MODE_TYPE_G;
if (__generate_initial_passphrase(th->passphrase,
sizeof(th->passphrase)) == 0) {
break;
case TETHERING_TYPE_WIFI: {
- _softap_settings_t set = {"", "", 0, false};
+ _softap_settings_t set = {"", "", "", 0, false};
ret = __prepare_wifi_settings(tethering, &set);
if (ret != TETHERING_ERROR_NONE) {
sigs[E_SIGNAL_WIFI_TETHER_ON].sig_id);
g_dbus_proxy_call(proxy, "enable_wifi_tethering",
- g_variant_new("(ssii)", set.ssid, set.key, set.visibility, set.sec_type),
+ g_variant_new("(sssiii)", set.ssid, set.key, set.mode, set.channel, set.visibility, set.sec_type),
G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
(GAsyncReadyCallback) __wifi_enabled_cfm_cb, (gpointer)tethering);
break;
break;
case TETHERING_TYPE_RESERVED: {
- _softap_settings_t set = {"", "", 0, false};
+ _softap_settings_t set = {"", "", "", 0, false};
ret = __prepare_wifi_ap_settings(tethering, &set);
if (ret != TETHERING_ERROR_NONE) {
break;
}
case TETHERING_TYPE_ALL: {
- _softap_settings_t set = {"", "", 0, false};
+ _softap_settings_t set = {"", "", "", 0, false};
ret = __prepare_wifi_settings(tethering, &set);
if (ret != TETHERING_ERROR_NONE) {
return TETHERING_ERROR_NONE;
}
+API int tethering_wifi_set_channel(tethering_h tethering, int channel)
+{
+ 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->channel = channel;
+
+ return TETHERING_ERROR_NONE;
+}
+
+API int tethering_wifi_get_channel(tethering_h tethering, int *channel)
+{
+ CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE, TETHERING_WIFI_FEATURE);
+ _retvm_if(tethering == NULL, TETHERING_ERROR_INVALID_PARAMETER,
+ "parameter(tethering) is NULL\n");
+
+ _retvm_if(channel == NULL, TETHERING_ERROR_INVALID_PARAMETER,
+ "parameter(channel) is NULL\n");
+
+ __tethering_h *th = (__tethering_h *)tethering;
+ *channel = th->channel;
+
+ return TETHERING_ERROR_NONE;
+}
+
+API int tethering_wifi_set_mode(tethering_h tethering, tethering_wifi_mode_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->mode_type = type;
+
+ return TETHERING_ERROR_NONE;
+}
+
+API int tethering_wifi_get_mode(tethering_h tethering, tethering_wifi_mode_type_e *type)
+{
+ CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE, TETHERING_WIFI_FEATURE);
+ _retvm_if(tethering == NULL, TETHERING_ERROR_INVALID_PARAMETER,
+ "parameter(tethering) is NULL\n");
+ _retvm_if(type == NULL, TETHERING_ERROR_INVALID_PARAMETER,
+ "parameter(type) is NULL\n");
+
+ __tethering_h *th = (__tethering_h *)tethering;
+ *type = th->mode_type;
+
+ return TETHERING_ERROR_NONE;
+}
+
+
/**
* @internal
* @brief Reload the settings (SSID / Passphrase / Security type / SSID visibility).
"parameter(callback) is NULL\n");
__tethering_h *th = (__tethering_h *)tethering;
- _softap_settings_t set = {"", "", 0, false};
+ _softap_settings_t set = {"", "", "", 0, false};
GDBusProxy *proxy = th->client_bus_proxy;
int ret = 0;
th->settings_reloaded_user_data = user_data;
g_dbus_proxy_call(proxy, "reload_wifi_settings",
- g_variant_new("(ssii)", set.ssid, set.key, set.visibility, set.sec_type),
+ g_variant_new("(sssiii)", set.ssid, set.key, set.mode, set.channel, set.visibility, set.sec_type),
G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
(GAsyncReadyCallback) __settings_reloaded_cb, (gpointer)tethering);
"parameter(callback) is NULL\n");
__tethering_h *th = (__tethering_h *)tethering;
- _softap_settings_t set = {"", "", 0, false};
+ _softap_settings_t set = {"", "", "", 0, false};
GDBusProxy *proxy = th->client_bus_proxy;
int ret = 0;