Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qnearfieldtarget.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
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_H
5#define QNEARFIELDTARGET_H
6
7#include <QtCore/QByteArray>
8#include <QtCore/QList>
9#include <QtCore/QMetaType>
10#include <QtCore/QObject>
11#include <QtCore/QSharedDataPointer>
12#include <QtCore/QVariant>
13#include <QtNfc/qtnfcglobal.h>
14
16
17class QNdefMessage;
20
21class Q_NFC_EXPORT QNearFieldTarget : public QObject
22{
24
25 Q_DECLARE_PRIVATE(QNearFieldTarget)
27
28public:
40
42 UnknownAccess = 0x00,
43 NdefAccess = 0x01,
44 TagTypeSpecificAccess = 0x02,
45 AnyAccess = 0xff
46 };
47 Q_ENUM(AccessMethod)
48 Q_DECLARE_FLAGS(AccessMethods, AccessMethod)
49
65
66 class RequestIdPrivate;
67 class Q_NFC_EXPORT RequestId
68 {
69 public:
70 RequestId();
73 ~RequestId();
74
75 bool isValid() const;
76
77 int refCount() const;
78
79 bool operator<(const RequestId &other) const;
80 bool operator==(const RequestId &other) const;
81 bool operator!=(const RequestId &other) const;
82 RequestId &operator=(const RequestId &other);
83
84 QSharedDataPointer<RequestIdPrivate> d;
85 };
86
87 explicit QNearFieldTarget(QObject *parent = nullptr);
89
90 QByteArray uid() const;
91 Type type() const;
92 AccessMethods accessMethods() const;
93
94 bool disconnect();
95
96 // NdefAccess
97 bool hasNdefMessage();
98 RequestId readNdefMessages();
99 RequestId writeNdefMessages(const QList<QNdefMessage> &messages);
100
101 // TagTypeSpecificAccess
102 int maxCommandLength() const;
103 RequestId sendCommand(const QByteArray &command);
104
105 bool waitForRequestCompleted(const RequestId &id, int msecs = 5000);
106 QVariant requestResponse(const RequestId &id) const;
107
110
112
114
116
117protected:
118 QNearFieldTarget(QNearFieldTargetPrivate *backend, QObject *parent = nullptr);
119
120private:
122};
123
124Q_DECLARE_OPERATORS_FOR_FLAGS(QNearFieldTarget::AccessMethods)
125
127
129 Q_NFC_EXPORT)
130
131#endif // QNEARFIELDTARGET_H
\inmodule QtCore
Definition qbytearray.h:57
The QNdefMessage class provides an NFC NDEF message.
\inmodule QtNfc \inheaderfile QNearFieldTarget
QSharedDataPointer< RequestIdPrivate > d
The QNearFieldTarget class provides an interface for communicating with a target device.
void error(QNearFieldTarget::Error error, const QNearFieldTarget::RequestId &id)
This signal is emitted when an error occurs while processing request id.
void requestCompleted(const QNearFieldTarget::RequestId &id)
This signal is emitted when a request id completes.
void disconnected()
This signal is emitted when the near field target moves out of proximity.
void ndefMessageRead(const QNdefMessage &message)
This signal is emitted when a complete NDEF message has been read from the target.
AccessMethod
This enum describes the access methods a near field target supports.
Error
This enum describes the error codes that a near field target reports.
\inmodule QtCore
Definition qobject.h:103
\inmodule QtCore
Definition qvariant.h:65
Combined button and popup list for selecting options.
constexpr bool operator!=(const timespec &t1, const timespec &t2)
DBusConnection const char DBusError * error
#define Q_DECLARE_FLAGS(Flags, Enum)
Definition qflags.h:174
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
Definition qflags.h:194
#define QT_DECL_METATYPE_EXTERN_TAGGED(TYPE, TAG, EXPORT)
Definition qmetatype.h:1376
GLenum type
GLuint GLsizei const GLchar * message
GLfloat GLfloat p
[1]
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
Definition qrandom.cpp:1220
static bool operator<(const QSettingsIniKey &k1, const QSettingsIniKey &k2)
#define Q_ENUM(x)
#define Q_OBJECT
#define Q_SIGNALS
myObject disconnect()
[26]
QSharedPointer< T > other(t)
[5]
Definition moc.h:23