{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, "", NULL} };
+ {0, SIGNAL_NAME_DHCP_STATUS, __handle_dhcp} };
static int retry = 0;
{
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_BT) ||
+ tethering_is_enabled(tethering, TETHERING_TYPE_P2P))
return true;
return false;
if (security_type != TETHERING_WIFI_SECURITY_TYPE_NONE &&
security_type != TETHERING_WIFI_SECURITY_TYPE_WPA2_PSK &&
security_type != TETHERING_WIFI_SECURITY_TYPE_WPS) {
- ERR("Invalid param\n");
+ ERR("Invalid param\n"); //LCOV_EXCL_LINE
return TETHERING_ERROR_INVALID_PARAMETER;
}
if (vconf_set_int(VCONFKEY_MOBILE_HOTSPOT_SECURITY, security_type) < 0) {
- ERR("vconf_set_int is failed\n");
+ ERR("vconf_set_int is failed\n"); //LCOV_EXCL_LINE
return TETHERING_ERROR_OPERATION_FAILED;
}
static tethering_error_e __get_security_type(tethering_wifi_security_type_e *security_type)
{
if (security_type == NULL) {
- ERR("Invalid param\n");
+ ERR("Invalid param\n"); //LCOV_EXCL_LINE
return TETHERING_ERROR_INVALID_PARAMETER;
}
if (vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_SECURITY,
(int *)security_type) < 0) {
- ERR("vconf_get_int is failed\n");
+ ERR("vconf_get_int is failed\n"); //LCOV_EXCL_LINE
return TETHERING_ERROR_OPERATION_FAILED;
}
static tethering_error_e __set_visible(const bool visible)
{
if (vconf_set_int(VCONFKEY_MOBILE_HOTSPOT_HIDE, visible ? 0 : 1) < 0) {
- ERR("vconf_set_int is failed\n");
+ ERR("vconf_set_int is failed\n"); //LCOV_EXCL_LINE
return TETHERING_ERROR_OPERATION_FAILED;
}
static tethering_error_e __get_visible(bool *visible)
{
if (visible == NULL) {
- ERR("Invalid param\n");
+ ERR("Invalid param\n"); //LCOV_EXCL_LINE
return TETHERING_ERROR_INVALID_PARAMETER;
}
int hide = 0;
if (vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_HIDE, &hide) < 0) {
- ERR("vconf_get_int is failed\n");
+ ERR("vconf_get_int is failed\n"); //LCOV_EXCL_LINE
return TETHERING_ERROR_OPERATION_FAILED;
}
err = TETHERING_ERROR_INVALID_PARAMETER;
break;
+ //LCOV_EXCL_START
case MOBILE_AP_ERROR_ALREADY_ENABLED:
err = TETHERING_ERROR_OPERATION_FAILED;
break;
err = TETHERING_ERROR_OPERATION_FAILED;
break;
- //LCOV_EXCL_START
case MOBILE_AP_ERROR_NOT_PERMITTED:
err = TETHERING_ERROR_NOT_PERMITTED;
break;
type = TETHERING_TYPE_WIFI;
else if (ap_type == MOBILE_AP_TYPE_BT)
type = TETHERING_TYPE_BT;
+ else if (ap_type == MOBILE_AP_TYPE_P2P)
+ type = TETHERING_TYPE_P2P;
else {
ERR("Not supported tethering type [%d]\n", ap_type);
goto DONE;
g_free(name);
DBG("-\n");
}
-//LCOV_EXCL_STOP
-//LCOV_EXCL_START
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)
else if (g_strcmp0(buf, TETHERING_WIFI_SECURITY_TYPE_WPS_STR) == 0)
security_type = TETHERING_WIFI_SECURITY_TYPE_WPS;
else {
- SERR("Unknown type : %s\n", buf);
+ SERR("Unknown type : %s\n", buf); //LCOV_EXCL_LINE
g_free(buf);
return;
}
const gchar *object_path, const gchar *interface_name, const gchar *signal_name,
GVariant *parameters, gpointer user_data)
{
- DBG("+\n");
+ DBG("+\n"); //LCOV_EXCL_LINE
_retm_if(user_data == NULL, "parameter(user_data) is NULL\n");
__tethering_h *th = (__tethering_h *)user_data;
scb = th->ssid_visibility_changed_cb;
if (scb == NULL) {
- DBG("-\n");
+ DBG("-\n"); //LCOV_EXCL_LINE
return;
}
g_variant_get(parameters, "(s)", &buf);
scb(visible, data);
g_free(buf);
- DBG("-\n");
+ DBG("-\n"); //LCOV_EXCL_LINE
}
static void __handle_passphrase_changed(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");
+ DBG("+\n"); //LCOV_EXCL_LINE
_retm_if(user_data == NULL, "parameter(user_data) is NULL\n");
__tethering_h *th = (__tethering_h *)user_data;
data = th->passphrase_user_data;
pcb(data);
- DBG("-\n");
+ DBG("-\n"); //LCOV_EXCL_LINE
}
static void __wifi_enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
gpointer user_data)
{
- INFO("+\n");
+ INFO("+\n"); //LCOV_EXCL_LINE
_retm_if(user_data == NULL, "parameter(user_data) is NULL\n");
GError *g_error = NULL;
tethering_enabled_cb ecb = th->enabled_cb[TETHERING_TYPE_WIFI];
void *data = th->enabled_user_data[TETHERING_TYPE_WIFI];
+ if (!_tethering_check_handle((tethering_h)user_data))
+ return;
+
g_var = g_dbus_proxy_call_finish(th->client_bus_proxy, res, &g_error);
if (g_error) {
//LCOV_EXCL_START
}
retry = 0;
- INFO("cfm event : wifi tethering enable info : %d\n", error);
+ INFO("cfm event : wifi tethering enable info : %d\n", error); //LCOV_EXCL_LINE
sigs[E_SIGNAL_WIFI_TETHER_ON].sig_id = g_dbus_connection_signal_subscribe(th->client_bus,
NULL, TETHERING_SERVICE_INTERFACE, sigs[E_SIGNAL_WIFI_TETHER_ON].name,
sigs[E_SIGNAL_WIFI_TETHER_ON].cb, (gpointer)th, NULL);
if (!ecb) {
- INFO("-\n");
+ INFO("-\n"); //LCOV_EXCL_LINE
return;
}
ecb(error, TETHERING_TYPE_WIFI, true, data);
g_variant_unref(g_var);
- INFO("-\n");
+ INFO("-\n"); //LCOV_EXCL_LINE
}
static void __bt_enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
gpointer user_data)
{
- DBG("+\n");
+ DBG("+\n"); //LCOV_EXCL_LINE
_retm_if(user_data == NULL, "parameter(user_data) is NULL\n");
GError *g_error = NULL;
GVariant *g_var;
tethering_enabled_cb ecb = th->enabled_cb[TETHERING_TYPE_BT];
void *data = th->enabled_user_data[TETHERING_TYPE_BT];
+ if (!_tethering_check_handle((tethering_h)user_data))
+ return;
+
g_var = g_dbus_proxy_call_finish(th->client_bus_proxy, res, &g_error);
if (g_error) {
//LCOV_EXCL_START
sigs[E_SIGNAL_BT_TETHER_ON].cb, (gpointer)th, NULL);
if (!ecb) {
- DBG("-\n");
+ DBG("-\n"); //LCOV_EXCL_LINE
return;
}
tethering_enabled_cb ecb = th->enabled_cb[TETHERING_TYPE_USB];
void *data = th->enabled_user_data[TETHERING_TYPE_USB];
+ if (!_tethering_check_handle((tethering_h)user_data))
+ return;
+
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);
ecb(error, TETHERING_TYPE_USB, true, data);
DBG("-\n");
}
+
+static void __p2p_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_P2P];
+ void *data = th->enabled_user_data[TETHERING_TYPE_P2P];
+
+ if (!_tethering_check_handle((tethering_h)user_data))
+ return;
+
+ 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_P2P);
+ 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;
+
+ if (!ecb) {
+ DBG("-\n");
+ return;
+ }
+
+ ecb(error, TETHERING_TYPE_P2P, true, data);
+ DBG("-\n");
+}
//LCOV_EXCL_STOP
static void __disabled_cfm_cb(GObject *source_object, GAsyncResult *res,
gpointer user_data)
{
- INFO("+\n");
+ INFO("+\n"); //LCOV_EXCL_LINE
_retm_if(user_data == NULL, "parameter(user_data) is NULL\n");
GError *g_error = NULL;
tethering_disabled_cb dcb = NULL;
void *data = NULL;
+ if (!_tethering_check_handle((tethering_h)user_data))
+ return;
+
g_var = g_dbus_proxy_call_finish(th->client_bus_proxy, res, &g_error);
if (g_error) {
//LCOV_EXCL_START
if (dcb)
dcb(error, type, code, data);
break;
- //LCOV_EXCL_STOP
+
+ case MOBILE_AP_DISABLE_P2P_TETHERING_CFM:
+ type = TETHERING_TYPE_P2P;
+ dcb = th->disabled_cb[type];
+ data = th->disabled_user_data[type];
+ if (dcb)
+ dcb(error, type, code, data);
+ break;
case MOBILE_AP_DISABLE_CFM:
default:
ERR("Invalid event\n");
break;
+ //LCOV_EXCL_STOP
}
- INFO("-\n");
+ INFO("-\n"); //LCOV_EXCL_LINE
}
static void __get_data_usage_cb(GObject *source_object, GAsyncResult *res,
//LCOV_EXCL_STOP
}
if (th->data_usage_cb == NULL) {
- ERR("There is no data_usage_cb\n");
+ ERR("There is no data_usage_cb\n"); //LCOV_EXCL_LINE
return;
}
if (flag) {
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);
+ ERR("DBus fail [%s]\n", g_error->message); //LCOV_EXCL_LINE
if (g_error->code == G_DBUS_ERROR_ACCESS_DENIED)
tethering_error = TETHERING_ERROR_PERMISSION_DENIED;
else
g_strlcpy(buf, TETHERING_BT_IF, len);
break;
+ //LCOV_EXCL_START
default:
ERR("Not supported type : %d\n", type);
return false;
+ //LCOV_EXCL_STOP
}
return true;
}
_retvm_if(buf == NULL, false, "parameter(buf) is NULL\n");
switch (type) {
+ //LCOV_EXCL_START
case TETHERING_TYPE_USB:
g_strlcpy(buf, TETHERING_USB_GATEWAY, len);
break;
-
+ //LCOV_EXCL_STOP
case TETHERING_TYPE_WIFI:
g_strlcpy(buf, TETHERING_WIFI_GATEWAY, len);
break;
case TETHERING_TYPE_BT:
g_strlcpy(buf, TETHERING_BT_GATEWAY, len);
break;
-
+ //LCOV_EXCL_START
default:
ERR("Not supported type : %d\n", type);
return false;
+ //LCOV_EXCL_STOP
}
return true;
}
char *ptr = NULL;
if (th == NULL || set == NULL) {
- ERR("null parameter\n-\n");
+ ERR("null parameter\n-\n"); //LCOV_EXCL_LINE
return TETHERING_ERROR_INVALID_PARAMETER;
}
static bool __check_precondition(tethering_type_e type)
{
- int dnet_state = 0;
+ int dnet_status = 0;
int cellular_state = 0;
- int wifi_state = 0;
/* data network through cellular */
vconf_get_int(VCONFKEY_NETWORK_CELLULAR_STATE, &cellular_state);
return TRUE;
}
-#ifdef TIZEN_TV_EXT
- /* data network through ethernet */
- vconf_get_int(VCONFKEY_NETWORK_STATUS, &dnet_state);
- if (dnet_state == VCONFKEY_NETWORK_ETHERNET) {
- INFO("Data Network is connected");
- return TRUE;
- }
-#else
- vconf_get_int(VCONFKEY_DNET_STATE, &dnet_state);
- if (dnet_state > VCONFKEY_DNET_OFF) {
- INFO("Data Network is connected");
+ /* data network status */
+ vconf_get_int(VCONFKEY_NETWORK_STATUS, &dnet_status);
+ if ((dnet_status == VCONFKEY_NETWORK_WIFI
+ && type != TETHERING_TYPE_WIFI)
+ || dnet_status == VCONFKEY_NETWORK_ETHERNET)
return TRUE;
- }
-#endif/*TIZEN_TV_EXT*/
-
- /* data network through wifi */
- if (type != TETHERING_TYPE_WIFI) {
- vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_state);
- if (wifi_state > VCONFKEY_WIFI_UNCONNECTED) {
- INFO("Wi-Fi is connected!");
- return TRUE;
- }
- }
ERR("Network is not available!");
return FALSE;
th->sec_type = TETHERING_WIFI_SECURITY_TYPE_WPA2_PSK;
th->visibility = true;
th->mac_filter = false;
- th->channel = 6;
+ th->channel = TETHERING_WIFI_CHANNEL;
th->mode_type = TETHERING_WIFI_MODE_TYPE_G;
th->wifi_max_connected = TETHERING_WIFI_MAX_STA;
- th->change_mac = false;
if (__generate_initial_passphrase(th->passphrase,
sizeof(th->passphrase)) == 0) {
- ERR("random passphrase generation failed\n"); //LCOV_EXCL_LINE
+ //LCOV_EXCL_START
+ ERR("random passphrase generation failed\n");
free(th);
return TETHERING_ERROR_OPERATION_FAILED;
+ //LCOV_EXCL_STOP
}
if (__get_common_ssid(ssid, sizeof(ssid)) != TETHERING_ERROR_NONE) {
- ERR("common ssid get failed\n"); //LCOV_EXCL_LINE
+ //LCOV_EXCL_START
+ ERR("common ssid get failed\n");
free(th);
return TETHERING_ERROR_OPERATION_FAILED;
+ //LCOV_EXCL_STOP
}
#if !GLIB_CHECK_VERSION(2, 36, 0)
__connect_signals((tethering_h)th);
*tethering = (tethering_h)th;
- INFO("Tethering Handle : 0x%X\n", th);
+ _tethering_add_handle(th);
+ INFO("Tethering Handle : %p\n", th);
INFO("-\n");
return TETHERING_ERROR_NONE;
}
_retvm_if(tethering == NULL, TETHERING_ERROR_INVALID_PARAMETER,
"parameter(tethering) is NULL\n");
- GVariant *result = NULL;
__tethering_h *th = (__tethering_h *)tethering;
- INFO("Tethering Handle : 0x%X\n", th);
-
- if (th->change_mac) {
- result = g_dbus_proxy_call_sync(th->client_bus_proxy, "reset_mac", NULL,
- G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL);
- g_variant_unref(result);
- }
+ INFO("Tethering Handle : %p\n", th);
__disconnect_signals(tethering);
+ _tethering_remove_handle(th);
if (th->ssid)
free(th->ssid);
g_object_unref(th->client_bus_proxy);
g_object_unref(th->client_bus);
memset(th, 0x00, sizeof(__tethering_h));
+
free(th);
INFO("-\n");
ret = __prepare_wifi_settings(tethering, &set);
if (ret != TETHERING_ERROR_NONE) {
+ //LCOV_EXCL_START
ERR("softap settings initialization failed\n");
DBG("-\n");
return TETHERING_ERROR_OPERATION_FAILED;
+ //LCOV_EXCL_STOP
}
g_dbus_connection_signal_unsubscribe(connection,
sigs[E_SIGNAL_WIFI_TETHER_ON].sig_id);
g_dbus_connection_signal_unsubscribe(connection,
sigs[E_SIGNAL_BT_TETHER_ON].sig_id);
- g_dbus_proxy_call(proxy, "enable_bt_tethering", NULL,
+ g_dbus_proxy_call(proxy, "enable_bt_tethering",
+ g_variant_new("(i)", TETHERING_ADDRESS_FAMILY_IPV4),
G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
(GAsyncReadyCallback) __bt_enabled_cfm_cb, (gpointer)tethering);
break;
//LCOV_EXCL_START
+ case TETHERING_TYPE_P2P: {
+ _softap_settings_t p2p_set = {"", "", "", 0, false};
+ ret = __prepare_wifi_settings(tethering, &p2p_set);
+ if (ret != TETHERING_ERROR_NONE) {
+ ERR("p2p settings initialization failed\n");
+ DBG("-\n");
+ return TETHERING_ERROR_OPERATION_FAILED;
+ }
+
+ g_dbus_proxy_call(proxy, "enable_p2p_tethering",
+ g_variant_new("(ssi)", p2p_set.ssid, p2p_set.key, p2p_set.channel),
+ G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
+ (GAsyncReadyCallback) __p2p_enabled_cfm_cb, (gpointer)tethering);
+ break;
+ }
+
case TETHERING_TYPE_ALL: {
_softap_settings_t set = {"", "", "", 0, false};
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("(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);
g_dbus_connection_signal_unsubscribe(connection,
sigs[E_SIGNAL_BT_TETHER_ON].sig_id);
- g_dbus_proxy_call(proxy, "enable_usb_tethering", NULL,
+ g_dbus_proxy_call(proxy, "enable_bt_tethering",
+ g_variant_new("(i)", TETHERING_ADDRESS_FAMILY_IPV4),
G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
(GAsyncReadyCallback) __bt_enabled_cfm_cb, (gpointer)tethering);
break;
- //LCOV_EXCL_STOP
}
default:
ERR("Unknown type : %d\n", type);
DBG("-\n");
return TETHERING_ERROR_INVALID_PARAMETER;
}
+ //LCOV_EXCL_STOP
g_dbus_proxy_set_default_timeout(proxy, DBUS_TIMEOUT_USE_DEFAULT);
INFO("-\n");
}
switch (type) {
- //LCOV_EXCL_START
case TETHERING_TYPE_WIFI: {
_softap_settings_t set = {"", "", "", 0, false, false, 0, 0};
sigs[E_SIGNAL_BT_TETHER_OFF].sig_id);
g_dbus_proxy_call(proxy, "disable_bt_tethering",
- g_variant_new("(i)", TETHERING_ADDRESS_FAMILY_IPV6), G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
+ g_variant_new("(i)", TETHERING_ADDRESS_FAMILY_IPV6),
+ G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
(GAsyncReadyCallback) __disabled_cfm_cb, (gpointer)tethering);
break;
GDBusConnection *connection = th->client_bus;
switch (type) {
+ //LCOV_EXCL_START
case TETHERING_TYPE_USB:
g_dbus_connection_signal_unsubscribe(connection,
sigs[E_SIGNAL_USB_TETHER_OFF].sig_id);
(GAsyncReadyCallback) __disabled_cfm_cb, (gpointer)tethering);
break;
+ //LCOV_EXCL_STOP
case TETHERING_TYPE_WIFI:
sigs[E_SIGNAL_WIFI_TETHER_OFF].sig_id);
g_dbus_proxy_call(proxy, "disable_wifi_tethering",
- NULL, G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
+ g_variant_new("(i)", TETHERING_ADDRESS_FAMILY_IPV4),
+ G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
(GAsyncReadyCallback) __disabled_cfm_cb, (gpointer)tethering);
break;
sigs[E_SIGNAL_BT_TETHER_OFF].sig_id);
g_dbus_proxy_call(proxy, "disable_bt_tethering",
+ g_variant_new("(i)", TETHERING_ADDRESS_FAMILY_IPV4),
+ G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
+ (GAsyncReadyCallback) __disabled_cfm_cb, (gpointer)tethering);
+ break;
+
+ //LCOV_EXCL_START
+ case TETHERING_TYPE_P2P:
+ g_dbus_proxy_call(proxy, "disable_p2p_tethering",
NULL, G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
(GAsyncReadyCallback) __disabled_cfm_cb, (gpointer)tethering);
break;
sigs[E_SIGNAL_WIFI_TETHER_OFF].sig_id);
g_dbus_proxy_call(proxy, "disable_wifi_tethering",
- NULL, G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
+ g_variant_new("(i)", TETHERING_ADDRESS_FAMILY_IPV4),
+ G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
(GAsyncReadyCallback) __disabled_cfm_cb, (gpointer)tethering);
g_dbus_connection_signal_unsubscribe(connection,
sigs[E_SIGNAL_BT_TETHER_OFF].sig_id);
g_dbus_proxy_call(proxy, "disable_bt_tethering",
- NULL, G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
+ g_variant_new("(i)", TETHERING_ADDRESS_FAMILY_IPV4),
+ G_DBUS_CALL_FLAGS_NONE, -1, th->cancellable,
(GAsyncReadyCallback) __disabled_cfm_cb, (gpointer)tethering);
break;
ERR("Not supported tethering type [%d]\n", type);
DBG("-\n");
return TETHERING_ERROR_INVALID_PARAMETER;
+ //LCOV_EXCL_STOP
}
INFO("-\n");
return TETHERING_ERROR_NONE;
vconf_type = VCONFKEY_MOBILE_HOTSPOT_MODE_BT;
break;
+ case TETHERING_TYPE_P2P:
+ vconf_type = VCONFKEY_MOBILE_HOTSPOT_MODE_P2P;
+ break;
+
default:
ERR("Not supported type : %d\n", type);
break;
API int tethering_get_mac_address(tethering_h tethering, tethering_type_e type, char **mac_address)
{
CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE);
- if (type == TETHERING_TYPE_USB) CHECK_FEATURE_SUPPORTED(TETHERING_USB_FEATURE);
+ if (type == TETHERING_TYPE_USB) CHECK_FEATURE_SUPPORTED(TETHERING_USB_FEATURE); //LCOV_EXCL_LINE
else if (type == TETHERING_TYPE_WIFI) CHECK_FEATURE_SUPPORTED(TETHERING_WIFI_FEATURE);
- else if (type == TETHERING_TYPE_BT) CHECK_FEATURE_SUPPORTED(TETHERING_BT_FEATURE);
+ else if (type == TETHERING_TYPE_BT) CHECK_FEATURE_SUPPORTED(TETHERING_BT_FEATURE); //LCOV_EXCL_LINE
_retvm_if(tethering_is_enabled(tethering, type) == false,
TETHERING_ERROR_NOT_ENABLED,
_retvm_if(s < 0, TETHERING_ERROR_OPERATION_FAILED,
"getting socket is failed\n");
if (ioctl(s, SIOCGIFHWADDR, &ifr) < 0) {
+ //LCOV_EXCL_START
ERR("getting mac is failed\n");
close(s);
return TETHERING_ERROR_OPERATION_FAILED;
+ //LCOV_EXCL_STOP
}
close(s);
API int tethering_get_ip_address(tethering_h tethering, tethering_type_e type, tethering_address_family_e address_family, char **ip_address)
{
CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE);
- if (type == TETHERING_TYPE_USB) CHECK_FEATURE_SUPPORTED(TETHERING_USB_FEATURE);
+ if (type == TETHERING_TYPE_USB) CHECK_FEATURE_SUPPORTED(TETHERING_USB_FEATURE); //LCOV_EXCL_LINE
else if (type == TETHERING_TYPE_WIFI) CHECK_FEATURE_SUPPORTED(TETHERING_WIFI_FEATURE);
- else if (type == TETHERING_TYPE_BT) CHECK_FEATURE_SUPPORTED(TETHERING_BT_FEATURE);
+ else if (type == TETHERING_TYPE_BT) CHECK_FEATURE_SUPPORTED(TETHERING_BT_FEATURE); //LCOV_EXCL_LINE
_retvm_if(tethering_is_enabled(tethering, type) == false,
TETHERING_ERROR_NOT_ENABLED,
NULL, G_DBUS_CALL_FLAGS_NONE,
-1, th->cancellable, &error);
if (error)
- ERR("g_dbus_proxy_call_sync is failed and error is %s\n", error->message);
+ ERR("g_dbus_proxy_call_sync is failed and error is %s\n", error->message); //LCOV_EXCL_LINE
g_variant_get(result, "(a(a{sv}))", &outer_iter);
+ //LCOV_EXCL_START
while (g_variant_iter_loop(outer_iter, "(@a{sv})", &station)) {
g_variant_get(station, "a{sv}", &inner_iter);
while (g_variant_iter_loop(inner_iter, "{sv}", &key, &value)) {
client.interface = TETHERING_TYPE_WIFI;
else if (interface == MOBILE_AP_TYPE_BT)
client.interface = TETHERING_TYPE_BT;
+ else if (interface == MOBILE_AP_TYPE_P2P)
+ client.interface = TETHERING_TYPE_P2P;
else {
ERR("Invalid interface\n");
g_free(key);
g_free(hostname);
g_free(ip);
g_free(mac);
+
+ hostname = NULL;
+ ip = NULL;
+ mac = NULL;
+
g_variant_iter_free(inner_iter);
if (callback((tethering_client_h)&client, user_data) == false) {
DBG("iteration is stopped\n");
g_free(client.hostname);
+ client.hostname = NULL;
g_variant_iter_free(outer_iter);
g_variant_unref(station);
g_variant_unref(result);
return TETHERING_ERROR_OPERATION_FAILED;
}
g_free(client.hostname);
+ client.hostname = NULL;
}
+ //LCOV_EXCL_STOP
g_variant_iter_free(outer_iter);
g_variant_unref(station);
g_variant_unref(result);
}
/* TETHERING_TYPE_ALL */
- for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_BT; ti++) {
+ for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_P2P; ti++) {
th->enabled_cb[ti] = callback;
th->enabled_user_data[ti] = user_data;
}
}
/* TETHERING_TYPE_ALL */
- for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_BT; ti++) {
+ for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_P2P; ti++) {
th->enabled_cb[ti] = NULL;
th->enabled_user_data[ti] = NULL;
}
}
/* TETHERING_TYPE_ALL */
- for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_BT; ti++) {
+ for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_P2P; ti++) {
th->disabled_cb[ti] = callback;
th->disabled_user_data[ti] = user_data;
}
}
/* TETHERING_TYPE_ALL */
- for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_BT; ti++) {
+ for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_P2P; ti++) {
th->disabled_cb[ti] = NULL;
th->disabled_user_data[ti] = NULL;
}
}
/* TETHERING_TYPE_ALL */
- for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_BT; ti++) {
+ for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_P2P; ti++) {
th->changed_cb[ti] = callback;
th->changed_user_data[ti] = user_data;
}
}
/* TETHERING_TYPE_ALL */
- for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_BT; ti++) {
+ for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_P2P; ti++) {
th->changed_cb[ti] = NULL;
th->changed_user_data[ti] = NULL;
}
}
if (*ssid == NULL) {
- ERR("strdup is failed\n");
+ ERR("strdup is failed\n"); //LCOV_EXCL_LINE
return TETHERING_ERROR_OUT_OF_MEMORY;
}
ret = __set_visible(visible);
if (ret == TETHERING_ERROR_NONE) {
-
__send_dbus_signal(th->client_bus,
SIGNAL_NAME_SSID_VISIBILITY_CHANGED,
visible ? SIGNAL_MSG_SSID_VISIBLE :
DBG("+\n");
if (th->settings_reloaded_cb) {
- ERR("Operation in progress\n");
+ ERR("Operation in progress\n"); //LCOV_EXCL_LINE
return TETHERING_ERROR_OPERATION_FAILED;
}
ret = __prepare_wifi_settings(tethering, &set);
if (ret != TETHERING_ERROR_NONE) {
- ERR("softap settings initialization failed\n");
+ ERR("softap settings initialization failed\n"); //LCOV_EXCL_LINE
return TETHERING_ERROR_OPERATION_FAILED;
}
p_mac = strdup(mac);
if (p_mac == NULL) {
- ERR("strdup failed\n");
+ ERR("strdup failed\n"); //LCOV_EXCL_LINE
return TETHERING_ERROR_OUT_OF_MEMORY;
}
fp = fopen(filepath, "a+");
if (!fp) {
- ERR("fopen is failed\n");
+ ERR("fopen is failed\n"); //LCOV_EXCL_LINE
return TETHERING_ERROR_OPERATION_FAILED;
}
while (fgets(line, MAX_BUF_SIZE, fp) != NULL) {
if (strncmp(mac, line, 17) == 0) {
- DBG("MAC %s already exist in the list\n", mac);
+ DBG("MAC %s already exist in the list\n", mac); //LCOV_EXCL_LINE
mac_exist = true;
break;
}
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)
result = TETHERING_ERROR_PERMISSION_DENIED;
th->dhcp_enabled = false;
return result;
+ //LCOV_EXCL_STOP
}
g_variant_get(parameters, "(u)", &result);
g_variant_new("(ss)", rangestart, rangestop),
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)
th->dhcp_enabled = false;
return result;
+ //LCOV_EXCL_STOP
}
g_variant_get(parameters, "(u)", &result);
G_DBUS_CALL_FLAGS_NONE,
-1, th->cancellable, &error);
if (error) {
+ //LCOV_EXCL_START
ERR("g_dbus_proxy_call_sync is failed and error is %s\n", error->message);
g_clear_error(&error);
return TETHERING_ERROR_OPERATION_FAILED;
+ //LCOV_EXCL_STOP
}
return TETHERING_ERROR_NONE;
}
g_variant_get(result, "(u)", txpower);
g_variant_unref(result);
} else {
+ //LCOV_EXCL_START
if (error)
ERR("g_dbus_proxy_call_sync is failed and error is %s\n", error->message);
g_clear_error(&error);
return TETHERING_ERROR_OPERATION_FAILED;
+ //LCOV_EXCL_STOP
}
g_clear_error(&error);
return TETHERING_ERROR_NONE;
g_variant_new("(u)", mtu),
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)
g_error_free(error);
return result;
+ //LCOV_EXCL_STOP
}
g_variant_get(parameters, "(u)", &result);
g_variant_new("(s)", mac),
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)
g_error_free(error);
return result;
+ //LCOV_EXCL_STOP
}
g_variant_get(parameters, "(u)", &result);
-
g_variant_unref(parameters);
- th->change_mac = true;
+ if (result == MOBILE_AP_ERROR_NOT_PERMITTED)
+ return TETHERING_ERROR_NOT_SUPPORT_API;
return TETHERING_ERROR_NONE;
}
g_variant_new("(b)", enable),
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)
g_error_free(error);
return result;
+ //LCOV_EXCL_STOP
}
g_variant_get(parameters, "(u)", &result);
g_variant_new("(sssisi)", ifname, protocol, org_ip, org_port, final_ip, final_port),
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)
g_error_free(error);
return result;
+ //LCOV_EXCL_STOP
}
g_variant_get(parameters, "(u)", &result);
list = strdup(cmd);
if (list == NULL) {
- ERR("strdup failed\n");
+ ERR("strdup failed\n"); //LCOV_EXCL_LINE
return TETHERING_ERROR_OUT_OF_MEMORY;
}
parameters = g_dbus_proxy_call_sync(proxy, "reset_port_forwarding_rule",
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)
g_error_free(error);
return result;
+ //LCOV_EXCL_STOP
}
g_variant_get(parameters, "(u)", &result);
g_variant_new("(b)", enable),
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)
g_error_free(error);
return result;
+ //LCOV_EXCL_STOP
}
g_variant_get(parameters, "(u)", &result);
g_variant_new("(isb)", port, protocol, allow),
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)
g_error_free(error);
return result;
+ //LCOV_EXCL_STOP
}
g_variant_get(parameters, "(u)", &result);
list = strdup(cmd);
if (list == NULL) {
- ERR("strdup failed\n");
+ ERR("strdup failed\n"); //LCOV_EXCL_LINE
return TETHERING_ERROR_OUT_OF_MEMORY;
}
g_variant_new("(iisb)", port1, port2, protocol, allow),
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)
g_error_free(error);
return result;
+ //LCOV_EXCL_STOP
}
g_variant_get(parameters, "(u)", &result);
list = strdup(cmd);
if (list == NULL) {
- ERR("strdup failed\n");
+ ERR("strdup failed\n"); //LCOV_EXCL_LINE
return TETHERING_ERROR_OUT_OF_MEMORY;
}
g_variant_new("(ib)", type, enable),
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)
g_error_free(error);
return result;
+ //LCOV_EXCL_STOP
}
g_variant_get(parameters, "(u)", &result);
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)
g_error_free(error);
return ret;
+ //LCOV_EXCL_STOP
}
if (parameters != NULL) {
g_variant_new("(s)", wps_pin), 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)
g_error_free(error);
return ret;
+ //LCOV_EXCL_STOP
}
if (parameters != NULL) {