#include <QCoreApplication>
#include <QDBusConnection>
#include <QDBusError>
#include <QDebug>
#include "resourcemanager.h"
#include "resourcemanagerservice.h"
#include "logger.h"

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    ResourceManager resourceManager;
    QDBusConnection connection = QDBusConnection::systemBus();
    if (!connection.registerService("com.kylin.ProcessResourceManagerDaemon") ||
            !connection.registerObject("/com/kylin/ProcessResourceManagerDaemon", &resourceManager)) 
    {
        qWarning() << "register dbus service failed" << connection.lastError();
        PRINT_DBG("kylin-process-resource-manager-daemon : register dbus service failed\n");
        return 0;
    }

    ResourceManagerService resourceManagerService(&resourceManager);

    return a.exec();
}
