summaryrefslogtreecommitdiffstats
path: root/bluetooth/bluetootheventhandler.h
diff options
context:
space:
mode:
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);
};