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 QNEARFIELDMANAGER_H
5#define QNEARFIELDMANAGER_H
6
7#include <QtCore/QObject>
8#include <QtNfc/qtnfcglobal.h>
9#include <QtNfc/QNearFieldTarget>
10#include <QtNfc/QNdefRecord>
11#include <QtNfc/QNdefFilter>
12
13QT_BEGIN_NAMESPACE
14
15class QNearFieldManagerPrivate;
16class Q_NFC_EXPORT QNearFieldManager : public QObject
17{
18 Q_OBJECT
19
20 Q_DECLARE_PRIVATE(QNearFieldManager)
21
22public:
23 enum class AdapterState {
24 Offline = 1,
25 TurningOn = 2,
26 Online = 3,
27 TurningOff = 4
28 };
29 Q_ENUM(AdapterState)
30
31 explicit QNearFieldManager(QObject *parent = nullptr);
32 explicit QNearFieldManager(QNearFieldManagerPrivate *backend, QObject *parent = nullptr);
33 ~QNearFieldManager();
34
35 bool isEnabled() const;
36 bool isSupported(QNearFieldTarget::AccessMethod accessMethod
37 = QNearFieldTarget::AnyAccess) const;
38
39 bool startTargetDetection(QNearFieldTarget::AccessMethod accessMethod);
40 void stopTargetDetection(const QString &errorMessage = QString());
41
42 void setUserInformation(const QString &message);
43
44Q_SIGNALS:
45 void adapterStateChanged(QNearFieldManager::AdapterState state);
46 void targetDetectionStopped();
47 void targetDetected(QNearFieldTarget *target);
48 void targetLost(QNearFieldTarget *target);
49
50private:
51 QNearFieldManagerPrivate *d_ptr;
52};
53
54QT_END_NAMESPACE
55
56#endif // QNEARFIELDMANAGER_H
57

source code of qtconnectivity/src/nfc/qnearfieldmanager.h