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
qpcsccard_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 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 QPCSCCARD_P_H
5#define QPCSCCARD_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 "qpcsc_p.h"
19#include "qndefmessage.h"
20#include "qnearfieldtarget.h"
22
24
25class QTimer;
26
27class QPcscCard : public QObject
28{
30public:
31 QPcscCard(SCARDHANDLE handle, DWORD protocol, QObject *parent = nullptr);
32 ~QPcscCard();
33
34 bool isValid() const { return m_isValid; }
35 void invalidate();
36
37 bool checkCardPresent();
39
42
43 bool supportsNdef() const { return m_supportsNdef; }
44
45private:
46 SCARDHANDLE m_handle;
47 SCARD_IO_REQUEST m_ioPci;
48 bool m_isValid = true;
49 bool m_supportsNdef;
50 bool m_autodelete = false;
51 // Indicates that an _automatic_ transaction was started
52 bool m_inAutoTransaction = false;
53 QTimer *m_keepAliveTimer;
54
55 std::unique_ptr<QNdefAccessFsm> m_tagDetectionFsm;
56
57 enum AutoTransaction { NoAutoTransaction, StartAutoTransaction };
58
59 QPcsc::RawCommandResult sendCommand(const QByteArray &command, AutoTransaction autoTransaction);
60 void performNdefDetection();
61
62 class Transaction
63 {
64 public:
65 Transaction(QPcscCard *card);
66 ~Transaction();
67
68 private:
69 QPcscCard *m_card;
70 bool m_initiated = false;
71 };
72
73public Q_SLOTS:
75 void onTargetDestroyed();
77 const QByteArray &command);
80 const QList<QNdefMessage> &messages);
81
82private Q_SLOTS:
83 void onKeepAliveTimeout();
84
88
92};
93
95
96#endif // QPCSCCARD_P_H
\inmodule QtCore
Definition qbytearray.h:57
The QNdefMessage class provides an NFC NDEF message.
\inmodule QtNfc \inheaderfile QNearFieldTarget
Error
This enum describes the error codes that a near field target reports.
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
void onReadNdefMessagesRequest(const QNearFieldTarget::RequestId &request)
void onDisconnectRequest()
void requestCompleted(const QNearFieldTarget::RequestId &request, QNearFieldTarget::Error reason, const QVariant &result)
void disconnected()
bool supportsNdef() const
Definition qpcsccard_p.h:43
QByteArray readUid()
void invalidate()
QPcscCard(SCARDHANDLE handle, DWORD protocol, QObject *parent=nullptr)
Definition qpcsccard.cpp:70
bool isValid() const
Definition qpcsccard_p.h:34
void onTargetDestroyed()
bool checkCardPresent()
void onWriteNdefMessagesRequest(const QNearFieldTarget::RequestId &request, const QList< QNdefMessage > &messages)
void onSendCommandRequest(const QNearFieldTarget::RequestId &request, const QByteArray &command)
void ndefMessageRead(const QNdefMessage &message)
void invalidated()
int readMaxInputLength()
Q_INVOKABLE void enableAutodelete()
\inmodule QtCore
Definition qtimer.h:20
\inmodule QtCore
Definition qvariant.h:65
Combined button and popup list for selecting options.
GLuint64 GLenum void * handle
GLuint GLsizei const GLchar * message
GLuint64EXT * result
[6]
#define Q_OBJECT
#define Q_INVOKABLE
#define Q_SLOTS
#define Q_SIGNALS
QNetworkRequest request(url)