#include "bt-service-network.h"
#include "bt-service-adapter.h"
#include "bt-service-gap-agent.h"
+#include "bt-service-pbap.h"
#define BT_SYSPOPUP_IPC_RESPONSE_OBJECT "/org/projectx/bt_syspopup_res"
#define BT_SYSPOPUP_INTERFACE "User.Bluetooth.syspopup"
ret_if(info == NULL);
info->uuid_count = g_variant_get_size(value);
- info->uuids = g_variant_dup_strv(value, &info->uuid_count);
+ info->uuids = g_variant_dup_strv(value, (gsize *)&info->uuid_count);
}
bt_remote_dev_info_t *_bt_get_remote_device_info(char *address)
}
buffer = g_malloc0(sizeof(char) * size);
- /* Fix : NULL_RETURNS */
- if (buffer == NULL) {
- BT_ERR("Memory allocation error\n");
- fclose(fp);
- return FALSE;
- }
result = fread((char *)buffer, 1, size, fp);
fclose(fp);
if (result != size) {
/* allocate user data so that it can be retrieved in callback */
unbonding_info = g_malloc0(sizeof(bt_funcion_data_t));
- /* Fix : NULL_RETURNS */
- if (unbonding_info == NULL) {
- BT_ERR("Memory not allocated !");
- return BLUETOOTH_ERROR_MEMORY_ALLOCATION;
- }
-
unbonding_info->addr = g_malloc0(BT_ADDRESS_STRING_SIZE);
unbonding_info->req_id = request_id;
g_dbus_error_strip_remote_error(err);
BT_ERR("Error occured in Proxy call [%s]\n", err->message);
- if (g_strrstr("Operation canceled", err->message)) {
+ if (g_strrstr("Operation canceled", err->message))
result = BLUETOOTH_ERROR_CANCEL_BY_USER;
- } else if (g_strrstr("In Progress", err->message)) {
+ else if (g_strrstr("In Progress", err->message))
result = BLUETOOTH_ERROR_IN_PROGRESS;
- } else if (g_strrstr("Host is down", err->message)) {
+ else if (g_strrstr("Host is down", err->message))
result = BLUETOOTH_ERROR_HOST_DOWN;
- } else {
+ else
result = BLUETOOTH_ERROR_CONNECTION_ERROR;
- }
if (result == BLUETOOTH_ERROR_HOST_DOWN ||
result == BLUETOOTH_ERROR_CONNECTION_ERROR) {
retv_if(device_proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
func_data = g_malloc0(sizeof(bt_function_data_t));
- if (func_data == NULL) {
- BT_ERR("Unable to allocate memory for address");
- ret = BLUETOOTH_ERROR_MEMORY_ALLOCATION;
- goto fail;
- }
-
func_data->address = g_strdup(device_address);
if (func_data->address == NULL) {
BT_ERR("Unable to allocate memory for address");
retv_if(device_proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
func_data = g_malloc0(sizeof(bt_function_data_t));
- if (func_data == NULL) {
- BT_ERR("Unable to allocate memory for address");
- ret = BLUETOOTH_ERROR_MEMORY_ALLOCATION;
- goto fail;
- }
-
func_data->address = g_strdup(device_address);
if (func_data->address == NULL) {
BT_ERR("Unable to allocate memory for address");
return BLUETOOTH_ERROR_NONE;
}
+int _bt_disconnect_all(char *address)
+{
+ int ret = BLUETOOTH_ERROR_NONE;
+ char *object_path;
+ GDBusProxy *proxy;
+ GDBusConnection *conn;
+ GVariant *result = NULL;
+ GError *err = NULL;
+
+ BT_DBG("");
+ conn = _bt_gdbus_get_system_gconn();
+ retv_if(conn == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+ object_path = _bt_get_device_object_path(address);
+ retv_if(object_path == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+ proxy = g_dbus_proxy_new_sync(conn, G_DBUS_PROXY_FLAGS_NONE,
+ NULL, BT_BLUEZ_NAME,
+ object_path, BT_DEVICE_INTERFACE, NULL, NULL);
+ g_free(object_path);
+ retv_if(proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+ result = g_dbus_proxy_call_sync(proxy, "Disconnect",
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1, NULL,
+ &err);
+
+ if (err != NULL) {
+ BT_ERR("Dbus Call Error:[%s]", err->message);
+ g_error_free(err);
+ ret = BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ g_object_unref(proxy);
+ if (result)
+ g_variant_unref(result);
+
+ return ret;
+}
+
int _bt_disconnect_profile(char *address, char *uuid,
void *cb, gpointer func_data)
{
bluetooth_trusted_profile_t _bt_get_trusted_profile_enum(const char *uuid)
{
- if (g_strcmp0("0000112f-0000-1000-8000-00805f9b34fb", uuid) == 0) {
+ if (g_strcmp0("0000112f-0000-1000-8000-00805f9b34fb", uuid) == 0)
return TRUSTED_PROFILE_PBAP;
- } else if (g_strcmp0("00001132-0000-1000-8000-00805f9b34fb", uuid) == 0) {
+ else if (g_strcmp0("00001132-0000-1000-8000-00805f9b34fb", uuid) == 0)
return TRUSTED_PROFILE_MAP;
- } else if (g_strcmp0("0000112D-0000-1000-8000-00805f9b34fb", uuid) == 0) {
+ else if (g_strcmp0("0000112D-0000-1000-8000-00805f9b34fb", uuid) == 0)
return TRUSTED_PROFILE_SAP;
- }
+
return 0; /* 0 - Unknown Profile */
}
BT_DBG("ID Address:%s", idaddress);
- if (idaddress) {
+ if (idaddress)
_bt_convert_addr_string_to_type(id_address->addr, idaddress);
- } else {
+ else
ret = BLUETOOTH_ERROR_INTERNAL;
- }
g_object_unref(device_proxy);