/*
 * This file was generated by qdbusxml2cpp-fix version 0.8
 * Command line was: qdbusxml2cpp-fix -m -p network1interface /build/deepin-tray-loader/src/dde-tray-loader/plugins/dde-dock/dbus/xml/org.deepin.dde.Network1.xml
 *
 * qdbusxml2cpp-fix is Copyright (C) 2016 Deepin Technology Co., Ltd.
 *
 * This is an auto-generated file.
 * This file may have been hand-edited. Look for HAND-EDIT comments
 * before re-generating it.
 */

#include "network1interface.h"

DCORE_USE_NAMESPACE
/*
 * Implementation of interface class __OrgDeepinDdeNetwork1Interface
 */

class __OrgDeepinDdeNetwork1InterfacePrivate
{
public:
   __OrgDeepinDdeNetwork1InterfacePrivate() = default;

    // begin member variables
    QString ActiveConnections;
    QString Connections;
    uint Connectivity;
    QString Devices;
    bool NetworkingEnabled;
    uint State;
    bool VpnEnabled;
    QString WirelessAccessPoints;

public:
    QMap<QString, QDBusPendingCallWatcher *> m_processingCalls;
    QMap<QString, QList<QVariant>> m_waittingCalls;
};

__OrgDeepinDdeNetwork1Interface::__OrgDeepinDdeNetwork1Interface(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
    : DDBusExtendedAbstractInterface(service, path, staticInterfaceName(), connection, parent)
    , d_ptr(new __OrgDeepinDdeNetwork1InterfacePrivate)
{
    connect(this, &__OrgDeepinDdeNetwork1Interface::propertyChanged, this, &__OrgDeepinDdeNetwork1Interface::onPropertyChanged);

}

__OrgDeepinDdeNetwork1Interface::~__OrgDeepinDdeNetwork1Interface()
{
    qDeleteAll(d_ptr->m_processingCalls.values());
    delete d_ptr;
}

void __OrgDeepinDdeNetwork1Interface::onPropertyChanged(const QString &propName, const QVariant &value)
{
    if (propName == QStringLiteral("ActiveConnections"))
    {
        const QString &ActiveConnections = qvariant_cast<QString>(value);
        if (d_ptr->ActiveConnections != ActiveConnections)
        {
            d_ptr->ActiveConnections = ActiveConnections;
            Q_EMIT ActiveConnectionsChanged(d_ptr->ActiveConnections);
        }
        return;
    }

    if (propName == QStringLiteral("Connections"))
    {
        const QString &Connections = qvariant_cast<QString>(value);
        if (d_ptr->Connections != Connections)
        {
            d_ptr->Connections = Connections;
            Q_EMIT ConnectionsChanged(d_ptr->Connections);
        }
        return;
    }

    if (propName == QStringLiteral("Connectivity"))
    {
        const uint &Connectivity = qvariant_cast<uint>(value);
        if (d_ptr->Connectivity != Connectivity)
        {
            d_ptr->Connectivity = Connectivity;
            Q_EMIT ConnectivityChanged(d_ptr->Connectivity);
        }
        return;
    }

    if (propName == QStringLiteral("Devices"))
    {
        const QString &Devices = qvariant_cast<QString>(value);
        if (d_ptr->Devices != Devices)
        {
            d_ptr->Devices = Devices;
            Q_EMIT DevicesChanged(d_ptr->Devices);
        }
        return;
    }

    if (propName == QStringLiteral("NetworkingEnabled"))
    {
        const bool &NetworkingEnabled = qvariant_cast<bool>(value);
        if (d_ptr->NetworkingEnabled != NetworkingEnabled)
        {
            d_ptr->NetworkingEnabled = NetworkingEnabled;
            Q_EMIT NetworkingEnabledChanged(d_ptr->NetworkingEnabled);
        }
        return;
    }

    if (propName == QStringLiteral("State"))
    {
        const uint &State = qvariant_cast<uint>(value);
        if (d_ptr->State != State)
        {
            d_ptr->State = State;
            Q_EMIT StateChanged(d_ptr->State);
        }
        return;
    }

    if (propName == QStringLiteral("VpnEnabled"))
    {
        const bool &VpnEnabled = qvariant_cast<bool>(value);
        if (d_ptr->VpnEnabled != VpnEnabled)
        {
            d_ptr->VpnEnabled = VpnEnabled;
            Q_EMIT VpnEnabledChanged(d_ptr->VpnEnabled);
        }
        return;
    }

    if (propName == QStringLiteral("WirelessAccessPoints"))
    {
        const QString &WirelessAccessPoints = qvariant_cast<QString>(value);
        if (d_ptr->WirelessAccessPoints != WirelessAccessPoints)
        {
            d_ptr->WirelessAccessPoints = WirelessAccessPoints;
            Q_EMIT WirelessAccessPointsChanged(d_ptr->WirelessAccessPoints);
        }
        return;
    }

    qWarning() << "property not handle: " << propName;
    return;
}

QString __OrgDeepinDdeNetwork1Interface::activeConnections()
{
    return qvariant_cast<QString>(internalPropGet("ActiveConnections", &d_ptr->ActiveConnections));
}

QString __OrgDeepinDdeNetwork1Interface::connections()
{
    return qvariant_cast<QString>(internalPropGet("Connections", &d_ptr->Connections));
}

uint __OrgDeepinDdeNetwork1Interface::connectivity()
{
    return qvariant_cast<uint>(internalPropGet("Connectivity", &d_ptr->Connectivity));
}

QString __OrgDeepinDdeNetwork1Interface::devices()
{
    return qvariant_cast<QString>(internalPropGet("Devices", &d_ptr->Devices));
}

bool __OrgDeepinDdeNetwork1Interface::networkingEnabled()
{
    return qvariant_cast<bool>(internalPropGet("NetworkingEnabled", &d_ptr->NetworkingEnabled));
}

void __OrgDeepinDdeNetwork1Interface::setNetworkingEnabled(bool value)
{

   internalPropSet("NetworkingEnabled", QVariant::fromValue(value), &d_ptr->NetworkingEnabled);
}

uint __OrgDeepinDdeNetwork1Interface::state()
{
    return qvariant_cast<uint>(internalPropGet("State", &d_ptr->State));
}

bool __OrgDeepinDdeNetwork1Interface::vpnEnabled()
{
    return qvariant_cast<bool>(internalPropGet("VpnEnabled", &d_ptr->VpnEnabled));
}

void __OrgDeepinDdeNetwork1Interface::setVpnEnabled(bool value)
{

   internalPropSet("VpnEnabled", QVariant::fromValue(value), &d_ptr->VpnEnabled);
}

QString __OrgDeepinDdeNetwork1Interface::wirelessAccessPoints()
{
    return qvariant_cast<QString>(internalPropGet("WirelessAccessPoints", &d_ptr->WirelessAccessPoints));
}

void __OrgDeepinDdeNetwork1Interface::CallQueued(const QString &callName, const QList<QVariant> &args)
{
    if (d_ptr->m_waittingCalls.contains(callName))
    {
        d_ptr->m_waittingCalls[callName] = args;
        return;
    }
    if (d_ptr->m_processingCalls.contains(callName))
    {
        d_ptr->m_waittingCalls.insert(callName, args);
    } else {
        QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(asyncCallWithArgumentList(callName, args));
        connect(watcher, &QDBusPendingCallWatcher::finished, this, &__OrgDeepinDdeNetwork1Interface::onPendingCallFinished);
        d_ptr->m_processingCalls.insert(callName, watcher);
    }
}

void __OrgDeepinDdeNetwork1Interface::onPendingCallFinished(QDBusPendingCallWatcher *w)
{
    w->deleteLater();
    const auto callName = d_ptr->m_processingCalls.key(w);
    Q_ASSERT(!callName.isEmpty());
    if (callName.isEmpty())
        return;
    d_ptr->m_processingCalls.remove(callName);
    if (!d_ptr->m_waittingCalls.contains(callName))
        return;
    const auto args = d_ptr->m_waittingCalls.take(callName);
    CallQueued(callName, args);
}

#include "moc_network1interface.cpp"
