1/*
2 *
3 *  BlueZ - Bluetooth protocol stack for Linux
4 *
5 *  Copyright (C) 2010 GSyC/LibreSoft, Universidad Rey Juan Carlos.
6 *  Authors:
7 *  Santiago Carot Nemesio <sancane at gmail.com>
8 *  Jose Antonio Santos-Cadenas <santoscadenas at gmail.com>
9 *
10 *  This program is free software; you can redistribute it and/or modify
11 *  it under the terms of the GNU General Public License as published by
12 *  the Free Software Foundation; either version 2 of the License, or
13 *  (at your option) any later version.
14 *
15 *  This program is distributed in the hope that it will be useful,
16 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 *  GNU General Public License for more details.
19 *
20 *  You should have received a copy of the GNU General Public License
21 *  along with this program; if not, write to the Free Software
22 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
23 *
24 */
25
26#ifdef HAVE_CONFIG_H
27#include <config.h>
28#endif
29
30#include <errno.h>
31
32#include <gdbus.h>
33
34#include "plugin.h"
35#include "hdp_manager.h"
36
37static DBusConnection *connection = NULL;
38
39static int hdp_init(void)
40{
41	connection = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
42	if (connection == NULL)
43		return -EIO;
44
45	if (hdp_manager_init(connection) < 0) {
46		dbus_connection_unref(connection);
47		return -EIO;
48	}
49
50	return 0;
51}
52
53static void hdp_exit(void)
54{
55	hdp_manager_exit();
56
57	dbus_connection_unref(connection);
58	connection = NULL;
59}
60
61BLUETOOTH_PLUGIN_DEFINE(health, VERSION,
62			BLUETOOTH_PLUGIN_PRIORITY_DEFAULT, hdp_init, hdp_exit)
63