]>
code.delx.au - pulseaudio/blob - src/modules/bluetooth/module-bluez5-device.c
2 This file is part of PulseAudio.
4 Copyright 2008-2013 João Paulo Rechi Vita
5 Copyright 2011-2013 BMW Car IT GmbH.
7 PulseAudio is free software; you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as
9 published by the Free Software Foundation; either version 2.1 of the
10 License, or (at your option) any later version.
12 PulseAudio is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public
18 License along with PulseAudio; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
27 #include <pulsecore/module.h>
28 #include <pulsecore/modargs.h>
30 #include "bluez5-util.h"
32 #include "module-bluez5-device-symdef.h"
34 PA_MODULE_AUTHOR("João Paulo Rechi Vita");
35 PA_MODULE_DESCRIPTION("BlueZ 5 Bluetooth audio sink and source");
36 PA_MODULE_VERSION(PACKAGE_VERSION
);
37 PA_MODULE_LOAD_ONCE(false);
38 PA_MODULE_USAGE("path=<device object path>");
40 static const char* const valid_modargs
[] = {
49 pa_bluetooth_discovery
*discovery
;
50 pa_bluetooth_device
*device
;
53 int pa__init(pa_module
* m
) {
60 m
->userdata
= u
= pa_xnew0(struct userdata
, 1);
64 if (!(ma
= pa_modargs_new(m
->argument
, valid_modargs
))) {
65 pa_log_error("Failed to parse module arguments");
69 if (!(path
= pa_modargs_get_value(ma
, "path", NULL
))) {
70 pa_log_error("Failed to get device path from module arguments");
74 if (!(u
->discovery
= pa_bluetooth_discovery_get(m
->core
)))
77 if (!(u
->device
= pa_bluetooth_discovery_get_device_by_path(u
->discovery
, path
))) {
78 pa_log_error("%s is unknown", path
);
96 void pa__done(pa_module
*m
) {
101 if (!(u
= m
->userdata
))
105 pa_bluetooth_discovery_unref(u
->discovery
);