~bluetooth/bluez/vivid-phone-overlay

« back to all changes in this revision

Viewing changes to health/hdp_main.c

  • Committer: Simon Fels
  • Date: 2015-09-11 09:01:46 UTC
  • Revision ID: morphis@gravedo.de-20150911090146-4c0ln9s7ec3xf0nx
Import package bluez_4.101-0ubuntu25.1~overlay4 from stable phone overlay PPA

Show diffs side-by-side

added added

removed removed

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