#define TEMP_LIST tzplatform_mkpath(TZ_SYS_VAR, "/lib/hostapd/.hostapd_tmp")
#define MAC_ADDR_LEN 18
#define MAX_BUF_SIZE 80
+#define DBUS_DEFAULT_REPLY_TIMEOUT 15000
#define IPTABLES "/usr/sbin/iptables"
#define TABLE_NAT "nat"
{0, SIGNAL_NAME_SECURITY_TYPE_CHANGED, __handle_security_type_changed},
{0, SIGNAL_NAME_SSID_VISIBILITY_CHANGED, __handle_ssid_visibility_changed},
{0, SIGNAL_NAME_PASSPHRASE_CHANGED, __handle_passphrase_changed},
- {0, SIGNAL_NAME_DHCP_STATUS, __handle_dhcp} };
+ {0, SIGNAL_NAME_DHCP_STATUS, __handle_dhcp},
+ {0, "", NULL} };
static int retry = 0;
if (ptr == NULL)
return false;
+ if (!g_strcmp0(ptr, ""))
+ return false;
+
if (!g_utf8_validate(ptr, -1, (const char **)&ptr_tmp))
*ptr_tmp = '\0';
goto DONE;
}
+ SINFO("[%s] type %d, ip %s, mac %s, name %s, timestamp %d",
+ buf, ap_type, ip, mac, name, timestamp);
+
ccb = th->changed_cb[type];
if (ccb == NULL)
goto DONE;
void *data = NULL;
tethering_disabled_cause_e code = TETHERING_DISABLED_BY_NETWORK_CLOSE;
+ SINFO("Wi-Fi Tethering Disabled by network close !");
+
for (type = TETHERING_TYPE_USB; type <= TETHERING_TYPE_BT; type++) {
dcb = th->disabled_cb[type];
if (dcb == NULL)
TETHERING_SERVICE_OBJECT_PATH, NULL, G_DBUS_SIGNAL_FLAGS_NONE,
sigs[E_SIGNAL_WIFI_TETHER_ON].cb, (gpointer)th, NULL);
+ SINFO("Wi-Fi Tethering enabled event ! error(%d)", error);
+
if (!ecb) {
INFO("-\n"); //LCOV_EXCL_LINE
return;
INFO("cfm event : %d info : %d\n", event_type, error);
switch (event_type) {
case MOBILE_AP_DISABLE_WIFI_TETHERING_CFM:
+
+ SINFO("Wi-Fi Tethering disbaled event !");
sigs[E_SIGNAL_WIFI_TETHER_OFF].sig_id = g_dbus_connection_signal_subscribe(th->client_bus,
NULL, TETHERING_SERVICE_INTERFACE, sigs[E_SIGNAL_WIFI_TETHER_OFF].name,
TETHERING_SERVICE_OBJECT_PATH, NULL, G_DBUS_SIGNAL_FLAGS_NONE,
g_error_free(g_error);
}
if (th->settings_reloaded_cb == NULL) {
- DBG("There is no settings_reloaded_cb\n-\n");
+ ERR("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);
+ INFO("Wi-Fi Tethering settings reloaded event !");
+
th->settings_reloaded_cb(tethering_error,
th->settings_reloaded_user_data);
char *ptr = NULL;
char *ptr_tmp = NULL;
+#ifdef TIZEN_TV_EXT
+ char ap_ssid[TETHERING_WIFI_SSID_MAX_LEN + 1] = {0, };
+ if (__get_ssid_from_vconf(VCONFKEY_WIFI_SSID,
+ ap_ssid, sizeof(ap_ssid)) == false) {
+ ERR("vconf key get failed for ssid or invalid ssid is found");
+ ptr = vconf_get_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR);
+ if (ptr == NULL) {
+ ERR("vconf_get_str is failed and set default ssid");
+ g_strlcpy(ssid, TETHERING_DEFAULT_SSID, size);
+ } else {
+ g_strlcpy(ssid, ptr, size);
+ free(ptr);
+ }
+ } else {
+ g_strlcpy(ssid, ap_ssid, size);
+ }
+#else
ptr = vconf_get_str(VCONFKEY_SETAPPL_DEVICE_NAME_STR);
if (ptr == NULL) {
ERR("vconf_get_str is failed and set default ssid");
g_strlcpy(ssid, TETHERING_DEFAULT_SSID, size);
- } else
+ } else {
g_strlcpy(ssid, ptr, size);
-
- free(ptr);
+ free(ptr);
+ }
+#endif//TIZEN_TV_EXT
if (!g_utf8_validate(ssid, -1, (const char **)&ptr_tmp))
*ptr_tmp = '\0';
th->sec_type = TETHERING_WIFI_SECURITY_TYPE_WPA2_PSK;
th->visibility = true;
th->mac_filter = false;
+#ifdef TIZEN_TV_EXT
+ int channel = TETHERING_WIFI_DEFAULT_CHANNEL;
+ if (vconf_get_int(VCONFKEY_WIFI_CHANNEL, &channel) < 0)
+ ERR("vconf key get failed for channel !!");
+
+ th->channel = channel;
+#else
th->channel = 6;
+#endif//TIZEN_TV_EXT
th->mode_type = TETHERING_WIFI_MODE_TYPE_G;
th->wifi_max_connected = TETHERING_WIFI_MAX_STA;
+#ifdef TIZEN_TV_EXT
+ int txpower = TETHERING_WIFI_MAX_TXPOWER;
+ if (vconf_get_int(VCONFKEY_WIFI_TXPOWER, &txpower) < 0)
+ ERR("vconf key get failed for txpower !!");
+
+ th->txpower = txpower;
+#endif//TIZEN_TV_EXT
if (__generate_initial_passphrase(th->passphrase,
sizeof(th->passphrase)) == 0) {
//LCOV_EXCL_STOP
}
+#ifdef TIZEN_TV_EXT
+ SINFO("ssid: %s, key: %s, channel: %d, mode: %d, txpower: %d, security: %d max_device: %d\n",
+ ssid, th->passphrase, th->channel, th->mode_type, th->txpower, th->sec_type,
+ th->wifi_max_connected);
+#endif//TIZEN_TV_EXT
+
#if !GLIB_CHECK_VERSION(2, 36, 0)
g_type_init();
#endif
GDBusProxy *proxy = th->client_bus_proxy;
GDBusConnection *connection = th->client_bus;
- g_dbus_proxy_set_default_timeout(proxy, DBUS_TIMEOUT_INFINITE);
+ g_dbus_proxy_set_default_timeout(proxy, DBUS_DEFAULT_REPLY_TIMEOUT);
if (__check_precondition(type) == FALSE) {
//LCOV_EXCL_START
- INFO("-\n");
+ ERR("Wi-Fi Tethering cannot be enabled !\n");
return TETHERING_ERROR_OPERATION_FAILED;
//LCOV_EXCL_STOP
}
case TETHERING_TYPE_WIFI: {
_softap_settings_t set = {"", "", "", 0, false};
-
+#ifdef TIZEN_TV_EXT
+ unsigned int txpower;
+#endif// TIZEN_TV_EXT
ret = __prepare_wifi_settings(tethering, &set);
if (ret != TETHERING_ERROR_NONE) {
//LCOV_EXCL_START
}
g_dbus_connection_signal_unsubscribe(connection,
sigs[E_SIGNAL_WIFI_TETHER_ON].sig_id);
-
+#ifdef TIZEN_TV_EXT
+ txpower = th->txpower;
+ SINFO("ssid %s, key %s, channel %d, mode %s, txpower %d, security %d max_device %d\n",
+ set.ssid, set.key, set.channel, set.mode, txpower, set.sec_type,
+ set.max_connected);
+ g_dbus_proxy_call(proxy, "enable_wifi_tethering",
+ g_variant_new("(sssiiiiiii)", set.ssid, set.key, set.mode, set.channel, set.visibility, set.mac_filter, set.max_connected, set.sec_type, txpower, TETHERING_ADDRESS_FAMILY_IPV4),
+ G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
+ (GAsyncReadyCallback) __wifi_enabled_cfm_cb, (gpointer)tethering);
+#else
g_dbus_proxy_call(proxy, "enable_wifi_tethering",
g_variant_new("(sssiiiiii)", set.ssid, set.key, set.mode, set.channel, set.visibility, set.mac_filter, set.max_connected, set.sec_type, TETHERING_ADDRESS_FAMILY_IPV4),
G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
(GAsyncReadyCallback) __wifi_enabled_cfm_cb, (gpointer)tethering);
+#endif//TIZEN_TV_EXT
break;
}
g_dbus_connection_signal_unsubscribe(connection,
sigs[E_SIGNAL_WIFI_TETHER_OFF].sig_id);
+ SINFO("Disable Wi-Fi Tethering !");
+
g_dbus_proxy_call(proxy, "disable_wifi_tethering",
g_variant_new("(i)", TETHERING_ADDRESS_FAMILY_IPV4),
G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
(unsigned char)ifr.ifr_hwaddr.sa_data[4],
(unsigned char)ifr.ifr_hwaddr.sa_data[5]);
+ INFO("mac [%s] intf [%s]", macbuf, ifr.ifr_name);
*mac_address = macbuf;
return TETHERING_ERROR_NONE;
_retvm_if(!__get_intf_name(type, intf, sizeof(intf)),
TETHERING_ERROR_OPERATION_FAILED,
"getting interface name is failed\n");
+
+ INFO("interface %s", intf);
+
*interface_name = strdup(intf);
_retvm_if(*interface_name == NULL, TETHERING_ERROR_OUT_OF_MEMORY,
"Not enough memory\n");
_retvm_if(*ip_address == NULL, TETHERING_ERROR_OUT_OF_MEMORY,
"Not enough memory\n");
+ INFO("local ip %s", ipbuf);
return TETHERING_ERROR_NONE;
}
g_variant_unref(value);
break;
}
- DBG("interface is %d\n", client.interface);
+ INFO("interface is %d\n", client.interface);
if (client.interface != type && (TETHERING_TYPE_ALL != type)) {
g_free(key);
g_variant_unref(value);
}
} else if (g_strcmp0(key, "IP") == 0) {
g_variant_get(value, "s", &ip);
- SDBG("ip is %s\n", ip);
+ SINFO("ip is %s\n", ip);
g_strlcpy(client.ip, ip, sizeof(client.ip));
} else if (g_strcmp0(key, "MAC") == 0) {
g_variant_get(value, "s", &mac);
- SDBG("mac is %s\n", mac);
+ SINFO("mac is %s\n", mac);
g_strlcpy(client.mac, mac, sizeof(client.mac));
} else if (g_strcmp0(key, "Name") == 0) {
g_variant_get(value, "s", &hostname);
- SDBG("hsotname is %s\n", hostname);
+ SINFO("hsotname is %s\n", hostname);
if (hostname)
client.hostname = g_strdup(hostname);
} else if (g_strcmp0(key, "Time") == 0) {
timestamp = g_variant_get_int32(value);
- DBG("timestamp is %d\n", timestamp);
+ INFO("timestamp is %d\n", timestamp);
client.tm = (time_t)timestamp;
} else {
ERR("Key %s not required\n", key);
_retvm_if(p_ssid == NULL, TETHERING_ERROR_OUT_OF_MEMORY,
"strdup is failed\n");
+#ifdef TIZEN_TV_EXT
+ GDBusProxy *proxy = th->client_bus_proxy;
+ GVariant *parameters;
+ GError *error = NULL;
+ tethering_error_e ret = TETHERING_ERROR_NONE;
+
+ parameters = g_dbus_proxy_call_sync(proxy, "set_wifi_tethering_ssid",
+ g_variant_new("(s)", ssid), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
+
+ if (error) {
+ //LCOV_EXCL_START
+ ERR("g_dbus_proxy_call_sync failed because %s\n", error->message);
+
+ if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
+ ret = TETHERING_ERROR_PERMISSION_DENIED;
+ else
+ ret = TETHERING_ERROR_OPERATION_FAILED;
+
+ g_error_free(error);
+ return ret;
+ //LCOV_EXCL_STOP
+ }
+
+ if (parameters != NULL) {
+ g_variant_get(parameters, "(u)", &ret);
+ g_variant_unref(parameters);
+ }
+
+ SINFO("set tethering ssid : %s", ssid);
+#endif//TIZEN_TV_EXT
+
if (th->ssid)
free(th->ssid);
th->ssid = p_ssid;
__tethering_h *th = (__tethering_h *)tethering;
char val[TETHERING_WIFI_SSID_MAX_LEN + 1] = {0, };
+#ifdef TIZEN_TV_EXT
+ if (__get_ssid_from_vconf(VCONFKEY_WIFI_SSID,
+ val, sizeof(val)) == true) {
+ *ssid = strdup(val);
+ SINFO("get tethering ssid : %s", *ssid);
+ return TETHERING_ERROR_NONE;
+ }
+#endif//TIZEN_TV_EXT
+
if (!tethering_is_enabled(NULL, TETHERING_TYPE_WIFI)) {
if (th->ssid != NULL) {
DBG("Private SSID is set\n");
"parameter(tethering) is NULL\n");
__tethering_h *th = (__tethering_h *)tethering;
+
+#ifdef TIZEN_TV_EXT
+ GDBusProxy *proxy = th->client_bus_proxy;
+ GVariant *parameters;
+ GError *error = NULL;
+ tethering_error_e ret = TETHERING_ERROR_NONE;
+
+ parameters = g_dbus_proxy_call_sync(proxy, "set_wifi_tethering_channel",
+ g_variant_new("(i)", channel), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
+
+ if (error) {
+ //LCOV_EXCL_START
+ ERR("g_dbus_proxy_call_sync failed because %s\n", error->message);
+
+ if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
+ ret = TETHERING_ERROR_PERMISSION_DENIED;
+ else
+ ret = TETHERING_ERROR_OPERATION_FAILED;
+
+ g_error_free(error);
+ return ret;
+ //LCOV_EXCL_STOP
+ }
+
+ if (parameters != NULL) {
+ g_variant_get(parameters, "(u)", &ret);
+ g_variant_unref(parameters);
+ }
+
+ SINFO("set channel : %d", channel);
+#endif//TIZEN_TV_EXT
+
th->channel = channel;
return TETHERING_ERROR_NONE;
"parameter(channel) is NULL\n");
__tethering_h *th = (__tethering_h *)tethering;
- *channel = th->channel;
+#ifdef TIZEN_TV_EXT
+ GDBusProxy *proxy = th->client_bus_proxy;
+ GVariant *parameters;
+ GError *error = NULL;
+ int ch, vconf_channel;
+ tethering_error_e ret = TETHERING_ERROR_NONE;
+ parameters = g_dbus_proxy_call_sync(proxy, "get_wifi_tethering_channel",
+ NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
+
+ if (error) {
+ //LCOV_EXCL_START
+ ERR("g_dbus_proxy_call_sync failed because %s\n", error->message);
+
+ if (error->code == G_DBUS_ERROR_ACCESS_DENIED)
+ ret = TETHERING_ERROR_PERMISSION_DENIED;
+ else
+ ret = TETHERING_ERROR_OPERATION_FAILED;
+
+ g_error_free(error);
+ return ret;
+ //LCOV_EXCL_STOP
+ }
+
+ if (parameters != NULL) {
+ g_variant_get(parameters, "(iu)", &ch, &ret);
+ g_variant_unref(parameters);
+ }
+
+ if (ch < 0) {
+ ERR("failed to get Hostapd channel, set th->channel");
+ *channel = th->channel;
+ } else
+ *channel = ch;
+
+ if (vconf_get_int(VCONFKEY_WIFI_CHANNEL, &vconf_channel) < 0)
+ ERR("Failed to get vconf key for channel");
+ else
+ *channel = vconf_channel;
+
+ SINFO("get tethering channel : %d", *channel);
+#else
+ *channel = th->channel;
+#endif//TIZEN_TV_EXT
return TETHERING_ERROR_NONE;
}
__tethering_h *th = (__tethering_h *)tethering;
+ SINFO("set tethering mode_type : %d", type);
th->mode_type = type;
return TETHERING_ERROR_NONE;
__tethering_h *th = (__tethering_h *)tethering;
*type = th->mode_type;
+ SINFO("get tethering mode_type : %d", *type);
return TETHERING_ERROR_NONE;
}
th->settings_reloaded_cb = callback;
th->settings_reloaded_user_data = user_data;
+#ifdef TIZEN_TV_EXT
+ SINFO("ssid %s, key %s, channel %d, mode %s, txpower %d, security %d max_device %d\n",
+ set.ssid, set.key, set.channel, set.mode, th->txpower, set.sec_type,
+ set.max_connected);
+#endif//TIZEN_TV_EXT
+
g_dbus_proxy_call(proxy, "reload_wifi_settings",
g_variant_new("(sssiiiii)", set.ssid, set.key, set.mode, set.channel, set.visibility, set.mac_filter, set.max_connected, set.sec_type),
G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
"tethering type[%d] is not enabled\n", TETHERING_TYPE_WIFI);
__tethering_h *th = (__tethering_h *)tethering;
+#ifdef TIZEN_TV_EXT
+ th->txpower = txpower;
+#endif//TIZEN_TV_EXT
+
g_dbus_proxy_call_sync(th->client_bus_proxy, "hostapd_set_txpower",
g_variant_new("(u)", txpower),
G_DBUS_CALL_FLAGS_NONE,
return TETHERING_ERROR_OPERATION_FAILED;
//LCOV_EXCL_STOP
}
+
+ SINFO("set txpower = %d", txpower);
return TETHERING_ERROR_NONE;
}
//LCOV_EXCL_STOP
}
g_clear_error(&error);
+
+ SINFO("get tethering txpower : %d", *txpower);
return TETHERING_ERROR_NONE;
}
th->wifi_max_connected = max_device;
+ SINFO("set max client device = %d", th->wifi_max_connected);
return TETHERING_ERROR_NONE;
}
__tethering_h *th = (__tethering_h *)tethering;
*max_device = th->wifi_max_connected;
+
+ SINFO("get max client device = %d", th->wifi_max_connected);
return TETHERING_ERROR_NONE;
}