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
66
67 class RequestIdPrivate;
68 class Q_NFC_EXPORT RequestId
69 {
70 public:
71 RequestId();
74 ~RequestId();
75
76 bool isValid() const;
77
78 int refCount() const;
79
80 bool operator<(const RequestId &other) const;
81 bool operator==(const RequestId &other) const;
82 bool operator!=(const RequestId &other) const;
83 RequestId &operator=(const RequestId &other);
84
85 QSharedDataPointer<RequestIdPrivate> d;
86 };
87
88 explicit QNearFieldTarget(QObject *parent = nullptr);
90
91 QByteArray uid() const;
92 Type type() const;
93 AccessMethods accessMethods() const;
94
95 bool disconnect();
96
97 // NdefAccess
98 bool hasNdefMessage();
99 RequestId readNdefMessages();
100 RequestId writeNdefMessages(const QList<QNdefMessage> &messages);
101
102 // TagTypeSpecificAccess
103 int maxCommandLength() const;
104 RequestId sendCommand(const QByteArray &command);
105
106 bool waitForRequestCompleted(const RequestId &id, int msecs = 5000);
107 QVariant requestResponse(const RequestId &id) const;
108
111
113
115
117
118protected:
119 QNearFieldTarget(QNearFieldTargetPrivate *backend, QObject *parent = nullptr);
120
121private:
123};
124
125Q_DECLARE_OPERATORS_FOR_FLAGS(QNearFieldTarget::AccessMethods)
126
128
130 Q_NFC_EXPORT)
131
132#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