Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
9
QT_BEGIN_NAMESPACE
10
11
Q_DECLARE_LOGGING_CATEGORY(QT_NFC_PCSC)
12
13
QPcscSlot::QPcscSlot(
const
QPcscSlotName &name, QPcscManager *manager)
14
: QObject(manager), m_name(name)
15
{
16
}
17
18
QPcscSlot
::~
QPcscSlot
()
19
{
20
qCDebug(QT_NFC_PCSC) << Q_FUNC_INFO <<
this
;
21
if
(m_insertedCard)
22
m_insertedCard->invalidate();
23
}
24
25
void
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
51
void
QPcscSlot
::
invalidateInsertedCard
()
52
{
53
if
(m_insertedCard)
54
m_insertedCard->invalidate();
55
}
56
57
QT_END_NAMESPACE
QPcscManager
Definition
qpcscmanager_p.h:28
QPcscSlot
Definition
qpcscslot_p.h:28
QPcscSlot::~QPcscSlot
~QPcscSlot() override
Definition
qpcscslot.cpp:18
QPcscSlot::processStateChange
void processStateChange(DWORD eventId, bool createCards)
Definition
qpcscslot.cpp:25
QPcscSlot::invalidateInsertedCard
void invalidateInsertedCard()
Definition
qpcscslot.cpp:51
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtconnectivity
src
nfc
pcsc
qpcscslot.cpp
Generated on
for Qt by
1.18.0