1 #ifndef foobluez5utilhfoo
2 #define foobluez5utilhfoo
5 This file is part of PulseAudio.
7 Copyright 2008-2013 João Paulo Rechi Vita
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.
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.
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
25 #include <pulsecore/core.h>
27 #define PA_BLUETOOTH_UUID_A2DP_SOURCE "0000110a-0000-1000-8000-00805f9b34fb"
28 #define PA_BLUETOOTH_UUID_A2DP_SINK "0000110b-0000-1000-8000-00805f9b34fb"
29 #define PA_BLUETOOTH_UUID_HSP_HS "00001108-0000-1000-8000-00805f9b34fb"
30 #define PA_BLUETOOTH_UUID_HSP_AG "00001112-0000-1000-8000-00805f9b34fb"
31 #define PA_BLUETOOTH_UUID_HFP_HF "0000111e-0000-1000-8000-00805f9b34fb"
32 #define PA_BLUETOOTH_UUID_HFP_AG "0000111f-0000-1000-8000-00805f9b34fb"
34 typedef struct pa_bluetooth_transport pa_bluetooth_transport;
35 typedef struct pa_bluetooth_device pa_bluetooth_device;
36 typedef struct pa_bluetooth_adapter pa_bluetooth_adapter;
37 typedef struct pa_bluetooth_discovery pa_bluetooth_discovery;
39 typedef enum pa_bluetooth_hook {
40 PA_BLUETOOTH_HOOK_DEVICE_CONNECTION_CHANGED, /* Call data: pa_bluetooth_device */
41 PA_BLUETOOTH_HOOK_TRANSPORT_STATE_CHANGED, /* Call data: pa_bluetooth_transport */
43 PA_BLUETOOTH_HOOK_SCO_STATE_CHANGED, /* Call data: pa_bluetooth_transport */
46 } pa_bluetooth_hook_t;
48 typedef enum profile {
49 PA_BLUETOOTH_PROFILE_A2DP_SINK,
50 PA_BLUETOOTH_PROFILE_A2DP_SOURCE,
51 PA_BLUETOOTH_PROFILE_HEADSET_HEAD_UNIT,
52 PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY,
53 PA_BLUETOOTH_PROFILE_OFF
54 } pa_bluetooth_profile_t;
55 #define PA_BLUETOOTH_PROFILE_COUNT PA_BLUETOOTH_PROFILE_OFF
57 typedef enum pa_bluetooth_transport_state {
58 PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED,
59 PA_BLUETOOTH_TRANSPORT_STATE_IDLE,
60 PA_BLUETOOTH_TRANSPORT_STATE_PLAYING
61 } pa_bluetooth_transport_state_t;
63 typedef int (*pa_bluetooth_transport_acquire_cb)(pa_bluetooth_transport *t, bool optional, size_t *imtu, size_t *omtu);
64 typedef void (*pa_bluetooth_transport_release_cb)(pa_bluetooth_transport *t);
66 struct pa_bluetooth_transport {
67 pa_bluetooth_device *device;
71 pa_bluetooth_profile_t profile;
77 pa_bluetooth_transport_state_t state;
79 pa_bluetooth_transport_acquire_cb acquire;
80 pa_bluetooth_transport_release_cb release;
84 struct pa_bluetooth_device {
85 pa_bluetooth_discovery *discovery;
86 pa_bluetooth_adapter *adapter;
88 int device_info_valid; /* 0: no results yet; 1: good results; -1: bad results ... */
90 /* Device information */
95 uint32_t class_of_device;
98 pa_bluetooth_transport *transports[PA_BLUETOOTH_PROFILE_COUNT];
101 struct pa_bluetooth_adapter {
102 pa_bluetooth_discovery *discovery;
107 pa_bluetooth_transport *pa_bluetooth_transport_new(pa_bluetooth_device *d, const char *owner, const char *path,
108 pa_bluetooth_profile_t p, const uint8_t *config, size_t size);
110 void pa_bluetooth_transport_put(pa_bluetooth_transport *t);
111 void pa_bluetooth_transport_free(pa_bluetooth_transport *t);
113 bool pa_bluetooth_device_any_transport_connected(const pa_bluetooth_device *d);
115 bool pa_bluetooth_device_sink_transport_connected(const pa_bluetooth_device *d);
116 bool pa_bluetooth_device_source_transport_connected(const pa_bluetooth_device *d);
119 pa_bluetooth_device* pa_bluetooth_discovery_get_device_by_path(pa_bluetooth_discovery *y, const char *path);
120 pa_bluetooth_device* pa_bluetooth_discovery_get_device_by_address(pa_bluetooth_discovery *y, const char *remote, const char *local);
122 pa_hook* pa_bluetooth_discovery_hook(pa_bluetooth_discovery *y, pa_bluetooth_hook_t hook);
124 const char *pa_bluetooth_profile_to_string(pa_bluetooth_profile_t profile);
126 pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *core);
127 pa_bluetooth_discovery* pa_bluetooth_discovery_ref(pa_bluetooth_discovery *y);
128 void pa_bluetooth_discovery_unref(pa_bluetooth_discovery *y);
130 #ifdef BLUETOOTH_APTX_SUPPORT
131 int pa_load_aptx(const char *aptx_lib_name);
132 int pa_unload_aptx(void);
133 void* pa_aptx_get_handle(void);