bluez5: Make native and ofono backends optional

This commit is contained in:
Frédéric Danis 2020-07-22 14:50:38 +02:00 committed by Wim Taymans
parent ebdaac160c
commit db0c224b06
5 changed files with 55 additions and 4 deletions

View file

@ -31,6 +31,8 @@ extern "C" {
#include <spa/utils/hook.h>
#include "config.h"
#define BLUEZ_SERVICE "org.bluez"
#define BLUEZ_PROFILE_MANAGER_INTERFACE BLUEZ_SERVICE ".ProfileManager1"
#define BLUEZ_PROFILE_INTERFACE BLUEZ_SERVICE ".Profile1"
@ -295,17 +297,37 @@ static inline enum spa_bt_transport_state spa_bt_transport_state_from_string(con
}
#ifdef HAVE_BLUEZ_5_BACKEND_NATIVE
struct spa_bt_backend *backend_hsp_native_new(struct spa_bt_monitor *monitor,
const struct spa_support *support,
uint32_t n_support);
void backend_hsp_native_free(struct spa_bt_backend *backend);
void backend_hsp_native_register_profiles(struct spa_bt_backend *backend);
#else
static inline struct spa_bt_backend *backend_hsp_native_new(struct spa_bt_monitor *monitor,
const struct spa_support *support,
uint32_t n_support) {
return NULL;
}
static inline void backend_hsp_native_free(struct spa_bt_backend *backend) {}
static inline void backend_hsp_native_register_profiles(struct spa_bt_backend *backend) {}
#endif
#ifdef HAVE_BLUEZ_5_BACKEND_OFONO
struct spa_bt_backend *backend_ofono_new(struct spa_bt_monitor *monitor,
const struct spa_support *support,
uint32_t n_support);
void backend_ofono_free(struct spa_bt_backend *backend);
void backend_ofono_add_filters(struct spa_bt_backend *backend);
#else
static inline struct spa_bt_backend *backend_ofono_new(struct spa_bt_monitor *monitor,
const struct spa_support *support,
uint32_t n_support) {
return NULL;
}
static inline void backend_ofono_free(struct spa_bt_backend *backend) {}
static inline void backend_ofono_add_filters(struct spa_bt_backend *backend) {}
#endif
#ifdef __cplusplus
} /* extern "C" */

View file

@ -6,13 +6,19 @@ bluez5_sources = ['plugin.c',
'sco-sink.c',
'sco-source.c',
'bluez5-device.c',
'bluez5-dbus.c',
'backend-hsp-native.c',
'backend-ofono.c']
'bluez5-dbus.c']
if get_option('bluez5-backend-native')
bluez5_sources += ['backend-hsp-native.c']
endif
if get_option('bluez5-backend-ofono')
bluez5_sources += ['backend-ofono.c']
endif
bluez5lib = shared_library('spa-bluez5',
bluez5_sources,
include_directories : [ spa_inc ],
include_directories : [ spa_inc, configinc ],
c_args : [ '-D_GNU_SOURCE' ],
dependencies : [ dbus_dep, sbc_dep, bluez_dep ],
install : true,