GDBusConnection *conn;
GDBusProxy *adapter_proxy;
GError *error = NULL;
+ GVariant *result;
conn = _bt_hal_get_system_gconn();
if (conn == NULL)
if (adapter_proxy == NULL)
return BT_HAL_ERROR_INTERNAL;
- g_dbus_proxy_call_sync(adapter_proxy, "CreateDevice",
+ result = g_dbus_proxy_call_sync(adapter_proxy, "CreateDevice",
g_variant_new("(s)", address),
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
&error);
-
- if (error != NULL) {
- ERR("CreateDevice Fail: %s", error->message);
- g_error_free(error);
+ if (!result) {
+ if (error) {
+ ERR("CreateDevice Fail: %s", error->message);
+ g_error_free(error);
+ }
+ } else {
+ g_variant_unref(result);
}
object_path = _bt_hal_get_device_object_path(address);
GDBusProxy *adapter_proxy;
GError *err = NULL;
GDBusConnection *conn;
+ GVariant *ret = NULL;
conn = _bt_hal_get_system_gconn();
if (conn == NULL)
object_path = _bt_hal_get_device_object_path(address);
if (object_path == NULL) {
- GVariant *ret = NULL;
INFO("No searched device");
adapter_proxy = _bt_hal_get_adapter_proxy();
if (adapter_proxy == NULL) {
G_DBUS_CALL_FLAGS_NONE,
BT_HAL_MAX_DBUS_TIMEOUT, NULL,
&err);
- if (err != NULL) {
- ERR("CreateDevice Failed: %s", err->message);
- g_clear_error(&err);
- }
-
- if (ret)
+ if (!ret) {
+ if (err) {
+ ERR("CreateDevice Failed: %s", err->message);
+ g_clear_error(&err);
+ }
+ } else {
g_variant_unref(ret);
+ }
g_object_unref(adapter_proxy);
BT_HAL_BLUEZ_NAME, object_path,
BT_HAL_DEVICE_INTERFACE, NULL, NULL);
g_free(object_path);
- g_dbus_proxy_call_sync(proxy, "CancelDiscovery",
+ ret = g_dbus_proxy_call_sync(proxy, "CancelDiscovery",
NULL,
G_DBUS_CALL_FLAGS_NONE,
BT_HAL_MAX_DBUS_TIMEOUT, NULL,
&err);
- if (err) {
- ERR("DBus Error message: [%s]", err->message);
- g_clear_error(&err);
- return BT_STATUS_FAIL;
+ if (!ret) {
+ if (err) {
+ ERR("DBus Error message: [%s]", err->message);
+ g_clear_error(&err);
+ return BT_STATUS_FAIL;
+ }
+ } else {
+ g_variant_unref(ret);
}
if (proxy)
DBG("##Discovering = [%d]", is_discovering);
if (is_discovering == FALSE) {
+ GVariant *result;
/* In Tizen Bluez, this actually does not mean Discovery is stopped
in Bluez. Tizen Bluez sends this event after a certain timeout,
Therefore, we must forecefully call StopDiscovery to stop discovery in BlueZ */
/* Need to stop searching */
DBG("Event though Bluez reported DIscovering stopped, we force stop Discovery ");
- g_dbus_proxy_call_sync(adapter_proxy, "StopDiscovery",
+ result = g_dbus_proxy_call_sync(adapter_proxy, "StopDiscovery",
NULL,
G_DBUS_CALL_FLAGS_NONE,
DBUS_TIMEOUT, NULL,
&err);
- if (err) {
- struct hal_ev_discovery_state_changed ev;
-
- ERR("Dbus Error : %s", err->message);
-
- if (g_strrstr(err->message, "No discovery started"))
+ if (!result) {
+ if (err) {
+ struct hal_ev_discovery_state_changed ev;
+
+ ERR("Dbus Error : %s", err->message);
+
+ if (g_strrstr(err->message, "No discovery started"))
+ continue;
+
+ /* This error is thrown by Bluez, as Discovery is already stopped.
+ Discovery is stopped if user cancels on going discovery.
+ In order to maintain correct state of Bluetooth Discovery state,
+ simply send Discovery stopped event to HAL user */
+ ev.state = HAL_DISCOVERY_STATE_STOPPED;
+ event_cb(HAL_EV_DISCOVERY_STATE_CHANGED, &ev, sizeof(ev));
+ g_clear_error(&err);
continue;
-
- /* This error is thrown by Bluez, as Discovery is already stopped.
- Discovery is stopped if user cancels on going discovery.
- In order to maintain correct state of Bluetooth Discovery state,
- simply send Discovery stopped event to HAL user */
- ev.state = HAL_DISCOVERY_STATE_STOPPED;
- event_cb(HAL_EV_DISCOVERY_STATE_CHANGED, &ev, sizeof(ev));
- g_clear_error(&err);
- continue;
-
+ }
} else {
+ g_variant_unref(result);
event_id = g_timeout_add(BT_HAL_DISCOVERY_FINISHED_DELAY,
(GSourceFunc)__bt_hal_discovery_finished_cb, NULL);
}
-
} else {
struct hal_ev_discovery_state_changed ev;
ev.state = HAL_DISCOVERY_STATE_STARTED;
/* Send channel_connect callback with status: connected */
__hdp_send_conn_event(conn_info, BTHL_CONN_STATE_CONNECTED);
return;
+ } else {
+ g_variant_unref(reply);
}
DBG("-");
{
GError *error = NULL;
rfcomm_cb_data_t *cb_data;
+ GVariant *result;
DBG("+");
return;
}
- if (!g_dbus_proxy_call_finish(proxy, res, &error)) {
+ result = g_dbus_proxy_call_finish(proxy, res, &error);
+ if (!result) {
ERR("Error : %s \n", error->message);
__rfcomm_cb_data_remove(cb_data);
g_error_free(error);
+ } else {
+ g_variant_unref(result);
}
if (proxy)
GDBusProxy *adapter_proxy;
GDBusConnection *conn;
int ret = BLUETOOTH_ERROR_NONE;
+ GVariant *result;
BT_CHECK_PARAMETER(bd_addr, return);
g_free(device_path);
retv_if(device_proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
- g_dbus_proxy_call_sync(device_proxy, "ConnectIpsp",
+ result = g_dbus_proxy_call_sync(device_proxy, "ConnectIpsp",
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
&error);
- if (error) {
- BT_ERR("ConnectIpsp Call Error %s[%s]", error->message, device_address);
- g_error_free(error);
- g_object_unref(device_proxy);
- return BLUETOOTH_ERROR_INTERNAL;
+ if (!result) {
+ if (error) {
+ BT_ERR("ConnectIpsp Call Error %s[%s]", error->message, device_address);
+ g_error_free(error);
+ g_object_unref(device_proxy);
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+ } else {
+ g_variant_unref(result);
}
g_object_unref(device_proxy);
GDBusProxy *adapter_proxy;
GDBusConnection *conn;
int ret = BLUETOOTH_ERROR_NONE;
+ GVariant *result;
BT_CHECK_PARAMETER(bd_addr, return);
g_free(device_path);
retv_if(device_proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
- g_dbus_proxy_call_sync(device_proxy, "DisconnectIpsp",
+ result = g_dbus_proxy_call_sync(device_proxy, "DisconnectIpsp",
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
&error);
- if (error) {
- BT_ERR("DisconnectIpsp Call Error %s[%s]", error->message, device_address);
- g_error_free(error);
- g_object_unref(device_proxy);
- return BLUETOOTH_ERROR_INTERNAL;
+ if (!result) {
+ if (error) {
+ BT_ERR("DisconnectIpsp Call Error %s[%s]", error->message, device_address);
+ g_error_free(error);
+ g_object_unref(device_proxy);
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+ } else {
+ g_variant_unref(result);
}
g_object_unref(device_proxy);
GDBusConnection *g_conn;
GDBusProxy *session_proxy;
GError *err = NULL;
+ GVariant *result;
retv_if(session_id == NULL, BLUETOOTH_ERROR_INVALID_PARAM);
GVariant *param = g_variant_new("(o)", session_id);
- g_dbus_proxy_call_sync(session_proxy, "RemoveSession", param,
+ result = g_dbus_proxy_call_sync(session_proxy, "RemoveSession", param,
G_DBUS_CALL_FLAGS_NONE, -1, NULL, &err);
- if (err != NULL) {
- BT_ERR("Could not remove session: %s\n", err->message);
- g_error_free(err);
- return BLUETOOTH_ERROR_INTERNAL;
+ if (!result) {
+ if (err) {
+ BT_ERR("Could not remove session: %s\n", err->message);
+ g_error_free(err);
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
} else {
+ g_variant_unref(result);
BT_DBG("remove session succeed\n");
}
gchar *device_path = NULL;
GDBusConnection *conn;
GDBusProxy *device_proxy;
+ GVariant *result;
_bt_convert_addr_type_to_string(address, device_address->addr);
g_free(device_path);
retv_if(device_proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
- g_dbus_proxy_call_sync(device_proxy,
+ result = g_dbus_proxy_call_sync(device_proxy,
"LESetDataLength",
g_variant_new("(qq)", txOctets, txTime),
G_DBUS_CALL_FLAGS_NONE,
return BLUETOOTH_ERROR_INTERNAL;
}
+ if (result)
+ g_variant_unref(result);
+
return BLUETOOTH_ERROR_NONE;
}
/* First Cancel the ongoing pairing in bluez otherwise if we send
* pair request bluez will send inprogress and we again retry bond so
* this cycle continues */
- GError *err = NULL;
- g_dbus_proxy_call_sync(bonding_info->device_proxy, "CancelPairing",
+ GError *err = NULL;
+ GVariant *result;
+ result = g_dbus_proxy_call_sync(bonding_info->device_proxy, "CancelPairing",
NULL, G_DBUS_CALL_FLAGS_NONE,
10000, NULL, &err);
- if (err) {
- BT_ERR("Cancelling bonding request error msg (%s)", err->message);
- g_clear_error(&err);
- return BLUETOOTH_ERROR_PARING_FAILED;
+ if (!result) {
+ if (err) {
+ BT_ERR("Cancelling bonding request error msg (%s)", err->message);
+ g_clear_error(&err);
+ return BLUETOOTH_ERROR_PARING_FAILED;
+ }
+ } else {
+ g_variant_unref(result);
}
return BLUETOOTH_ERROR_NONE;
}
GDBusProxy *adapter_proxy;
GDBusConnection *conn;
int ret = BLUETOOTH_ERROR_NONE;
+ GVariant *result;
BT_CHECK_PARAMETER(bd_addr, return);
g_free(device_path);
retv_if(device_proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
- g_dbus_proxy_call_sync(device_proxy, "ConnectIpsp",
+ result = g_dbus_proxy_call_sync(device_proxy, "ConnectIpsp",
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
&error);
- if (error) {
- BT_ERR("ConnectIpsp Call Error %s[%s]", error->message, device_address);
- g_error_free(error);
- g_object_unref(device_proxy);
- return BLUETOOTH_ERROR_INTERNAL;
+ if (!result) {
+ if (error) {
+ BT_ERR("ConnectIpsp Call Error %s[%s]", error->message, device_address);
+ g_error_free(error);
+ g_object_unref(device_proxy);
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+ } else {
+ g_variant_unref(result);
}
g_object_unref(device_proxy);
GDBusProxy *adapter_proxy;
GDBusConnection *conn;
int ret = BLUETOOTH_ERROR_NONE;
+ GVariant *result;
BT_CHECK_PARAMETER(bd_addr, return);
g_free(device_path);
retv_if(device_proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
- g_dbus_proxy_call_sync(device_proxy, "DisconnectIpsp",
+ result = g_dbus_proxy_call_sync(device_proxy, "DisconnectIpsp",
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
&error);
- if (error) {
- BT_ERR("DisconnectIpsp Call Error %s[%s]", error->message, device_address);
- g_error_free(error);
- g_object_unref(device_proxy);
- return BLUETOOTH_ERROR_INTERNAL;
+ if (!result) {
+ if (error) {
+ BT_ERR("DisconnectIpsp Call Error %s[%s]", error->message, device_address);
+ g_error_free(error);
+ g_object_unref(device_proxy);
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+ } else {
+ g_variant_unref(result);
}
g_object_unref(device_proxy);
}
g_object_unref(proxy);
return BLUETOOTH_ERROR_INTERNAL;
+ } else {
+ g_variant_unref(result);
}
g_object_unref(proxy);
}
g_object_unref(proxy);
return BLUETOOTH_ERROR_INTERNAL;
+ } else {
+ g_variant_unref(result);
}
g_object_unref(proxy);