#ifndef AUDIODBUSSERVER_H
#define AUDIODBUSSERVER_H

#include <dbus/dbus.h>
#include <gio/gio.h>
#include <iostream>
#include <atomic>

#include "Util.h"

//#define AUDIO_OBJECT_SERVICE "org.ukui.audio.framwork"
//#define AUDIO_OBJECT_PATH    "/org/ukui/audio/framwork"
//#define AUDIO_INTERFACE      "org.ukui.audio.framwork"
//#define SETTINGS_INTERFACE   "org.ukui.audio.settings"
namespace UkuiAudioFramwork
{
class AudioMethod;
class AudioDBusServer {
public:
    AudioDBusServer() = default;
    virtual ~AudioDBusServer();

public:
    void run();

    bool initialize();

    void sendSignal(const char*, const char*, const char*, GVariant*);

private:
    static void handleMethodCall(GDBusConnection* connection,
                                 const char* sender,
                                 const char* objectPath,
                                 const char* interfaceName,
                                 const char* methodName,
                                 GVariant* parameters,
                                 GDBusMethodInvocation* invocation,
                                 gpointer userData);

private:
    static const char* m_pIntrospectionXml;
    static const char* m_pAudioSettingXml;
    static const char* m_pSoundThemeXml;
    static GDBusInterfaceVTable m_interfaceVTable;
    GDBusConnection* m_pConnection;
    GMainLoop* m_pMainLoop;
};
}
#endif // AUDIODBUSSERVER_H
