1 | // Copyright (C) 2016 BlackBerry Limited, Copyright (C) 2016 BasysKom GmbH |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QNEARFIELDTARGET_NEARD_P_H |
5 | #define QNEARFIELDTARGET_NEARD_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <QDBusObjectPath> |
19 | #include <QDBusVariant> |
20 | |
21 | #include <qnearfieldtarget.h> |
22 | #include <qnearfieldtarget_p.h> |
23 | #include <qndefrecord.h> |
24 | #include <qndefmessage.h> |
25 | |
26 | #include "neard/neard_helper_p.h" |
27 | #include "properties_interface.h" |
28 | #include "objectmanager_interface.h" |
29 | #include "tag_interface.h" |
30 | |
31 | QT_BEGIN_NAMESPACE |
32 | |
33 | Q_DECLARE_LOGGING_CATEGORY(QT_NFC_NEARD) |
34 | |
35 | class QNearFieldTargetPrivateImpl : public QNearFieldTargetPrivate |
36 | { |
37 | public: |
38 | QNearFieldTargetPrivateImpl(QObject *parent, QDBusObjectPath interfacePath); |
39 | |
40 | ~QNearFieldTargetPrivateImpl(); |
41 | |
42 | bool isValid(); |
43 | QByteArray uid() const override; |
44 | |
45 | QNearFieldTarget::Type type() const override; |
46 | QNearFieldTarget::AccessMethods accessMethods() const override; |
47 | |
48 | bool hasNdefMessage() override; |
49 | QNearFieldTarget::RequestId readNdefMessages() override; |
50 | QNearFieldTarget::RequestId sendCommand(const QByteArray &command) override; |
51 | QNearFieldTarget::RequestId writeNdefMessages(const QList<QNdefMessage> &messages) override; |
52 | |
53 | private: |
54 | QNdefRecord readRecord(const QDBusObjectPath &path); |
55 | void handleRecordFound(const QDBusObjectPath &path); |
56 | void createNdefMessage(); |
57 | void handleReadError(); |
58 | void handleWriteRequest(); |
59 | |
60 | QDBusObjectPath m_tagPath; |
61 | OrgFreedesktopDBusPropertiesInterface *m_dbusProperties; |
62 | QList<QDBusObjectPath> m_recordPaths; |
63 | QTimer m_recordPathsCollectedTimer; |
64 | QTimer m_readErrorTimer; |
65 | QTimer m_delayedWriteTimer; |
66 | QNearFieldTarget::Type m_type; |
67 | bool m_readRequested; |
68 | QNearFieldTarget::RequestId m_currentReadRequestId; |
69 | QNearFieldTarget::RequestId m_currentWriteRequestId; |
70 | QVariantMap m_currentWriteRequestData; |
71 | }; |
72 | |
73 | QT_END_NAMESPACE |
74 | |
75 | #endif // QNEARFIELDTARGET_NEARD_P_H |
76 | |