/*
- * Bluetooth-frwk
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Hocheol Seo <hocheol.seo@samsung.com>
- * Girishashok Joshi <girish.joshi@samsung.com>
- * Chanyeol Park <chanyeol.park@samsung.com>
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
handle = __bt_get_net_profile(connection,
CONNECTION_ITERATOR_TYPE_CONNECTED,
address);
- if(handle)
+ if (handle)
*is_connected = TRUE;
else
*is_connected = FALSE;
bt_function_data_t *func_data;
request_info_t *req_info;
- g_dbus_proxy_call_finish(proxy, res, &g_error);
+ reply = g_dbus_proxy_call_finish(proxy, res, &g_error);
g_object_unref(proxy);
if (reply == NULL) {
{
int ret = BLUETOOTH_ERROR_NONE;
char *adapter_path;
+ GVariant *result = NULL;
GError *err = 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();
return BLUETOOTH_ERROR_INTERNAL;
}
- g_dbus_proxy_call_sync(server_proxy, "Register",
+ result = g_dbus_proxy_call_sync(server_proxy, "Register",
g_variant_new("(ss)", NAP_UUID_NAME, NET_BRIDGE_INTERFACE),
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
&err);
- if (err != NULL) {
- BT_ERR("Network server register Error: %s\n", err->message);
- if (g_strcmp0(err->message, "Already Exists") == 0) {
- ret = BLUETOOTH_ERROR_ALREADY_INITIALIZED;
- } else {
- ret = BLUETOOTH_ERROR_INTERNAL;
+ if (result == NULL) {
+ 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)
+ ret = BLUETOOTH_ERROR_ALREADY_INITIALIZED;
+ else
+ ret = BLUETOOTH_ERROR_INTERNAL;
+
+ g_error_free(err);
}
- g_error_free(err);
+ } else {
+ g_variant_unref(result);
}
+
g_object_unref(server_proxy);
return ret;
int _bt_network_deactivate(void)
{
char *adapter_path;
+ GVariant *result = NULL;
GError *err = NULL;
GDBusConnection *conn;
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();
return BLUETOOTH_ERROR_INTERNAL;
}
- g_dbus_proxy_call_sync(server_proxy, "Unregister",
+ result = g_dbus_proxy_call_sync(server_proxy, "Unregister",
g_variant_new("(s)", NAP_UUID_NAME),
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
&err);
- if (err != NULL) {
- BT_ERR("Network server unregister Error: %s\n", err->message);
- if (g_strcmp0(err->message,
- "Operation currently not available") == 0) {
- ret = BLUETOOTH_ERROR_ALREADY_DEACTIVATED;
- } else {
- ret = BLUETOOTH_ERROR_INTERNAL;
+ if (result == NULL) {
+ if (err != NULL) {
+ g_dbus_error_strip_remote_error(err);
+ BT_ERR("Network server unregister Error: %s\n", err->message);
+ if (g_strcmp0(err->message,
+ "Operation currently not available") == 0) {
+ ret = BLUETOOTH_ERROR_ALREADY_DEACTIVATED;
+ } else {
+ ret = BLUETOOTH_ERROR_INTERNAL;
+ }
+ g_error_free(err);
}
- g_error_free(err);
+ } else {
+ g_variant_unref(result);
}
+
g_object_unref(server_proxy);
return ret;
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);
g_variant_unref(result);
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;
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);
device_path = g_variant_get_string(result, NULL);
if (device_path == NULL) {
BT_ERR("No paired device");
+ g_variant_unref(result);
return BLUETOOTH_ERROR_NOT_PAIRED;
}
g_variant_unref(result);
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();
(GAsyncReadyCallback)__bt_network_disconnect_cb,
func_data);
- g_free(func_data->address);
- g_free(func_data);
-
return BLUETOOTH_ERROR_NONE;
}