/*
 * This file was generated by qdbusxml2cpp version 0.8
 * Command line was: qdbusxml2cpp -a gattdescriptor1adaptor_p.h:gattdescriptor1adaptor.cpp -c OrgBluezGattDescriptor1Adaptor -i bluez5_helper_p.h org.bluez.GattDescriptor1.xml
 *
 * qdbusxml2cpp is Copyright (C) 2022 The Qt Company Ltd.
 *
 * This is an auto-generated file.
 * Do not edit! All changes made to it will be lost.
 */

#include "gattdescriptor1adaptor_p.h"
#include <QtCore/QMetaObject>
#include <QtCore/QByteArray>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QVariant>

/*
 * Implementation of adaptor class OrgBluezGattDescriptor1Adaptor
 */

OrgBluezGattDescriptor1Adaptor::OrgBluezGattDescriptor1Adaptor(QObject *parent)
    : QDBusAbstractAdaptor(parent)
{
    // constructor
    setAutoRelaySignals(true);
}

OrgBluezGattDescriptor1Adaptor::~OrgBluezGattDescriptor1Adaptor()
{
    // destructor
}

QDBusObjectPath OrgBluezGattDescriptor1Adaptor::characteristic() const
{
    // get the value of property Characteristic
    return qvariant_cast< QDBusObjectPath >(parent()->property("Characteristic"));
}

QString OrgBluezGattDescriptor1Adaptor::uUID() const
{
    // get the value of property UUID
    return qvariant_cast< QString >(parent()->property("UUID"));
}

QByteArray OrgBluezGattDescriptor1Adaptor::value() const
{
    // get the value of property Value
    return qvariant_cast< QByteArray >(parent()->property("Value"));
}

QByteArray OrgBluezGattDescriptor1Adaptor::ReadValue(const QVariantMap &options,
                                                     const QDBusMessage& msg)
{
    // handle method call org.bluez.GattDescriptor1.ReadValue
    QByteArray value;
    QString error;
    QMetaObject::invokeMethod(parent(), "ReadValue", Q_RETURN_ARG(QByteArray, value),
                              Q_ARG(QVariantMap, options), Q_ARG(QString&, error));
    if (!error.isEmpty()) {
        // Reply with error if needed
        auto reply = msg.createErrorReply(error, {});
        QDBusConnection::systemBus().send(reply);
    }
    return value;
}

void OrgBluezGattDescriptor1Adaptor::WriteValue(const QByteArray &value,
                                                const QVariantMap &options,
                                                const QDBusMessage& msg)
{
    // handle method call org.bluez.GattDescriptor1.WriteValue
    QString error;
    QMetaObject::invokeMethod(parent(), "WriteValue", Q_RETURN_ARG(QString, error),
                              Q_ARG(QByteArray, value), Q_ARG(QVariantMap, options));

    if (!error.isEmpty()) {
        // Reply with error if needed
        auto reply = msg.createErrorReply(error, {});
        QDBusConnection::systemBus().send(reply);
    }
}
