]> code.delx.au - pulseaudio/blob - src/modules/bluetooth/bluetooth-util.h
dbusiface-stream: Implement about a half of the Stream D-Bus interface.
[pulseaudio] / src / modules / bluetooth / bluetooth-util.h
1 #ifndef foobluetoothutilhfoo
2 #define foobluetoothutilhfoo
3
4 /***
5 This file is part of PulseAudio.
6
7 Copyright 2008 Joao Paulo Rechi Vita
8
9 PulseAudio is free software; you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as
11 published by the Free Software Foundation; either version 2.1 of the
12 License, or (at your option) any later version.
13
14 PulseAudio is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public
20 License along with PulseAudio; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 USA.
23 ***/
24
25 #include <dbus/dbus.h>
26
27 #include <pulsecore/llist.h>
28 #include <pulsecore/macro.h>
29 #include <pulsecore/core-util.h>
30
31 /* UUID copied from bluez/audio/device.h */
32 #define GENERIC_AUDIO_UUID "00001203-0000-1000-8000-00805F9B34FB"
33
34 #define HSP_HS_UUID "00001108-0000-1000-8000-00805F9B34FB"
35 #define HSP_AG_UUID "00001112-0000-1000-8000-00805F9B34FB"
36
37 #define HFP_HS_UUID "0000111E-0000-1000-8000-00805F9B34FB"
38 #define HFP_AG_UUID "0000111F-0000-1000-8000-00805F9B34FB"
39
40 #define ADVANCED_AUDIO_UUID "0000110D-0000-1000-8000-00805F9B34FB"
41
42 #define A2DP_SOURCE_UUID "0000110A-0000-1000-8000-00805F9B34FB"
43 #define A2DP_SINK_UUID "0000110B-0000-1000-8000-00805F9B34FB"
44
45 typedef struct pa_bluetooth_uuid pa_bluetooth_uuid;
46 typedef struct pa_bluetooth_device pa_bluetooth_device;
47 typedef struct pa_bluetooth_discovery pa_bluetooth_discovery;
48
49 struct userdata;
50
51 struct pa_bluetooth_uuid {
52 char *uuid;
53 PA_LLIST_FIELDS(pa_bluetooth_uuid);
54 };
55
56 /* This enum is shared among Audio, Headset, and AudioSink, although not all values are acceptable in all profiles */
57 typedef enum pa_bt_audio_state {
58 PA_BT_AUDIO_STATE_INVALID = -1,
59 PA_BT_AUDIO_STATE_DISCONNECTED,
60 PA_BT_AUDIO_STATE_CONNECTING,
61 PA_BT_AUDIO_STATE_CONNECTED,
62 PA_BT_AUDIO_STATE_PLAYING,
63 PA_BT_AUDIO_STATE_LAST
64 } pa_bt_audio_state_t;
65
66 struct pa_bluetooth_device {
67 pa_bool_t dead;
68
69 int device_info_valid; /* 0: no results yet; 1: good results; -1: bad results ... */
70
71 /* Device information */
72 char *name;
73 char *path;
74 int paired;
75 char *alias;
76 int device_connected;
77 PA_LLIST_HEAD(pa_bluetooth_uuid, uuids);
78 char *address;
79 int class;
80 int trusted;
81
82 /* Audio state */
83 pa_bt_audio_state_t audio_state;
84
85 /* AudioSink state */
86 pa_bt_audio_state_t audio_sink_state;
87
88 /* Headset state */
89 pa_bt_audio_state_t headset_state;
90 };
91
92 pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *core);
93 pa_bluetooth_discovery* pa_bluetooth_discovery_ref(pa_bluetooth_discovery *y);
94 void pa_bluetooth_discovery_unref(pa_bluetooth_discovery *d);
95
96 void pa_bluetooth_discovery_sync(pa_bluetooth_discovery *d);
97
98 const pa_bluetooth_device* pa_bluetooth_discovery_get_by_path(pa_bluetooth_discovery *d, const char* path);
99 const pa_bluetooth_device* pa_bluetooth_discovery_get_by_address(pa_bluetooth_discovery *d, const char* address);
100
101 pa_hook* pa_bluetooth_discovery_hook(pa_bluetooth_discovery *d);
102
103 const char* pa_bluetooth_get_form_factor(uint32_t class);
104
105 char *pa_bluetooth_cleanup_name(const char *name);
106
107 pa_bool_t pa_bluetooth_uuid_has(pa_bluetooth_uuid *uuids, const char *uuid);
108
109 #endif