g_clear_error(&g_error);
}
result = BLUETOOTH_ERROR_INTERNAL;
+ } else {
+ g_variant_unref(reply);
}
- g_variant_unref(reply);
func_data = user_data;
if (func_data == NULL) {
g_clear_error(&g_error);
}
result = BLUETOOTH_ERROR_INTERNAL;
+ } else {
+ g_variant_unref(reply);
}
- g_variant_unref(reply);
func_data = user_data;
if (func_data == NULL) {
GDBusConnection *conn;
GDBusProxy *server_proxy;
- conn = _bt_get_system_gconn();
+ conn = _bt_gdbus_get_system_gconn();
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
adapter_path = _bt_get_adapter_path();
if (err != NULL) {
g_dbus_error_strip_remote_error(err);
BT_ERR("Network server register Error: %s\n", err->message);
- if (g_strcmp0(err->message, "Already Exists") == 0) {
+ if (g_strcmp0(err->message, "Already Exists") == 0)
ret = BLUETOOTH_ERROR_ALREADY_INITIALIZED;
- } else {
+ else
ret = BLUETOOTH_ERROR_INTERNAL;
- }
+
g_error_free(err);
}
} else {
GDBusProxy *server_proxy;
int ret = BLUETOOTH_ERROR_NONE;
- conn = _bt_get_system_gconn();
+ conn = _bt_gdbus_get_system_gconn();
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
adapter_path = _bt_get_adapter_path();
int _bt_network_connect(int request_id, int role,
bluetooth_device_address_t *device_address)
{
- const gchar *device_path = NULL;
+ gchar *device_path = NULL;
char address[BT_ADDRESS_STRING_SIZE] = { 0 };
char remote_role[BLUETOOTH_UUID_STRING_MAX] = { 0 };
bt_function_data_t *func_data;
GDBusProxy *adapter_proxy;
GDBusProxy *profile_proxy;
GDBusConnection *conn;
- GVariant *result = NULL;
- GError*err = NULL;
BT_CHECK_PARAMETER(device_address, return);
adapter_proxy = _bt_get_adapter_proxy();
retv_if(adapter_proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
- conn = _bt_get_system_gconn();
+ conn = _bt_gdbus_get_system_gconn();
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
_bt_convert_addr_type_to_string(address, device_address->addr);
- result = g_dbus_proxy_call_sync(adapter_proxy, "FindDevice",
- g_variant_new("(s)", address),
- G_DBUS_CALL_FLAGS_NONE,
- -1, NULL, &err);
- if (result == NULL) {
- BT_ERR("Error occurred in call to FindDevice");
- if (err) {
- BT_ERR("Error: %s", err->message);
- g_clear_error(&err);
- }
- return BLUETOOTH_ERROR_INTERNAL;
- }
-
- device_path = g_variant_get_string(result, NULL);
+ device_path = _bt_get_device_object_path(address);
if (device_path == NULL) {
BT_ERR("No paired device");
- g_variant_unref(result);
return BLUETOOTH_ERROR_NOT_PAIRED;
}
NULL, BT_BLUEZ_NAME,
device_path, BT_NETWORK_CLIENT_INTERFACE, NULL, NULL);
- g_variant_unref(result);
+ g_free(device_path);
retv_if(profile_proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
func_data = g_malloc0(sizeof(bt_function_data_t));
- retv_if(func_data == NULL, BLUETOOTH_ERROR_MEMORY_ALLOCATION);
-
func_data->address = g_strdup(address);
func_data->req_id = request_id;
int _bt_network_disconnect(int request_id,
bluetooth_device_address_t *device_address)
{
- const gchar *device_path = NULL;
+ gchar *device_path = NULL;
char address[BT_ADDRESS_STRING_SIZE] = { 0 };
bt_function_data_t *func_data;
GDBusProxy *adapter_proxy;
GDBusProxy *profile_proxy;
GDBusConnection *conn;
- GVariant *result = NULL;
- GError*err = NULL;
BT_CHECK_PARAMETER(device_address, return);
adapter_proxy = _bt_get_adapter_proxy();
retv_if(adapter_proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
- conn = _bt_get_system_gconn();
+ conn = _bt_gdbus_get_system_gconn();
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
_bt_convert_addr_type_to_string(address, device_address->addr);
- result = g_dbus_proxy_call_sync(adapter_proxy, "FindDevice",
- g_variant_new("(s)", address),
- G_DBUS_CALL_FLAGS_NONE,
- -1, NULL, &err);
- if (result == NULL) {
- BT_ERR("Error occurred in call to FindDevice");
- if (err) {
- BT_ERR("Error: %s", err->message);
- g_clear_error(&err);
- }
- return BLUETOOTH_ERROR_INTERNAL;
- }
-
- device_path = g_variant_get_string(result, NULL);
+ device_path = _bt_get_device_object_path(address);
if (device_path == NULL) {
BT_ERR("No paired device");
- g_variant_unref(result);
return BLUETOOTH_ERROR_NOT_PAIRED;
}
NULL, BT_BLUEZ_NAME,
device_path, BT_NETWORK_CLIENT_INTERFACE, NULL, NULL);
- g_variant_unref(result);
+ g_free(device_path);
retv_if(profile_proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
func_data = g_malloc0(sizeof(bt_function_data_t));
- retv_if(func_data == NULL, BLUETOOTH_ERROR_MEMORY_ALLOCATION);
-
func_data->address = g_strdup(address);
func_data->req_id = request_id;
BT_CHECK_PARAMETER(device_address, return);
- conn = _bt_get_system_gconn();
+ conn = _bt_gdbus_get_system_gconn();
retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
adapter_path = _bt_get_adapter_path();