diff --git a/profiles/health/hdp.c b/profiles/health/hdp.c
index 489e1eb..d262a2a 100644
--- a/profiles/health/hdp.c
+++ b/profiles/health/hdp.c
#define ECHO_TIMEOUT 1 /* second */
#define HDP_ECHO_LEN 15
-static DBusConnection *connection = NULL;
-
static GSList *applications = NULL;
static GSList *devices = NULL;
static uint8_t next_app_id = HDP_MDEP_INITIAL;
static GSList *adapters;
static gboolean update_adapter(struct hdp_adapter *adapter);
-static struct hdp_device *create_health_device(DBusConnection *conn,
- struct btd_device *device);
+static struct hdp_device *create_health_device(struct btd_device *device);
static void free_echo_data(struct hdp_echo_data *edata);
struct hdp_create_dc {
- DBusConnection *conn;
DBusMessage *msg;
struct hdp_application *app;
struct hdp_device *dev;
};
struct hdp_tmp_dc_data {
- DBusConnection *conn;
DBusMessage *msg;
struct hdp_channel *hdp_chann;
guint ref;
static void free_hdp_create_dc(struct hdp_create_dc *dc_data)
{
dbus_message_unref(dc_data->msg);
- dbus_connection_unref(dc_data->conn);
hdp_application_unref(dc_data->app);
health_device_unref(dc_data->dev);
static void free_hdp_conn_dc(struct hdp_tmp_dc_data *data)
{
dbus_message_unref(data->msg);
- dbus_connection_unref(data->conn);
hdp_channel_unref(data->hdp_chann);
g_free(data);
static void free_health_device(struct hdp_device *device)
{
- if (device->conn != NULL) {
- dbus_connection_unref(device->conn);
- device->conn = NULL;
- }
-
if (device->dev != NULL) {
btd_device_unref(device->dev);
device->dev = NULL;
}
app->oname = g_strdup(name);
- app->conn = dbus_connection_ref(conn);
applications = g_slist_prepend(applications, app);
- app->dbus_watcher = g_dbus_add_disconnect_watch(conn, name,
- client_disconnected, app, NULL);
+ app->dbus_watcher =
+ g_dbus_add_disconnect_watch(btd_get_dbus_connection(),
+ name, client_disconnected, app, NULL);
g_slist_foreach(adapters, (GFunc) update_adapter, NULL);
DBG("Health application created with id %s", app->path);
static void hdp_mdl_reconn_cb(struct mcap_mdl *mdl, GError *err, gpointer data)
{
+ DBusConnection *conn = btd_get_dbus_connection();
struct hdp_tmp_dc_data *dc_data = data;
DBusMessage *reply;
int fd;
reply = g_dbus_create_error(dc_data->msg,
ERROR_INTERFACE ".HealthError",
"Cannot reconnect: %s", err->message);
- g_dbus_send_message(dc_data->conn, reply);
+ g_dbus_send_message(conn, reply);
/* Send abort request because remote side */
/* is now in PENDING state */
reply = g_dbus_create_error(dc_data->msg,
ERROR_INTERFACE ".HealthError",
"Cannot get file descriptor");
- g_dbus_send_message(dc_data->conn, reply);
+ g_dbus_send_message(conn, reply);
return;
}
reply = g_dbus_create_reply(dc_data->msg, DBUS_TYPE_UNIX_FD,
&fd, DBUS_TYPE_INVALID);
- g_dbus_send_message(dc_data->conn, reply);
+ g_dbus_send_message(conn, reply);
- g_dbus_emit_signal(dc_data->conn,
- device_get_path(dc_data->hdp_chann->dev->dev),
+ g_dbus_emit_signal(conn, device_get_path(dc_data->hdp_chann->dev->dev),
HEALTH_DEVICE, "ChannelConnected",
DBUS_TYPE_OBJECT_PATH, &dc_data->hdp_chann->path,
DBUS_TYPE_INVALID);
static void device_reconnect_mdl_cb(struct mcap_mdl *mdl, GError *err,
gpointer data)
{
+ DBusConnection *conn = btd_get_dbus_connection();
struct hdp_tmp_dc_data *dc_data = data;
GError *gerr = NULL;
DBusMessage *reply;
reply = g_dbus_create_error(dc_data->msg,
ERROR_INTERFACE ".HealthError",
"Cannot reconnect: %s", err->message);
- g_dbus_send_message(dc_data->conn, reply);
+ g_dbus_send_message(conn, reply);
return;
}
reply = g_dbus_create_error(dc_data->msg,
ERROR_INTERFACE ".HealthError",
"Cannot reconnect: %s", gerr->message);
- g_dbus_send_message(dc_data->conn, reply);
+ g_dbus_send_message(conn, reply);
hdp_tmp_dc_data_unref(dc_data);
g_error_free(gerr);
static void channel_acquire_cb(gpointer data, GError *err)
{
- struct hdp_tmp_dc_data *dc_data = data;
DBusMessage *reply;
reply = channel_acquire_continue(data, err);
if (reply != NULL)
- g_dbus_send_message(dc_data->conn, reply);
+ g_dbus_send_message(btd_get_dbus_connection(), reply);
}
static DBusMessage *channel_acquire(DBusConnection *conn,
DBusMessage *reply;
dc_data = g_new0(struct hdp_tmp_dc_data, 1);
- dc_data->conn = dbus_connection_ref(conn);
dc_data->msg = dbus_message_ref(msg);
dc_data->hdp_chann = hdp_channel_ref(chan);
dev->channels = g_slist_remove(dev->channels, hdp_chan);
if (hdp_chan->mdep != HDP_MDEP_ECHO)
- g_dbus_emit_signal(dev->conn, device_get_path(dev->dev),
+ g_dbus_emit_signal(btd_get_dbus_connection(),
+ device_get_path(dev->dev),
HEALTH_DEVICE, "ChannelDeleted",
DBUS_TYPE_OBJECT_PATH, &hdp_chan->path,
DBUS_TYPE_INVALID);
if (hdp_chann->mdep == HDP_MDEP_ECHO)
return hdp_channel_ref(hdp_chann);
- if (!g_dbus_register_interface(dev->conn, hdp_chann->path,
- HEALTH_CHANNEL,
+ if (!g_dbus_register_interface(btd_get_dbus_connection(),
+ hdp_chann->path, HEALTH_CHANNEL,
health_channels_methods, NULL, NULL,
hdp_chann, health_channel_destroy)) {
g_set_error(err, HDP_ERROR, HDP_UNSPECIFIED_ERROR,
chan = dev->channels->data;
path = g_strdup(chan->path);
- if (!g_dbus_unregister_interface(dev->conn, path,
- HEALTH_CHANNEL))
+ if (!g_dbus_unregister_interface(btd_get_dbus_connection(),
+ path, HEALTH_CHANNEL))
health_channel_destroy(chan);
g_free(path);
}
const char *path;
path = device_get_path(dev->dev);
- g_dbus_unregister_interface(dev->conn, path, HEALTH_DEVICE);
+ g_dbus_unregister_interface(btd_get_dbus_connection(),
+ path, HEALTH_DEVICE);
}
}
goto end;
}
- g_dbus_emit_signal(dev->conn, device_get_path(dev->dev), HEALTH_DEVICE,
- "ChannelConnected",
- DBUS_TYPE_OBJECT_PATH, &chan->path,
- DBUS_TYPE_INVALID);
+ g_dbus_emit_signal(btd_get_dbus_connection(), device_get_path(dev->dev),
+ HEALTH_DEVICE, "ChannelConnected",
+ DBUS_TYPE_OBJECT_PATH, &chan->path,
+ DBUS_TYPE_INVALID);
if (dev->fr != NULL)
goto end;
chan = l->data;
path = g_strdup(chan->path);
- if (!g_dbus_unregister_interface(dev->conn, path, HEALTH_CHANNEL))
+ if (!g_dbus_unregister_interface(btd_get_dbus_connection(),
+ path, HEALTH_CHANNEL))
health_channel_destroy(chan);
g_free(path);
}
hdp_channel_ref(dev->ndc));
if (dev->ndc->mdep != HDP_MDEP_ECHO)
- g_dbus_emit_signal(dev->conn, device_get_path(dev->dev),
+ g_dbus_emit_signal(btd_get_dbus_connection(),
+ device_get_path(dev->dev),
HEALTH_DEVICE, "ChannelConnected",
DBUS_TYPE_OBJECT_PATH, &dev->ndc->path,
DBUS_TYPE_INVALID);
char *path;
path = g_strdup(chan->path);
- g_dbus_unregister_interface(dev->conn, path, HEALTH_CHANNEL);
+ g_dbus_unregister_interface(btd_get_dbus_connection(),
+ path, HEALTH_CHANNEL);
g_free(path);
}
device = adapter_get_device(hdp_adapter->btd_adapter, str);
if (!device)
return;
- hdp_device = create_health_device(connection, device);
+ hdp_device = create_health_device(device);
if (!hdp_device)
return;
devices = g_slist_append(devices, hdp_device);
/* be removed. Then we have to remove the HealthDevice */
/* interface manually */
path = device_get_path(hdp_device->dev);
- g_dbus_unregister_interface(hdp_device->conn, path, HEALTH_DEVICE);
+ g_dbus_unregister_interface(btd_get_dbus_connection(),
+ path, HEALTH_DEVICE);
DBG("Mcl uncached %s", path);
}
const char *path;
path = device_get_path(dev->dev);
- g_dbus_unregister_interface(dev->conn, path, HEALTH_DEVICE);
+ g_dbus_unregister_interface(btd_get_dbus_connection(),
+ path, HEALTH_DEVICE);
}
g_slist_free(to_delete);
return FALSE;
}
-int hdp_adapter_register(DBusConnection *conn, struct btd_adapter *adapter)
+int hdp_adapter_register(struct btd_adapter *adapter)
{
struct hdp_adapter *hdp_adapter;
end:
reply = g_dbus_create_reply(hdp_conn->msg, DBUS_TYPE_BOOLEAN, &value,
DBUS_TYPE_INVALID);
- g_dbus_send_message(hdp_conn->conn, reply);
+ g_dbus_send_message(btd_get_dbus_connection(), reply);
g_source_remove(edata->tid);
edata->tid = 0;
g_free(edata->buf);
static void hdp_echo_connect_cb(struct mcap_mdl *mdl, GError *err,
gpointer data)
{
+ DBusConnection *conn = btd_get_dbus_connection();
struct hdp_tmp_dc_data *hdp_conn = data;
struct hdp_echo_data *edata;
GError *gerr = NULL;
reply = g_dbus_create_error(hdp_conn->msg,
ERROR_INTERFACE ".HealthError",
"%s", err->message);
- g_dbus_send_message(hdp_conn->conn, reply);
+ g_dbus_send_message(conn, reply);
/* Send abort request because remote */
/* side is now in PENDING state. */
reply = g_dbus_create_error(hdp_conn->msg,
ERROR_INTERFACE ".HealthError",
"Can't write in echo channel");
- g_dbus_send_message(hdp_conn->conn, reply);
+ g_dbus_send_message(conn, reply);
delete_echo_channel(hdp_conn->hdp_chann);
return;
}
/* Connection operation has failed but we have to */
/* notify the channel created at MCAP level */
if (hdp_chann->mdep != HDP_MDEP_ECHO)
- g_dbus_emit_signal(hdp_conn->conn,
+ g_dbus_emit_signal(btd_get_dbus_connection(),
device_get_path(hdp_chann->dev->dev),
- HEALTH_DEVICE,
- "ChannelConnected",
+ HEALTH_DEVICE, "ChannelConnected",
DBUS_TYPE_OBJECT_PATH, &hdp_chann->path,
DBUS_TYPE_INVALID);
}
static void hdp_mdl_conn_cb(struct mcap_mdl *mdl, GError *err, gpointer data)
{
+ DBusConnection *conn = btd_get_dbus_connection();
struct hdp_tmp_dc_data *hdp_conn = data;
struct hdp_channel *hdp_chann = hdp_conn->hdp_chann;
struct hdp_device *dev = hdp_chann->dev;
reply = g_dbus_create_reply(hdp_conn->msg,
DBUS_TYPE_OBJECT_PATH, &hdp_chann->path,
DBUS_TYPE_INVALID);
- g_dbus_send_message(hdp_conn->conn, reply);
+ g_dbus_send_message(conn, reply);
/* Send abort request because remote side */
/* is now in PENDING state */
reply = g_dbus_create_reply(hdp_conn->msg,
DBUS_TYPE_OBJECT_PATH, &hdp_chann->path,
DBUS_TYPE_INVALID);
- g_dbus_send_message(hdp_conn->conn, reply);
+ g_dbus_send_message(conn, reply);
- g_dbus_emit_signal(hdp_conn->conn,
- device_get_path(hdp_chann->dev->dev),
- HEALTH_DEVICE,
- "ChannelConnected",
- DBUS_TYPE_OBJECT_PATH, &hdp_chann->path,
- DBUS_TYPE_INVALID);
+ g_dbus_emit_signal(conn, device_get_path(hdp_chann->dev->dev),
+ HEALTH_DEVICE, "ChannelConnected",
+ DBUS_TYPE_OBJECT_PATH, &hdp_chann->path,
+ DBUS_TYPE_INVALID);
if (!check_channel_conf(hdp_chann)) {
close_mdl(hdp_chann);
static void device_create_mdl_cb(struct mcap_mdl *mdl, uint8_t conf,
GError *err, gpointer data)
{
+ DBusConnection *conn = btd_get_dbus_connection();
struct hdp_create_dc *user_data = data;
struct hdp_tmp_dc_data *hdp_conn;
struct hdp_channel *hdp_chan;
reply = g_dbus_create_error(user_data->msg,
ERROR_INTERFACE ".HealthError",
"%s", err->message);
- g_dbus_send_message(user_data->conn, reply);
+ g_dbus_send_message(conn, reply);
return;
}
hdp_conn = g_new0(struct hdp_tmp_dc_data, 1);
hdp_conn->msg = dbus_message_ref(user_data->msg);
- hdp_conn->conn = dbus_connection_ref(user_data->conn);
hdp_conn->hdp_chann = hdp_chan;
hdp_conn->cb = user_data->cb;
hdp_chan->mdep = user_data->mdep;
reply = g_dbus_create_reply(hdp_conn->msg,
DBUS_TYPE_OBJECT_PATH, &hdp_chan->path,
DBUS_TYPE_INVALID);
- g_dbus_send_message(hdp_conn->conn, reply);
+ g_dbus_send_message(conn, reply);
hdp_tmp_dc_data_unref(hdp_conn);
/* Send abort request because remote side is now in PENDING state */
reply = g_dbus_create_error(user_data->msg,
ERROR_INTERFACE ".HealthError",
"%s", gerr->message);
- g_dbus_send_message(user_data->conn, reply);
+ g_dbus_send_message(conn, reply);
g_error_free(gerr);
/* Send abort request because remote side is now in PENDING */
static void device_create_dc_cb(gpointer user_data, GError *err)
{
+ DBusConnection *conn = btd_get_dbus_connection();
struct hdp_create_dc *data = user_data;
DBusMessage *reply;
GError *gerr = NULL;
reply = g_dbus_create_error(data->msg,
ERROR_INTERFACE ".HealthError",
"%s", err->message);
- g_dbus_send_message(data->conn, reply);
+ g_dbus_send_message(conn, reply);
return;
}
reply = g_dbus_create_error(data->msg, ERROR_INTERFACE ".HealthError",
"%s", gerr->message);
g_error_free(gerr);
- g_dbus_send_message(data->conn, reply);
+ g_dbus_send_message(conn, reply);
}
static DBusMessage *device_echo(DBusConnection *conn,
data->mdep = HDP_MDEP_ECHO;
data->config = HDP_RELIABLE_DC;
data->msg = dbus_message_ref(msg);
- data->conn = dbus_connection_ref(conn);
data->cb = hdp_echo_connect_cb;
hdp_create_data_ref(data);
static void device_get_mdep_cb(uint8_t mdep, gpointer data, GError *err)
{
+ DBusConnection *conn = btd_get_dbus_connection();
struct hdp_create_dc *dc_data, *user_data = data;
DBusMessage *reply;
GError *gerr = NULL;
reply = g_dbus_create_error(user_data->msg,
ERROR_INTERFACE ".HealthError",
"%s", err->message);
- g_dbus_send_message(user_data->conn, reply);
+ g_dbus_send_message(conn, reply);
return;
}
"%s", gerr->message);
hdp_create_data_unref(dc_data);
g_error_free(gerr);
- g_dbus_send_message(user_data->conn, reply);
+ g_dbus_send_message(conn, reply);
}
static DBusMessage *device_create_channel(DBusConnection *conn,
data->config = config;
data->app = hdp_application_ref(app);
data->msg = dbus_message_ref(msg);
- data->conn = dbus_connection_ref(conn);
data->cb = hdp_mdl_conn_cb;
if (hdp_get_mdep(device, l->data, device_get_mdep_cb,
static void hdp_mdl_delete_cb(GError *err, gpointer data)
{
+ DBusConnection *conn = btd_get_dbus_connection();
struct hdp_tmp_dc_data *del_data = data;
DBusMessage *reply;
char *path;
reply = g_dbus_create_error(del_data->msg,
ERROR_INTERFACE ".HealthError",
"%s", err->message);
- g_dbus_send_message(del_data->conn, reply);
+ g_dbus_send_message(conn, reply);
return;
}
path = g_strdup(del_data->hdp_chann->path);
- g_dbus_unregister_interface(del_data->conn, path, HEALTH_CHANNEL);
+ g_dbus_unregister_interface(conn, path, HEALTH_CHANNEL);
g_free(path);
reply = g_dbus_create_reply(del_data->msg, DBUS_TYPE_INVALID);
- g_dbus_send_message(del_data->conn, reply);
+ g_dbus_send_message(conn, reply);
}
static void hdp_continue_del_cb(gpointer user_data, GError *err)
{
+ DBusConnection *conn = btd_get_dbus_connection();
struct hdp_tmp_dc_data *del_data = user_data;
GError *gerr = NULL;
DBusMessage *reply;
reply = g_dbus_create_error(del_data->msg,
ERROR_INTERFACE ".HealthError",
"%s", err->message);
- g_dbus_send_message(del_data->conn, reply);
+ g_dbus_send_message(conn, reply);
return;
}
"%s", gerr->message);
hdp_tmp_dc_data_unref(del_data);
g_error_free(gerr);
- g_dbus_send_message(del_data->conn, reply);
+ g_dbus_send_message(conn, reply);
}
static DBusMessage *device_destroy_channel(DBusConnection *conn,
hdp_chan = l->data;
del_data = g_new0(struct hdp_tmp_dc_data, 1);
del_data->msg = dbus_message_ref(msg);
- del_data->conn = dbus_connection_ref(conn);
del_data->hdp_chann = hdp_channel_ref(hdp_chan);
if (device->mcl_conn) {
{ }
};
-static struct hdp_device *create_health_device(DBusConnection *conn,
- struct btd_device *device)
+static struct hdp_device *create_health_device(struct btd_device *device)
{
struct btd_adapter *adapter = device_get_adapter(device);
const gchar *path = device_get_path(device);
return NULL;
dev = g_new0(struct hdp_device, 1);
- dev->conn = dbus_connection_ref(conn);
dev->dev = btd_device_ref(device);
health_device_ref(dev);
dev->hdp_adapter = l->data;
- if (!g_dbus_register_interface(conn, path,
- HEALTH_DEVICE,
+ if (!g_dbus_register_interface(btd_get_dbus_connection(),
+ path, HEALTH_DEVICE,
health_device_methods,
health_device_signals, NULL,
dev, health_device_destroy)) {
return NULL;
}
-int hdp_device_register(DBusConnection *conn, struct btd_device *device)
+int hdp_device_register(struct btd_device *device)
{
struct hdp_device *hdev;
GSList *l;
return 0;
}
- hdev = create_health_device(conn, device);
+ hdev = create_health_device(device);
if (hdev == NULL)
return -1;
hdp_dev = l->data;
path = device_get_path(hdp_dev->dev);
- g_dbus_unregister_interface(hdp_dev->conn, path, HEALTH_DEVICE);
+ g_dbus_unregister_interface(btd_get_dbus_connection(),
+ path, HEALTH_DEVICE);
}
-int hdp_manager_start(DBusConnection *conn)
+int hdp_manager_start(void)
{
DBG("Starting Health manager");
- if (!g_dbus_register_interface(conn, MANAGER_PATH,
- HEALTH_MANAGER,
+ if (!g_dbus_register_interface(btd_get_dbus_connection(),
+ MANAGER_PATH, HEALTH_MANAGER,
health_manager_methods, NULL, NULL,
NULL, manager_path_unregister)) {
error("D-Bus failed to register %s interface", HEALTH_MANAGER);
return -1;
}
- connection = dbus_connection_ref(conn);
-
return 0;
}
void hdp_manager_stop(void)
{
- g_dbus_unregister_interface(connection, MANAGER_PATH, HEALTH_MANAGER);
+ g_dbus_unregister_interface(btd_get_dbus_connection(),
+ MANAGER_PATH, HEALTH_MANAGER);
- dbus_connection_unref(connection);
DBG("Stopped Health manager");
}
diff --git a/profiles/health/hdp.h b/profiles/health/hdp.h
index 39f0441..6e78b09 100644
--- a/profiles/health/hdp.h
+++ b/profiles/health/hdp.h
*
*/
-int hdp_adapter_register(DBusConnection *conn, struct btd_adapter *btd_adapter);
+int hdp_adapter_register(struct btd_adapter *btd_adapter);
void hdp_adapter_unregister(struct btd_adapter *btd_adapter);
-int hdp_device_register(DBusConnection *conn, struct btd_device *device);
+int hdp_device_register(struct btd_device *device);
void hdp_device_unregister(struct btd_device *device);
-int hdp_manager_start(DBusConnection *conn);
+int hdp_manager_start(void);
void hdp_manager_stop(void);
gboolean hdp_set_mcl_cb(struct hdp_device *device, GError **err);
diff --git a/profiles/health/hdp_main.c b/profiles/health/hdp_main.c
index 9367e73..1d38bea 100644
--- a/profiles/health/hdp_main.c
+++ b/profiles/health/hdp_main.c
#include "plugin.h"
#include "hdp_manager.h"
-static DBusConnection *connection = NULL;
-
static int hdp_init(void)
{
- connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
- if (connection == NULL)
- return -EIO;
-
- if (hdp_manager_init(connection) < 0) {
- dbus_connection_unref(connection);
- return -EIO;
- }
-
- return 0;
+ return hdp_manager_init();
}
static void hdp_exit(void)
{
hdp_manager_exit();
-
- dbus_connection_unref(connection);
- connection = NULL;
}
BLUETOOTH_PLUGIN_DEFINE(health, VERSION,
diff --git a/profiles/health/hdp_manager.c b/profiles/health/hdp_manager.c
index 1f899dc..740fe3a 100644
--- a/profiles/health/hdp_manager.c
+++ b/profiles/health/hdp_manager.c
#include "hdp_manager.h"
#include "hdp.h"
-static DBusConnection *connection = NULL;
-
static int hdp_adapter_probe(struct btd_adapter *adapter)
{
- return hdp_adapter_register(connection, adapter);
+ return hdp_adapter_register(adapter);
}
static void hdp_adapter_remove(struct btd_adapter *adapter)
static int hdp_driver_probe(struct btd_device *device, GSList *uuids)
{
- return hdp_device_register(connection, device);
+ return hdp_device_register(device);
}
static void hdp_driver_remove(struct btd_device *device)
.adapter_remove = hdp_adapter_remove,
};
-int hdp_manager_init(DBusConnection *conn)
+int hdp_manager_init(void)
{
- if (hdp_manager_start(conn) < 0)
+ if (hdp_manager_start() < 0)
return -1;
- connection = dbus_connection_ref(conn);
-
btd_profile_register(&hdp_profile);
return 0;
btd_profile_unregister(&hdp_profile);
hdp_manager_stop();
-
- dbus_connection_unref(connection);
- connection = NULL;
}
diff --git a/profiles/health/hdp_manager.h b/profiles/health/hdp_manager.h
index d39f190..1cab4d0 100644
--- a/profiles/health/hdp_manager.h
+++ b/profiles/health/hdp_manager.h
*
*/
-int hdp_manager_init(DBusConnection *conn);
+int hdp_manager_init(void);
void hdp_manager_exit(void);
diff --git a/profiles/health/hdp_types.h b/profiles/health/hdp_types.h
index 7f8b015..7e4d00f 100644
--- a/profiles/health/hdp_types.h
+++ b/profiles/health/hdp_types.h
};
struct hdp_application {
- DBusConnection *conn; /* For dbus watcher */
char *path; /* The path of the application */
uint16_t data_type; /* Data type handled for this application */
gboolean data_type_set; /* Flag for dictionary parsing */
};
struct hdp_device {
- DBusConnection *conn; /* For name listener handling */
struct btd_device *dev; /* Device reference */
struct hdp_adapter *hdp_adapter; /* hdp_adapater */
struct mcap_mcl *mcl; /* The mcap control channel */
diff --git a/profiles/health/hdp_util.c b/profiles/health/hdp_util.c
index 761e07d..3afd715 100644
--- a/profiles/health/hdp_util.c
+++ b/profiles/health/hdp_util.c
#include <log.h>
+#include "dbus-common.h"
#include "mcap.h"
#include "mcap_lib.h"
#include "hdp_types.h"
static void hdp_free_application(struct hdp_application *app)
{
if (app->dbus_watcher > 0)
- g_dbus_remove_watch(app->conn, app->dbus_watcher);
+ g_dbus_remove_watch(btd_get_dbus_connection(),
+ app->dbus_watcher);
- if (app->conn != NULL)
- dbus_connection_unref(app->conn);
g_free(app->oname);
g_free(app->description);
g_free(app->path);