#include "backendlogic.h"
#include "Deviceinfo.h"
#include <QProcess>
#include <QDebug>
#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonObject>
#include <windows.h>

void BackendLogic::shutdown()
{
#if 0
    QString program = "C:/WINDOWS/system32/shutdown.exe";
    QStringList arguments;
    arguments << "-s -t 00";
    QProcess *myProcess = new QProcess();
    myProcess->start(program, arguments);
#else
    #ifdef QT_NO_DEBUG
    system("shutdown -s -t 00");
    #endif
    #ifdef QT_DEBUG
       //system("shutdown -s -t 00");
       exit(0);
    #endif
#endif
}

QJsonObject BackendLogic::getDeviceInfo()
{
    QJsonObject jsonObj;
    DeviceInfo  devinfo;

    jsonObj.insert("model", devinfo.m_model);
    jsonObj.insert("id", devinfo.m_id);
    jsonObj.insert("name", devinfo.m_name);
    jsonObj.insert("manufacture", devinfo.m_manufacture);

    return jsonObj;
}
