/*
 * This file was generated by qdbusxml2cpp version 0.8
 * Command line was: qdbusxml2cpp dbus.xml -a dbus_adaptor
 *
 * qdbusxml2cpp is Copyright (C) 2020 The Qt Company Ltd.
 *
 * This is an auto-generated file.
 * This file may have been hand-edited. Look for HAND-EDIT comments
 * before re-generating it.
 */

#ifndef KYLIN_NETCTROL_SERVER_INTERFACE_H
#define KYLIN_NETCTROL_SERVER_INTERFACE_H

#include <QtCore/QObject>
#include <QtDBus/QtDBus>
#include <QtDBus/QDBusMetaType>
#include "kylin_cfgInfo.h"
#include "kylin_async_task.h"
QT_BEGIN_NAMESPACE

typedef struct ST_NtCtDbusReturnParm{
   QVariantMap map;
   int errCode;
}st_NtCtDbusReturnParm;

Q_DECLARE_METATYPE(st_NtCtDbusReturnParm)

#define NET_CTRL_IP4_NAME "IPV4"
#define NET_CTRL_IP6_NAME "IPV6"
#define NET_CTRL_DNS_NAME "DNS"
#define NET_CTRL_CONNECT_NAME "Connect"
#define NET_CTRL_LOG_NAME "LOG"

enum NETCONTROL_ERR_CODE{
    NETCT_SUCCESS= 0,  //成功
    NETCT_DO_FAILED= 1,//执行失败
    NETCT_INVALID_RULE,//无效规则
    NETCT_INVALID_MODE,//不支持的模块
    NETCT_PARM_MISMATCH,//参数不匹配

    NETCT_UNKOWN_ERR= 1023,
};

QT_BEGIN_NAMESPACE
class QByteArray;
template<class Key, class Value> class QMap;
class QString;
class QStringList;
class QVariant;
QT_END_NAMESPACE
/*
 * Adaptor class for interface com.kylin.network
 * "      <arg direction=\"out\" type=\"i\" name=\"errCode\"/>\n"
 */

class NetCtrlAdaptor: public QObject
{
    Q_OBJECT
    Q_CLASSINFO("D-Bus Interface", "com.kylin.networkCtrol")

    Q_CLASSINFO("D-Bus Introspection", ""
   "  <interface name=\"com.kylin.networkCtrol\">\n"
   "    <signal name=\"sigNetContrlRuleChanged\">\n"
   "      <arg direction=\"out\" type=\"s\" name=\"modName\"/>\n"
   "      <arg direction=\"out\" type=\"a{sv}\" name=\"value\"/>\n"
   "    </signal>\n"
   "    <method name=\"setNetContrlRule\">\n"
   "      <arg direction=\"in\" type=\"s\" name=\"modName\"/>\n"
   "      <arg direction=\"in\" type=\"a{sv}\" name=\"value\"/>\n"
   "      <arg direction=\"out\" type=\"i\" name=\"errCode\"/>\n"
   "    </method>\n"
   "    <method name=\"getNetContrlRule\">\n"
   "      <arg direction=\"in\" type=\"s\" name=\"modName\"/>\n"
   "      <arg direction=\"out\" type=\"a{sv}\" name=\"value\"/>\n"
   "      <arg direction=\"out\" type=\"i\" name=\"errCode\"/>\n"
   "    </method>\n"
   "    <method name=\"sendNetCtrLog\">\n"
   "      <arg direction=\"in\" type=\"i\" name=\"errcode\"/>\n"
   "      <arg direction=\"in\" type=\"i\" name=\"type\"/>\n"
   "      <arg direction=\"in\" type=\"s\" name=\"message\"/>\n"
   "      <arg direction=\"out\" type=\"i\" name=\"reserv\"/>\n"
   "    </method>\n"
   "    <method name=\"sendSysProxyNetCtlLog\">\n"
   "      <arg direction=\"in\" type=\"s\" name=\"message\"/>\n"
   "    </method>\n"

   "  </interface>\n"
           "")

public:
   explicit NetCtrlAdaptor(QObject *parent = nullptr);
     ~NetCtrlAdaptor();

public: // PROPERTIES
   static NetCtrlAdaptor* getNetContrlInstance();
   void initServer();

public

    Q_SLOTS: // METHODS
    int setNetContrlRule(const QString modName,const QVariantMap value);
    void getNetContrlRule(const QString modName,QVariantMap &value,int &errCode);
    //QVariantList getNetContrlRule(QString modName);
    int sendNetCtrLog(int errcode,int type,QString message);
    void sendSysProxyNetCtlLog(QString message);

    Q_SIGNALS: // SIGNALS
    void sigNetContrlRuleChanged(const QString ruleName,const QVariantMap value);
private:
     QString m_display;
     QDBusServiceWatcher *m_watcher = nullptr;
     QString mMessage;
     int mErrcode;
     int mType;
    KYLIN_CFG_HANDLE mCfgHandle=NULL;
    KYLIN_ASYNC_HANDLE mAsyncHandle=NULL;

     bool registerService();
     void initCfg();
     int fristCreatCfgInfo();
     QVariant transGvariantToQvariant(GVariant *gVariant);
     GVariant* transQvariantToGvariant(QVariant &qVariant);
     void showDesktopNotify(const QString &message, QString soundName);
     int waitNetCtrlBackResult(unsigned long long timeOutMs,QString cmd);
     void clearBackMessage();

};

#endif
