summaryrefslogtreecommitdiffstats
path: root/plugins/bluetooth.h
blob: 505d90812dde5d0c686fd309858b2406d4ec51db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 *
 *  oFono - Open Source Telephony
 *
 *  Copyright (C) 2010 Gustavo F. Padovan <gustavo@padovan.org>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License version 2 as
 *  published by the Free Software Foundation.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

#define	BLUEZ_SERVICE "org.bluez"
#define	BLUEZ_MANAGER_INTERFACE		BLUEZ_SERVICE ".Manager"
#define	BLUEZ_ADAPTER_INTERFACE		BLUEZ_SERVICE ".Adapter"
#define	BLUEZ_DEVICE_INTERFACE		BLUEZ_SERVICE ".Device"
#define	BLUEZ_SERVICE_INTERFACE		BLUEZ_SERVICE ".Service"

#define DBUS_TIMEOUT 15

#define HFP_AG_UUID	"0000111F-0000-1000-8000-00805F9B34FB"

/* Profiles bitfield */
#define HFP_AG 0x01

struct bluetooth_profile {
	const char *name;
	int (*create)(const char *device, const char *dev_addr,
			const char *adapter_addr, const char *alias);
	void (*remove_all)(void);
	void (*set_alias)(const char *device, const char *);
};

struct server;

typedef void (*ConnectFunc)(GIOChannel *io, GError *err, gpointer user_data);

int bluetooth_register_uuid(const char *uuid,
				struct bluetooth_profile *profile);
void bluetooth_unregister_uuid(const char *uuid);

struct server *bluetooth_register_server(guint8 channel, const char *sdp_record,
					ConnectFunc cb, gpointer user_data);
void bluetooth_unregister_server(struct server *server);

void bluetooth_create_path(const char *dev_addr, const char *adapter_addr,
							char *buf, int size);

int bluetooth_send_with_reply(const char *path, const char *interface,
				const char *method,
				DBusPendingCallNotifyFunction cb,
				void *user_data, DBusFreeFunction free_func,
				int timeout, int type, ...);
void bluetooth_parse_properties(DBusMessage *reply, const char *property, ...);