Files
bar/include/services/bluetooth.hpp

36 lines
1004 B
C++

#pragma once
#include <gio/gio.h>
#include <gtk/gtk.h>
#include "sigc++/signal.h"
class BluetoothService {
public:
BluetoothService();
sigc::signal<void(bool)> powerStateChangedSignal;
sigc::signal<void(bool)> isDiscoveringChangedSignal;
bool getPowerState();
bool getIsDiscovering();
void togglePowerState();
void toggleIsDiscovering();
private:
GDBusProxy *adapter_proxy = nullptr;
bool powerState = false;
bool isDiscovering = false;
void onPropertyChanged(GDBusProxy *proxy,
GVariant *changed_properties,
const gchar *const *invalidated_properties,
gpointer user_data);
static void onPropertyChangedStatic(GDBusProxy *proxy,
GVariant *changed_properties,
const gchar *const *invalidated_properties,
gpointer user_data);
};