#include <QCoreApplication>
#include <QDBusConnection>
#include <QDBusInterface>
#include <QDBusServiceWatcher>
#include <QDebug>

#include "agent.hpp"

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

    QDBusConnection connection = QDBusConnection::systemBus();
    if (!connection.isConnected())
    {
        qDebug() << "dbus连接失败";
        return -1;
    }
    if (!connection.registerService("com.kylin.dockerAgent"))
    {
        qDebug() << "com.kylin.dockerAgent 服务注册失败";
        return -1;
    }
    Agent agent;
    if (!connection.registerObject("/com/kylin/dockerAgent", &agent,
                                   QDBusConnection::ExportAllContents))
    {
        qDebug() << "/com/kylin/dockerAgent 对象注册失败";
        return -1;
    }
    return a.exec();
}
