bluetooth: rename enable_hs_role to enable_shared_profiles

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/491>
This commit is contained in:
Igor V. Kovalenko 2021-02-16 08:46:19 +03:00 committed by Igor Kovalenko
parent c884ae8c74
commit 0a36c1544d
3 changed files with 16 additions and 16 deletions

View file

@ -40,7 +40,7 @@ struct pa_bluetooth_backend {
pa_core *core; pa_core *core;
pa_dbus_connection *connection; pa_dbus_connection *connection;
pa_bluetooth_discovery *discovery; pa_bluetooth_discovery *discovery;
bool enable_hs_role; bool enable_shared_profiles;
bool enable_hfp_hf; bool enable_hfp_hf;
PA_LLIST_HEAD(pa_dbus_pending, pending); PA_LLIST_HEAD(pa_dbus_pending, pending);
@ -793,8 +793,8 @@ static void profile_done(pa_bluetooth_backend *b, pa_bluetooth_profile_t profile
} }
} }
static void native_backend_apply_profile_registration_change(pa_bluetooth_backend *native_backend, bool enable_hs_role) { static void native_backend_apply_profile_registration_change(pa_bluetooth_backend *native_backend, bool enable_shared_profiles) {
if (enable_hs_role) { if (enable_shared_profiles) {
profile_init(native_backend, PA_BLUETOOTH_PROFILE_HSP_AG); profile_init(native_backend, PA_BLUETOOTH_PROFILE_HSP_AG);
if (native_backend->enable_hfp_hf) if (native_backend->enable_hfp_hf)
profile_init(native_backend, PA_BLUETOOTH_PROFILE_HFP_HF); profile_init(native_backend, PA_BLUETOOTH_PROFILE_HFP_HF);
@ -805,17 +805,17 @@ static void native_backend_apply_profile_registration_change(pa_bluetooth_backen
} }
} }
void pa_bluetooth_native_backend_enable_hs_role(pa_bluetooth_backend *native_backend, bool enable_hs_role) { void pa_bluetooth_native_backend_enable_shared_profiles(pa_bluetooth_backend *native_backend, bool enable) {
if (enable_hs_role == native_backend->enable_hs_role) if (enable == native_backend->enable_shared_profiles)
return; return;
native_backend_apply_profile_registration_change(native_backend, enable_hs_role); native_backend_apply_profile_registration_change(native_backend, enable);
native_backend->enable_hs_role = enable_hs_role; native_backend->enable_shared_profiles = enable;
} }
pa_bluetooth_backend *pa_bluetooth_native_backend_new(pa_core *c, pa_bluetooth_discovery *y, bool enable_hs_role) { pa_bluetooth_backend *pa_bluetooth_native_backend_new(pa_core *c, pa_bluetooth_discovery *y, bool enable_shared_profiles) {
pa_bluetooth_backend *backend; pa_bluetooth_backend *backend;
DBusError err; DBusError err;
@ -833,10 +833,10 @@ pa_bluetooth_backend *pa_bluetooth_native_backend_new(pa_core *c, pa_bluetooth_d
} }
backend->discovery = y; backend->discovery = y;
backend->enable_hs_role = enable_hs_role; backend->enable_shared_profiles = enable_shared_profiles;
backend->enable_hfp_hf = pa_bluetooth_discovery_get_enable_native_hfp_hf(y); backend->enable_hfp_hf = pa_bluetooth_discovery_get_enable_native_hfp_hf(y);
if (backend->enable_hs_role) if (backend->enable_shared_profiles)
native_backend_apply_profile_registration_change(backend, true); native_backend_apply_profile_registration_change(backend, true);
profile_init(backend, PA_BLUETOOTH_PROFILE_HSP_HS); profile_init(backend, PA_BLUETOOTH_PROFILE_HSP_HS);
@ -849,7 +849,7 @@ void pa_bluetooth_native_backend_free(pa_bluetooth_backend *backend) {
pa_dbus_free_pending_list(&backend->pending); pa_dbus_free_pending_list(&backend->pending);
if (backend->enable_hs_role) if (backend->enable_shared_profiles)
native_backend_apply_profile_registration_change(backend, false); native_backend_apply_profile_registration_change(backend, false);
profile_done(backend, PA_BLUETOOTH_PROFILE_HSP_HS); profile_done(backend, PA_BLUETOOTH_PROFILE_HSP_HS);

View file

@ -1466,7 +1466,7 @@ void pa_bluetooth_discovery_set_ofono_running(pa_bluetooth_discovery *y, bool is
if (y->headset_backend != HEADSET_BACKEND_AUTO) if (y->headset_backend != HEADSET_BACKEND_AUTO)
return; return;
pa_bluetooth_native_backend_enable_hs_role(y->native_backend, !is_running); pa_bluetooth_native_backend_enable_shared_profiles(y->native_backend, !is_running);
/* If ofono starts running, all devices that might be connected to the HS roles or HFP AG role /* If ofono starts running, all devices that might be connected to the HS roles or HFP AG role
* need to be disconnected, so that the devices can be handled by ofono */ * need to be disconnected, so that the devices can be handled by ofono */

View file

@ -164,15 +164,15 @@ static inline void pa_bluetooth_ofono_backend_free(pa_bluetooth_backend *b) {}
#endif #endif
#ifdef HAVE_BLUEZ_5_NATIVE_HEADSET #ifdef HAVE_BLUEZ_5_NATIVE_HEADSET
pa_bluetooth_backend *pa_bluetooth_native_backend_new(pa_core *c, pa_bluetooth_discovery *y, bool enable_hs_role); pa_bluetooth_backend *pa_bluetooth_native_backend_new(pa_core *c, pa_bluetooth_discovery *y, bool enable_shared_profiles);
void pa_bluetooth_native_backend_free(pa_bluetooth_backend *b); void pa_bluetooth_native_backend_free(pa_bluetooth_backend *b);
void pa_bluetooth_native_backend_enable_hs_role(pa_bluetooth_backend *b, bool enable_hs_role); void pa_bluetooth_native_backend_enable_shared_profiles(pa_bluetooth_backend *b, bool enable);
#else #else
static inline pa_bluetooth_backend *pa_bluetooth_native_backend_new(pa_core *c, pa_bluetooth_discovery *y, bool enable_hs_role) { static inline pa_bluetooth_backend *pa_bluetooth_native_backend_new(pa_core *c, pa_bluetooth_discovery *y, bool enable_shared_profiles) {
return NULL; return NULL;
} }
static inline void pa_bluetooth_native_backend_free(pa_bluetooth_backend *b) {} static inline void pa_bluetooth_native_backend_free(pa_bluetooth_backend *b) {}
static inline void pa_bluetooth_native_backend_enable_hs_role(pa_bluetooth_backend *b, bool enable_hs_role) {} static inline void pa_bluetooth_native_backend_enable_shared_profiles(pa_bluetooth_backend *b, bool enable) {}
#endif #endif
pa_bluetooth_transport *pa_bluetooth_transport_new(pa_bluetooth_device *d, const char *owner, const char *path, pa_bluetooth_transport *pa_bluetooth_transport_new(pa_bluetooth_device *d, const char *owner, const char *path,