{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, "", NULL} };
static int retry = 0;
GVariant *message = NULL;
GError *error = NULL;
- if (arg) {
+ if (arg)
message = g_variant_new("(s)", arg);
- }
g_dbus_connection_emit_signal(conn, NULL, TETHERING_SERVICE_OBJECT_PATH,
TETHERING_SERVICE_INTERFACE, signal_name, message, &error);
return TETHERING_ERROR_OPERATION_FAILED;
} else {
*passphrase_len = ret;
- g_strlcpy(passphrase,tmp,(*passphrase_len)+1);
+ g_strlcpy(passphrase, tmp, (*passphrase_len)+1);
if (__set_passphrase(passphrase, *passphrase_len) != TETHERING_ERROR_NONE) {
- DBG("set_passphrase is failed : %s, %d",passphrase, *passphrase_len);
+ DBG("set_passphrase is failed : %s, %d", passphrase, *passphrase_len);
return TETHERING_ERROR_OPERATION_FAILED;
}
}
void *data = NULL;
char *buf = NULL;
char *name = NULL;
- char *mac= NULL;
- char *ip= NULL;
+ char *mac = NULL;
+ char *ip = NULL;
guint timestamp;
memset(&client, 0, sizeof(__tethering_client_h));
ccb((tethering_client_h)&client, opened, data);
g_free(client.hostname);
-DONE :
+DONE:
g_free(buf);
g_free(ip);
g_free(mac);
tethering_disabled_cause_e code = TETHERING_DISABLED_BY_OTHERS;
tethering_disabled_cb dcb = NULL;
void *data = NULL;
- char *buf= NULL;
+ char *buf = NULL;
dcb = th->disabled_cb[type];
if (dcb == NULL)
DBG("-\n");
}
-static void __bt_enabled_cfm_cb (GObject *source_object, GAsyncResult *res,
+static void __bt_enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
gpointer user_data)
{
DBG("+\n");
DBG("-\n");
}
-static void __usb_enabled_cfm_cb (GObject *source_object, GAsyncResult *res,
+static void __usb_enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
gpointer user_data)
{
DBG("+\n");
DBG("-\n");
}
-static void __wifi_ap_enabled_cfm_cb (GObject *source_object, GAsyncResult *res,
+static void __wifi_ap_enabled_cfm_cb(GObject *source_object, GAsyncResult *res,
gpointer user_data)
{
DBG("+\n");
int i = 0;
- for (i = E_SIGNAL_NET_CLOSED; i < E_SIGNAL_MAX; i++) {
+ for (i = E_SIGNAL_NET_CLOSED; i < E_SIGNAL_MAX; i++)
g_dbus_connection_signal_unsubscribe(connection, sigs[i].sig_id);
- }
DBG("-\n");
}
return TETHERING_ERROR_INVALID_PARAMETER;
}
- if (th->ssid == NULL) {
+ if (th->ssid == NULL)
__get_common_ssid(set->ssid, sizeof(set->ssid));
- } else {
+ else
g_strlcpy(set->ssid, th->ssid, sizeof(set->ssid));
- }
ret = __get_security_type(&set->sec_type);
- if (ret != TETHERING_ERROR_NONE) {
+ if (ret != TETHERING_ERROR_NONE)
set->sec_type = th->sec_type;
- }
ret = __get_visible(&set->visibility);
- if (ret != TETHERING_ERROR_NONE) {
+ if (ret != TETHERING_ERROR_NONE)
set->visibility = th->visibility;
- }
if (set->sec_type == TETHERING_WIFI_SECURITY_TYPE_NONE) {
g_strlcpy(set->key, "", sizeof(set->key));
set->sec_type = th->sec_type;
set->visibility = th->visibility;
- if (set->sec_type == TETHERING_WIFI_SECURITY_TYPE_NONE) {
+ if (set->sec_type == TETHERING_WIFI_SECURITY_TYPE_NONE)
g_strlcpy(set->key, "", sizeof(set->key));
- } else {
+ else
g_strlcpy(set->key, th->passphrase, sizeof(set->key));
- }
+
DBG("-\n");
return TETHERING_ERROR_NONE;
}
int cellular_state = 0;
int wifi_state = 0;
- // data network through cellular
+ /* data network through cellular */
vconf_get_int(VCONFKEY_NETWORK_CELLULAR_STATE, &cellular_state);
- if(cellular_state == VCONFKEY_NETWORK_CELLULAR_ON) {
+ if (cellular_state == VCONFKEY_NETWORK_CELLULAR_ON) {
ERR("Data Network can be connected later");
return TRUE;
}
vconf_get_int(VCONFKEY_DNET_STATE, &dnet_state);
- if(dnet_state > VCONFKEY_DNET_OFF) {
+ if (dnet_state > VCONFKEY_DNET_OFF) {
ERR("Data Network is connected");
return TRUE;
}
- // data network through wifi
- if(type != TETHERING_TYPE_WIFI) {
+ /* data network through wifi */
+ if (type != TETHERING_TYPE_WIFI) {
vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_state);
- if(wifi_state > VCONFKEY_WIFI_UNCONNECTED) {
+ if (wifi_state > VCONFKEY_WIFI_UNCONNECTED) {
ERR("Wi-Fi is connected!");
return TRUE;
}
return TETHERING_ERROR_OPERATION_FAILED;
}
-#if !GLIB_CHECK_VERSION(2,36,0)
+#if !GLIB_CHECK_VERSION(2, 36, 0)
g_type_init();
#endif
GCancellable *cancellable = g_cancellable_new();
g_dbus_proxy_set_default_timeout(proxy, DBUS_TIMEOUT_INFINITE);
- if(type != TETHERING_TYPE_RESERVED
+ if (type != TETHERING_TYPE_RESERVED
&& __check_precondition(type) == FALSE) {
DBG("-\n");
return TETHERING_ERROR_OPERATION_FAILED;
(GAsyncReadyCallback) __disabled_cfm_cb, (gpointer)tethering);
break;
- default :
+ default:
ERR("Not supported tethering type [%d]\n", type);
DBG("-\n");
return TETHERING_ERROR_INVALID_PARAMETER;
CHECK_FEATURE_SUPPORTED(TETHERING_FEATURE);
- if (vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_MODE, &is_on) != 0) {
+ if (vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_MODE, &is_on) != 0)
return FALSE;
- }
switch (type) {
case TETHERING_TYPE_USB:
result = g_dbus_proxy_call_sync(th->client_bus_proxy, "get_station_info",
NULL, G_DBUS_CALL_FLAGS_NONE,
-1, th->cancellable, &error);
- if (error) {
+ if (error)
ERR("g_dbus_proxy_call_sync is failed and error is %s\n", error->message);
- }
g_variant_get(result, "(a(a{sv}))", &outer_iter);
while (g_variant_iter_loop(outer_iter, "(@a{sv})", &station)) {
g_variant_get(station, "a{sv}", &inner_iter);
} else if (g_strcmp0(key, "Name") == 0) {
g_variant_get(value, "s", &hostname);
SDBG("hsotname is %s\n", hostname);
- if (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);
ret = tethering_set_enabled_cb(th, TETHERING_TYPE_ALL,
cbs->enabled_cb, user_data);
- if (__is_err(ret) == true) {
+ if (__is_err(ret) == true)
g_print("tethering_set_enabled_cb is failed\n");
- }
ret = tethering_set_enabled_cb(th, TETHERING_TYPE_RESERVED,
cbs->enabled_cb, user_data);
- if (__is_err(ret) == true) {
+ if (__is_err(ret) == true)
g_print("tethering_set_enabled_cb is failed\n");
- }
ret = tethering_set_disabled_cb(th, TETHERING_TYPE_ALL,
cbs->disabled_cb, user_data);
- if (__is_err(ret) == true) {
+ if (__is_err(ret) == true)
g_print("tethering_set_disabled_cb is failed\n");
- }
ret = tethering_set_disabled_cb(th, TETHERING_TYPE_RESERVED,
cbs->disabled_cb, user_data);
- if (__is_err(ret) == true) {
+ if (__is_err(ret) == true)
g_print("tethering_set_disabled_cb is failed\n");
- }
ret = tethering_set_connection_state_changed_cb(th, TETHERING_TYPE_ALL,
cbs->changed_cb, user_data);
- if (__is_err(ret) == true) {
+ if (__is_err(ret) == true)
g_print("tethering_set_connection_state_changed_cb is failed\n");
- }
ret = tethering_set_connection_state_changed_cb(th, TETHERING_TYPE_RESERVED,
cbs->changed_cb, user_data);
- if (__is_err(ret) == true) {
+ if (__is_err(ret) == true)
g_print("tethering_set_connection_state_changed_cb is failed\n");
- }
ret = tethering_wifi_set_security_type_changed_cb(th,
cbs->security_type_changed_cb, user_data);
- if (__is_err(ret) == true) {
+ if (__is_err(ret) == true)
g_print("tethering_wifi_set_security_type_changed_cb is failed\n");
- }
ret = tethering_wifi_set_ssid_visibility_changed_cb(th,
cbs->ssid_visibility_changed_cb, user_data);
- if (__is_err(ret) == true) {
+ if (__is_err(ret) == true)
g_print("tethering_wifi_set_ssid_visibility_changed_cb is failed\n");
- }
ret = tethering_wifi_set_passphrase_changed_cb(th,
cbs->passphrase_changed_cb, user_data);
- if (__is_err(ret) == true) {
+ if (__is_err(ret) == true)
g_print("tethering_wifi_set_passphrase_changed_cb is failed\n");
- }
return;
}
tethering_error_e ret = TETHERING_ERROR_NONE;
ret = tethering_unset_enabled_cb(th, TETHERING_TYPE_ALL);
- if (__is_err(ret) == true) {
+ if (__is_err(ret) == true)
g_print("tethering_unset_enabled_cb is failed\n");
- }
ret = tethering_unset_enabled_cb(th, TETHERING_TYPE_RESERVED);
- if (__is_err(ret) == true) {
+ if (__is_err(ret) == true)
g_print("tethering_unset_enabled_cb is failed\n");
- }
ret = tethering_unset_disabled_cb(th, TETHERING_TYPE_ALL);
- if (__is_err(ret) == true) {
+ if (__is_err(ret) == true)
g_print("tethering_unset_disabled_cb is failed\n");
- }
ret = tethering_unset_disabled_cb(th, TETHERING_TYPE_RESERVED);
- if (__is_err(ret) == true) {
+ if (__is_err(ret) == true)
g_print("tethering_unset_disabled_cb is failed\n");
- }
ret = tethering_unset_connection_state_changed_cb(th, TETHERING_TYPE_ALL);
- if (__is_err(ret) == true) {
+ if (__is_err(ret) == true)
g_print("tethering_unset_connection_state_changed_cb is failed\n");
- }
ret = tethering_unset_connection_state_changed_cb(th, TETHERING_TYPE_RESERVED);
- if (__is_err(ret) == true) {
+ if (__is_err(ret) == true)
g_print("tethering_unset_connection_state_changed_cb is failed\n");
- }
ret = tethering_wifi_unset_security_type_changed_cb(th);
- if (__is_err(ret) == true) {
+ if (__is_err(ret) == true)
g_print("tethering_wifi_unset_security_type_changed_cb is failed\n");
- }
ret = tethering_wifi_unset_ssid_visibility_changed_cb(th);
- if (__is_err(ret) == true) {
+ if (__is_err(ret) == true)
g_print("tethering_wifi_unset_ssid_visibility_changed_cb is failed\n");
- }
ret = tethering_wifi_unset_passphrase_changed_cb(th);
- if (__is_err(ret) == true) {
+ if (__is_err(ret) == true)
g_print("tethering_wifi_unset_passphrase_changed_cb is failed\n");
- }
return;
}
static void __enabled_cb(tethering_error_e error, tethering_type_e type, bool is_requested, void *data)
{
if (error != TETHERING_ERROR_NONE) {
- if (!is_requested) {
+ if (!is_requested)
return;
- }
g_print("## %s is not enabled. error code[0x%X]\n",
__convert_tethering_type_to_str(type),
static void __disabled_cb(tethering_error_e error, tethering_type_e type, tethering_disabled_cause_e code, void *data)
{
if (error != TETHERING_ERROR_NONE) {
- if (code != TETHERING_DISABLED_BY_REQUEST) {
+ if (code != TETHERING_DISABLED_BY_REQUEST)
return;
- }
g_print("## %s is not disabled. error code[0x%X]\n",
__convert_tethering_type_to_str(type), error);
}
/* Get information */
- if (tethering_client_get_tethering_type(clone, &type) != TETHERING_ERROR_NONE) {
+ if (tethering_client_get_tethering_type(clone, &type) != TETHERING_ERROR_NONE)
g_print("tethering_client_get_type is failed\n");
- }
- if (tethering_client_get_ip_address(clone, TETHERING_ADDRESS_FAMILY_IPV4, &ip_address) != TETHERING_ERROR_NONE) {
+ if (tethering_client_get_ip_address(clone, TETHERING_ADDRESS_FAMILY_IPV4, &ip_address) != TETHERING_ERROR_NONE)
g_print("tethering_client_get_ip_address is failed\n");
- }
- if (tethering_client_get_mac_address(clone, &mac_address) != TETHERING_ERROR_NONE) {
+ if (tethering_client_get_mac_address(clone, &mac_address) != TETHERING_ERROR_NONE)
g_print("tethering_client_get_mac_address is failed\n");
- }
- if (tethering_client_get_name(clone, &hostname) != TETHERING_ERROR_NONE) {
+ if (tethering_client_get_name(clone, &hostname) != TETHERING_ERROR_NONE)
g_print("tethering_client_get_hostname is failed\n");
- }
/* End of getting information */
g_print("\n< Client Info. >\n");
error = tethering_destroy(th);
- if (__is_err(error) == true) {
+ if (__is_err(error) == true)
return 0;
- }
}
sleep(3);
g_print("Creating tethering %dth time\n", i);
error = tethering_create(&th);
- if (__is_err(error) == true) {
+ if (__is_err(error) == true)
return 0;
- }
__register_cbs(th, &cbs, NULL);
i++;
count--;
type = TETHERING_TYPE_RESERVED;
else if (!strcmp(param, "ALL"))
type = TETHERING_TYPE_ALL;
- else {
+ else
goto DONE;
- }
if (!strcmp(cmd, "clients")) {
error = tethering_foreach_connected_clients(th, type,
__connection_state_changed_cb, __security_type_changed_cb,
__ssid_visibility_changed_cb, __passphrase_changed_cb};
-#if !GLIB_CHECK_VERSION(2,36,0)
+#if !GLIB_CHECK_VERSION(2, 36, 0)
g_type_init();
#endif
print_menu();
- mainloop = g_main_loop_new (NULL, 0);
+ mainloop = g_main_loop_new(NULL, 0);
g_main_loop_run(mainloop);
g_main_loop_unref(mainloop);