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
qpcscslot.cpp
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#include "qpcscslot_p.h"
5#include "qpcscmanager_p.h"
6#include "qpcsccard_p.h"
7#include <QtCore/QLoggingCategory>
8
10
12
17
19{
20 qCDebug(QT_NFC_PCSC) << Q_FUNC_INFO << this;
21 if (m_insertedCard)
22 m_insertedCard->invalidate();
23}
24
25void QPcscSlot::processStateChange(DWORD eventId, bool createCards)
26{
27 qCDebug(QT_NFC_PCSC) << Q_FUNC_INFO;
28
29 // Check if the currently inserted card is still valid
30 if (!m_insertedCard.isNull()) {
31 if (m_insertedCard->checkCardPresent())
32 return;
33 qCDebug(QT_NFC_PCSC) << "Removing card from slot" << m_name;
34 m_insertedCard->invalidate();
35 m_insertedCard.clear();
36 }
37
38 auto manager = qobject_cast<QPcscManager *>(parent());
39
40 if (manager != nullptr && createCards
41 && (eventId
42 & (SCARD_STATE_PRESENT | SCARD_STATE_MUTE | SCARD_STATE_UNPOWERED
43 | SCARD_STATE_EXCLUSIVE))
44 == SCARD_STATE_PRESENT) {
45 qCDebug(QT_NFC_PCSC) << "New card in slot" << m_name;
46
47 m_insertedCard = manager->connectToCard(this);
48 }
49}
50
52{
53 if (m_insertedCard)
54 m_insertedCard->invalidate();
55}
56
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
void invalidate()
bool checkCardPresent()
~QPcscSlot() override
Definition qpcscslot.cpp:18
void processStateChange(DWORD eventId, bool createCards)
Definition qpcscslot.cpp:25
void invalidateInsertedCard()
Definition qpcscslot.cpp:51
void clear() noexcept
Definition qpointer.h:87
bool isNull() const noexcept
Definition qpointer.h:84
Combined button and popup list for selecting options.
#define Q_FUNC_INFO
#define qCDebug(category,...)
#define Q_DECLARE_LOGGING_CATEGORY(name)
GLuint name
QNetworkAccessManager manager