mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-16 08:56:45 -05:00
bluez5-dbus: move battery provider functions, fix ghost batteries
This commit is contained in:
parent
48cc5915fb
commit
5c9028a94d
3 changed files with 286 additions and 275 deletions
|
|
@ -48,6 +48,17 @@ extern "C" {
|
|||
#define BLUEZ_MEDIA_INTERFACE BLUEZ_SERVICE ".Media1"
|
||||
#define BLUEZ_MEDIA_ENDPOINT_INTERFACE BLUEZ_SERVICE ".MediaEndpoint1"
|
||||
#define BLUEZ_MEDIA_TRANSPORT_INTERFACE BLUEZ_SERVICE ".MediaTransport1"
|
||||
#define BLUEZ_INTERFACE_BATTERY_PROVIDER BLUEZ_SERVICE ".BatteryProvider1"
|
||||
#define BLUEZ_INTERFACE_BATTERY_PROVIDER_MANAGER BLUEZ_SERVICE ".BatteryProviderManager1"
|
||||
|
||||
#define DBUS_INTERFACE_OBJECT_MANAGER "org.freedesktop.DBus.ObjectManager"
|
||||
#define DBUS_SIGNAL_INTERFACES_ADDED "InterfacesAdded"
|
||||
#define DBUS_SIGNAL_INTERFACES_REMOVED "InterfacesRemoved"
|
||||
#define DBUS_SIGNAL_PROPERTIES_CHANGED "PropertiesChanged"
|
||||
|
||||
#define PIPEWIRE_BATTERY_PROVIDER "/org/freedesktop/pipewire/battery"
|
||||
|
||||
#define SPA_BT_HFP_HF_IPHONEACCEV_KEY_BATTERY 1
|
||||
|
||||
#define MIN_LATENCY 512
|
||||
#define MAX_LATENCY 1024
|
||||
|
|
@ -279,6 +290,8 @@ struct spa_bt_adapter {
|
|||
int powered;
|
||||
unsigned int endpoints_registered:1;
|
||||
unsigned int application_registered:1;
|
||||
unsigned int has_battery_provider;
|
||||
unsigned int battery_provider_unavailable;
|
||||
};
|
||||
|
||||
enum spa_bt_form_factor {
|
||||
|
|
@ -369,46 +382,6 @@ struct spa_bt_device_events {
|
|||
void (*profiles_changed) (void *data, uint32_t prev_profiles, uint32_t prev_connected);
|
||||
};
|
||||
|
||||
struct spa_bt_monitor {
|
||||
struct spa_handle handle;
|
||||
struct spa_device device;
|
||||
|
||||
struct spa_log *log;
|
||||
struct spa_loop *main_loop;
|
||||
struct spa_system *main_system;
|
||||
struct spa_dbus *dbus;
|
||||
struct spa_dbus_connection *dbus_connection;
|
||||
DBusConnection *conn;
|
||||
|
||||
struct spa_hook_list hooks;
|
||||
|
||||
uint32_t count;
|
||||
uint32_t id;
|
||||
|
||||
/*
|
||||
* Lists of BlueZ objects, kept up-to-date by following DBus events
|
||||
* initiated by BlueZ. Object lifetime is also determined by that.
|
||||
*/
|
||||
struct spa_list adapter_list;
|
||||
struct spa_list device_list;
|
||||
struct spa_list remote_endpoint_list;
|
||||
struct spa_list transport_list;
|
||||
|
||||
unsigned int filters_added:1;
|
||||
unsigned int objects_listed:1;
|
||||
|
||||
struct spa_bt_backend *backend_native;
|
||||
struct spa_bt_backend *backend_ofono;
|
||||
struct spa_bt_backend *backend_hsphfpd;
|
||||
|
||||
struct spa_dict enabled_codecs;
|
||||
|
||||
unsigned int enable_sbc_xq:1;
|
||||
unsigned int backend_native_registered:1;
|
||||
unsigned int backend_ofono_registered:1;
|
||||
unsigned int backend_hsphfpd_registered:1;
|
||||
};
|
||||
|
||||
struct spa_bt_device {
|
||||
struct spa_list link;
|
||||
struct spa_bt_monitor *monitor;
|
||||
|
|
@ -450,6 +423,7 @@ int spa_bt_device_ensure_a2dp_codec(struct spa_bt_device *device, const struct a
|
|||
bool spa_bt_device_supports_a2dp_codec(struct spa_bt_device *device, const struct a2dp_codec *codec);
|
||||
const struct a2dp_codec **spa_bt_device_get_supported_a2dp_codecs(struct spa_bt_device *device, size_t *count);
|
||||
int spa_bt_device_release_transports(struct spa_bt_device *device);
|
||||
int spa_bt_device_report_battery_level(struct spa_bt_device *device, uint8_t percentage);
|
||||
|
||||
#define spa_bt_device_emit(d,m,v,...) spa_hook_list_call(&(d)->listener_list, \
|
||||
struct spa_bt_device_events, \
|
||||
|
|
@ -491,9 +465,6 @@ struct spa_bt_transport_implementation {
|
|||
int (*destroy) (void *data);
|
||||
};
|
||||
|
||||
// Key for getting battery state
|
||||
#define SPA_BT_HFP_HF_IPHONEACCEV_KEY_BATTERY 1
|
||||
|
||||
struct spa_bt_transport {
|
||||
struct spa_list link;
|
||||
struct spa_bt_monitor *monitor;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue