/*
 * This file was generated by qdbusxml2cpp version 0.8
 * Command line was: qdbusxml2cpp -a gattcharacteristic1adaptor_p.h:gattcharacteristic1adaptor.cpp -c OrgBluezGattCharacteristic1Adaptor -i bluez5_helper_p.h org.bluez.GattCharacteristic1.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 "gattcharacteristic1adaptor_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 OrgBluezGattCharacteristic1Adaptor
 */

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

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

QStringList OrgBluezGattCharacteristic1Adaptor::flags() const
{
    // get the value of property Flags
    return qvariant_cast< QStringList >(parent()->property("Flags"));
}

bool OrgBluezGattCharacteristic1Adaptor::notifying() const
{
    // get the value of property Notifying
    return qvariant_cast< bool >(parent()->property("Notifying"));
}

QDBusObjectPath OrgBluezGattCharacteristic1Adaptor::service() const
{
    // get the value of property Service
    return qvariant_cast< QDBusObjectPath >(parent()->property("Service"));
}

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

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

QByteArray OrgBluezGattCharacteristic1Adaptor::ReadValue(const QVariantMap &options,
                                                         const QDBusMessage& msg)
{
    // handle method call org.bluez.GattCharacteristic1.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 OrgBluezGattCharacteristic1Adaptor::StartNotify()
{
    // handle method call org.bluez.GattCharacteristic1.StartNotify
    QMetaObject::invokeMethod(parent(), "StartNotify");
}

void OrgBluezGattCharacteristic1Adaptor::StopNotify()
{
    // handle method call org.bluez.GattCharacteristic1.StopNotify
    QMetaObject::invokeMethod(parent(), "StopNotify");
}

void OrgBluezGattCharacteristic1Adaptor::WriteValue(const QByteArray &value,
                                                    const QVariantMap &options,
                                                    const QDBusMessage& msg)
{
    // handle method call org.bluez.GattCharacteristic1.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);
    }
}
