summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/bluez/gattcharacteristic1adaptor.cpp
blob: d6eb0a1c42addc16130cb4333ab2223596edeae7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
 * 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);
    }
}