#pragma once #include #include #include #include #include "sigc++/signal.h" class BluetoothService { inline static BluetoothService *instance = nullptr; public: sigc::signal powerStateChangedSignal; sigc::signal isDiscoveringChangedSignal; bool getPowerState(); bool getIsDiscovering(); void togglePowerState(); void toggleIsDiscovering(); static BluetoothService *getInstance() { if (BluetoothService::instance == nullptr) { BluetoothService::instance = new BluetoothService(); } return BluetoothService::instance; } private: BluetoothService(); GDBusProxy *adapter_proxy = nullptr; std::vector getDeviceObjectPaths(); 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); };