summaryrefslogtreecommitdiffstats
path: root/bluetooth/bluetootheventhandler.h
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2022-02-28 13:04:45 -0500
committerScott Murray <scott.murray@konsulko.com>2022-02-28 13:04:45 -0500
commit1332cc7d0a618ee88b4d19813340665332d406ca (patch)
treefe500276505160f5fd8ba8acb46334633ed0788a /bluetooth/bluetootheventhandler.h
parent0de8ac83e6a190d5fc124587d1f9f0a7f0198ce3 (diff)
Add Bluetooth media control supportmarlin_12.93.0marlin/12.93.012.93.0
Rework to expose Bluetooth AVRCP media control in the Bluetooth class, and use that support to implement a Bluetooth backend in the Mediaplayer class. This replaces the scheme that existed with the agl-service-mediaplayer binding where it abstracted away the Bluetooth support itself. However, care has been take to make sure that the exposed API to users of libqtappfw-mediaplayer has not changed. Bug-AGL: SPEC-4231 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: I76b4f75621ce0121364eea3259b074bf3067ee88
Diffstat (limited to 'bluetooth/bluetootheventhandler.h')
-rw-r--r--bluetooth/bluetootheventhandler.h43
1 files changed, 41 insertions, 2 deletions
diff --git a/bluetooth/bluetootheventhandler.h b/bluetooth/bluetootheventhandler.h
index ff970f5..c4dd67a 100644
--- a/bluetooth/bluetootheventhandler.h
+++ b/bluetooth/bluetootheventhandler.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2021 Konsulko Group
+ * Copyright (C) 2021,2022 Konsulko Group
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ class Bluetooth;
class BluetoothEventHandler
{
public:
- explicit BluetoothEventHandler(Bluetooth *parent, bool register_agent);
+ explicit BluetoothEventHandler(Bluetooth *parent, bool register_agent, bool handle_media = false);
virtual ~BluetoothEventHandler();
static void init_cb(gchar *adapter, gboolean status, gpointer user_data) {
@@ -40,6 +40,10 @@ class BluetoothEventHandler
((BluetoothEventHandler*) user_data)->handle_pair_event(device, status);
}
+ // Helper function callable by parent (instead of vice versa), since Bluetooth
+ // object should not expose glib types.
+ void parse_media_player_properties(GVariant *properties, QVariantMap &metadata);
+
private:
Bluetooth *m_parent;
bool m_agent;
@@ -59,11 +63,46 @@ class BluetoothEventHandler
if (user_data)
((BluetoothEventHandler*) user_data)->handle_agent_event(device, event, properties);
}
+
+ static void media_control_event_cb(gchar *adapter,
+ gchar *device,
+ bluez_event_t event,
+ GVariant *properties,
+ gpointer user_data) {
+ if (user_data)
+ ((BluetoothEventHandler*) user_data)->handle_media_control_event(adapter,
+ device,
+ event,
+ properties);
+ }
+
+ static void media_player_event_cb(gchar *adapter,
+ gchar *device,
+ gchar *player,
+ bluez_event_t event,
+ GVariant *properties,
+ gpointer user_data) {
+ if (user_data)
+ ((BluetoothEventHandler*) user_data)->handle_media_player_event(adapter,
+ device,
+ player,
+ event,
+ properties);
+ }
void handle_init_event(gchar *adapter, gboolean status);
void handle_adapter_event(gchar *adapter, bluez_event_t event, GVariant *properties);
void handle_device_event(gchar *adapter, gchar *device, bluez_event_t event, GVariant *properties);
void handle_agent_event(gchar *device, bluez_agent_event_t event, GVariant *properties);
+ void handle_media_control_event(gchar *adapter,
+ gchar *device,
+ bluez_event_t event,
+ GVariant *properties);
+ void handle_media_player_event(gchar *adapter,
+ gchar *device,
+ gchar *player,
+ bluez_event_t event,
+ GVariant *properties);
void handle_connect_event(gchar *device, gboolean status);
void handle_pair_event(gchar *device, gboolean status);
};