2013-08-13 01:54:00 -03:00
|
|
|
#ifndef foobluez5utilhfoo
|
|
|
|
|
#define foobluez5utilhfoo
|
|
|
|
|
|
|
|
|
|
/***
|
|
|
|
|
This file is part of PulseAudio.
|
|
|
|
|
|
|
|
|
|
Copyright 2008-2013 João Paulo Rechi Vita
|
|
|
|
|
|
|
|
|
|
PulseAudio is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU Lesser General Public License as
|
|
|
|
|
published by the Free Software Foundation; either version 2.1 of the
|
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
PulseAudio 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 Lesser General Public
|
|
|
|
|
License along with PulseAudio; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
|
USA.
|
|
|
|
|
***/
|
|
|
|
|
|
|
|
|
|
#include <pulsecore/core.h>
|
|
|
|
|
|
2013-09-24 19:45:24 -03:00
|
|
|
#define PA_BLUETOOTH_UUID_A2DP_SOURCE "0000110a-0000-1000-8000-00805f9b34fb"
|
|
|
|
|
#define PA_BLUETOOTH_UUID_A2DP_SINK "0000110b-0000-1000-8000-00805f9b34fb"
|
2014-08-22 11:07:11 +03:00
|
|
|
#define PA_BLUETOOTH_UUID_HSP_HS "00001108-0000-1000-8000-00805f9b34fb"
|
|
|
|
|
#define PA_BLUETOOTH_UUID_HSP_AG "00001112-0000-1000-8000-00805f9b34fb"
|
|
|
|
|
#define PA_BLUETOOTH_UUID_HFP_HF "0000111e-0000-1000-8000-00805f9b34fb"
|
|
|
|
|
#define PA_BLUETOOTH_UUID_HFP_AG "0000111f-0000-1000-8000-00805f9b34fb"
|
2013-09-24 19:45:24 -03:00
|
|
|
|
2013-09-24 19:45:22 -03:00
|
|
|
typedef struct pa_bluetooth_transport pa_bluetooth_transport;
|
2013-09-18 16:16:58 -05:00
|
|
|
typedef struct pa_bluetooth_device pa_bluetooth_device;
|
2013-09-18 16:16:57 -05:00
|
|
|
typedef struct pa_bluetooth_adapter pa_bluetooth_adapter;
|
2013-08-13 01:54:00 -03:00
|
|
|
typedef struct pa_bluetooth_discovery pa_bluetooth_discovery;
|
2014-08-22 11:07:14 +03:00
|
|
|
typedef struct pa_bluetooth_backend pa_bluetooth_backend;
|
2013-08-13 01:54:00 -03:00
|
|
|
|
2013-09-18 16:16:56 -05:00
|
|
|
typedef enum pa_bluetooth_hook {
|
2013-09-18 16:16:58 -05:00
|
|
|
PA_BLUETOOTH_HOOK_DEVICE_CONNECTION_CHANGED, /* Call data: pa_bluetooth_device */
|
2013-09-24 19:45:22 -03:00
|
|
|
PA_BLUETOOTH_HOOK_TRANSPORT_STATE_CHANGED, /* Call data: pa_bluetooth_transport */
|
2013-09-18 16:16:56 -05:00
|
|
|
PA_BLUETOOTH_HOOK_MAX
|
|
|
|
|
} pa_bluetooth_hook_t;
|
|
|
|
|
|
2013-09-24 19:45:22 -03:00
|
|
|
typedef enum profile {
|
|
|
|
|
PA_BLUETOOTH_PROFILE_A2DP_SINK,
|
|
|
|
|
PA_BLUETOOTH_PROFILE_A2DP_SOURCE,
|
2014-08-22 11:07:11 +03:00
|
|
|
PA_BLUETOOTH_PROFILE_HEADSET_HEAD_UNIT,
|
|
|
|
|
PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY,
|
2013-09-24 19:45:22 -03:00
|
|
|
PA_BLUETOOTH_PROFILE_OFF
|
|
|
|
|
} pa_bluetooth_profile_t;
|
|
|
|
|
#define PA_BLUETOOTH_PROFILE_COUNT PA_BLUETOOTH_PROFILE_OFF
|
|
|
|
|
|
|
|
|
|
typedef enum pa_bluetooth_transport_state {
|
|
|
|
|
PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED,
|
|
|
|
|
PA_BLUETOOTH_TRANSPORT_STATE_IDLE,
|
|
|
|
|
PA_BLUETOOTH_TRANSPORT_STATE_PLAYING
|
|
|
|
|
} pa_bluetooth_transport_state_t;
|
|
|
|
|
|
|
|
|
|
typedef int (*pa_bluetooth_transport_acquire_cb)(pa_bluetooth_transport *t, bool optional, size_t *imtu, size_t *omtu);
|
|
|
|
|
typedef void (*pa_bluetooth_transport_release_cb)(pa_bluetooth_transport *t);
|
2014-10-24 09:56:50 +02:00
|
|
|
typedef void (*pa_bluetooth_transport_destroy_cb)(pa_bluetooth_transport *t);
|
2013-09-24 19:45:22 -03:00
|
|
|
|
|
|
|
|
struct pa_bluetooth_transport {
|
|
|
|
|
pa_bluetooth_device *device;
|
|
|
|
|
|
|
|
|
|
char *owner;
|
|
|
|
|
char *path;
|
|
|
|
|
pa_bluetooth_profile_t profile;
|
|
|
|
|
|
|
|
|
|
uint8_t codec;
|
|
|
|
|
uint8_t *config;
|
|
|
|
|
size_t config_size;
|
|
|
|
|
|
|
|
|
|
pa_bluetooth_transport_state_t state;
|
|
|
|
|
|
|
|
|
|
pa_bluetooth_transport_acquire_cb acquire;
|
|
|
|
|
pa_bluetooth_transport_release_cb release;
|
2014-10-24 09:56:50 +02:00
|
|
|
pa_bluetooth_transport_destroy_cb destroy;
|
2013-09-24 19:45:22 -03:00
|
|
|
void *userdata;
|
|
|
|
|
};
|
|
|
|
|
|
2013-09-18 16:16:58 -05:00
|
|
|
struct pa_bluetooth_device {
|
|
|
|
|
pa_bluetooth_discovery *discovery;
|
|
|
|
|
pa_bluetooth_adapter *adapter;
|
|
|
|
|
|
2014-05-24 12:56:35 +03:00
|
|
|
bool properties_received;
|
|
|
|
|
bool tried_to_link_with_adapter;
|
|
|
|
|
bool valid;
|
2013-09-18 16:16:58 -05:00
|
|
|
|
|
|
|
|
/* Device information */
|
|
|
|
|
char *path;
|
2013-09-24 19:45:36 -03:00
|
|
|
char *adapter_path;
|
2013-09-18 16:16:58 -05:00
|
|
|
char *alias;
|
|
|
|
|
char *address;
|
|
|
|
|
uint32_t class_of_device;
|
2013-09-24 19:45:35 -03:00
|
|
|
pa_hashmap *uuids;
|
2013-09-24 19:45:22 -03:00
|
|
|
|
|
|
|
|
pa_bluetooth_transport *transports[PA_BLUETOOTH_PROFILE_COUNT];
|
2013-09-18 16:16:58 -05:00
|
|
|
};
|
|
|
|
|
|
2013-09-18 16:16:57 -05:00
|
|
|
struct pa_bluetooth_adapter {
|
|
|
|
|
pa_bluetooth_discovery *discovery;
|
|
|
|
|
char *path;
|
|
|
|
|
char *address;
|
2014-05-24 12:56:34 +03:00
|
|
|
|
|
|
|
|
bool valid;
|
2013-09-18 16:16:57 -05:00
|
|
|
};
|
|
|
|
|
|
2014-09-10 11:48:23 +02:00
|
|
|
pa_bluetooth_backend *pa_bluetooth_backend_new(pa_core *c, pa_bluetooth_discovery *y);
|
2014-08-22 11:07:14 +03:00
|
|
|
void pa_bluetooth_backend_free(pa_bluetooth_backend *b);
|
|
|
|
|
|
2013-09-24 19:45:22 -03:00
|
|
|
pa_bluetooth_transport *pa_bluetooth_transport_new(pa_bluetooth_device *d, const char *owner, const char *path,
|
|
|
|
|
pa_bluetooth_profile_t p, const uint8_t *config, size_t size);
|
|
|
|
|
|
2014-09-08 12:14:42 +03:00
|
|
|
void pa_bluetooth_transport_set_state(pa_bluetooth_transport *t, pa_bluetooth_transport_state_t state);
|
2013-09-24 19:45:22 -03:00
|
|
|
void pa_bluetooth_transport_put(pa_bluetooth_transport *t);
|
2014-09-08 12:14:43 +03:00
|
|
|
void pa_bluetooth_transport_unlink(pa_bluetooth_transport *t);
|
2013-09-24 19:45:22 -03:00
|
|
|
void pa_bluetooth_transport_free(pa_bluetooth_transport *t);
|
|
|
|
|
|
|
|
|
|
bool pa_bluetooth_device_any_transport_connected(const pa_bluetooth_device *d);
|
|
|
|
|
|
2013-09-18 16:16:58 -05:00
|
|
|
pa_bluetooth_device* pa_bluetooth_discovery_get_device_by_path(pa_bluetooth_discovery *y, const char *path);
|
|
|
|
|
pa_bluetooth_device* pa_bluetooth_discovery_get_device_by_address(pa_bluetooth_discovery *y, const char *remote, const char *local);
|
|
|
|
|
|
2013-09-18 16:16:56 -05:00
|
|
|
pa_hook* pa_bluetooth_discovery_hook(pa_bluetooth_discovery *y, pa_bluetooth_hook_t hook);
|
|
|
|
|
|
2013-09-24 19:45:24 -03:00
|
|
|
const char *pa_bluetooth_profile_to_string(pa_bluetooth_profile_t profile);
|
|
|
|
|
|
2013-08-13 01:54:00 -03:00
|
|
|
pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *core);
|
|
|
|
|
pa_bluetooth_discovery* pa_bluetooth_discovery_ref(pa_bluetooth_discovery *y);
|
|
|
|
|
void pa_bluetooth_discovery_unref(pa_bluetooth_discovery *y);
|
|
|
|
|
#endif
|