summaryrefslogtreecommitdiffstats
path: root/src/nfc
diff options
context:
space:
mode:
Diffstat (limited to 'src/nfc')
-rw-r--r--src/nfc/doc/qtnfc.qdocconf1
-rw-r--r--src/nfc/qnearfieldmanager.h2
-rw-r--r--src/nfc/qnearfieldmanager_emulator.cpp9
-rw-r--r--src/nfc/qnearfieldtagtype2.cpp7
-rw-r--r--src/nfc/qnearfieldtarget.cpp13
-rw-r--r--src/nfc/qnearfieldtarget_emulator.cpp7
-rw-r--r--src/nfc/qnearfieldtarget_emulator_p.h2
-rw-r--r--src/nfc/qqmlndefrecord.cpp5
8 files changed, 24 insertions, 22 deletions
diff --git a/src/nfc/doc/qtnfc.qdocconf b/src/nfc/doc/qtnfc.qdocconf
index 61ed15b6..e4f10f0e 100644
--- a/src/nfc/doc/qtnfc.qdocconf
+++ b/src/nfc/doc/qtnfc.qdocconf
@@ -1,4 +1,5 @@
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
+include($QT_INSTALL_DOCS/config/exampleurl-qtconnectivity.qdocconf)
project = QtNfc
description = Qt NFC Reference Documentation
diff --git a/src/nfc/qnearfieldmanager.h b/src/nfc/qnearfieldmanager.h
index 500b9631..22506e7e 100644
--- a/src/nfc/qnearfieldmanager.h
+++ b/src/nfc/qnearfieldmanager.h
@@ -99,7 +99,7 @@ public:
bool unregisterNdefMessageHandler(int handlerId);
Q_SIGNALS:
- void adapterStateChanged(AdapterState state);
+ void adapterStateChanged(QNearFieldManager::AdapterState state);
void targetDetected(QNearFieldTarget *target);
void targetLost(QNearFieldTarget *target);
diff --git a/src/nfc/qnearfieldmanager_emulator.cpp b/src/nfc/qnearfieldmanager_emulator.cpp
index 8a61a3a9..4b5e5e0c 100644
--- a/src/nfc/qnearfieldmanager_emulator.cpp
+++ b/src/nfc/qnearfieldmanager_emulator.cpp
@@ -49,10 +49,11 @@ QT_BEGIN_NAMESPACE
QNearFieldManagerPrivateImpl::QNearFieldManagerPrivateImpl()
{
- globalTagActivator->initialize();
+ TagActivator *activator = TagActivator::instance();
+ activator->initialize();
- connect(globalTagActivator, &TagActivator::tagActivated, this, &QNearFieldManagerPrivateImpl::tagActivated);
- connect(globalTagActivator, &TagActivator::tagDeactivated, this, &QNearFieldManagerPrivateImpl::tagDeactivated);
+ connect(activator, &TagActivator::tagActivated, this, &QNearFieldManagerPrivateImpl::tagActivated);
+ connect(activator, &TagActivator::tagDeactivated, this, &QNearFieldManagerPrivateImpl::tagDeactivated);
}
QNearFieldManagerPrivateImpl::~QNearFieldManagerPrivateImpl()
@@ -66,7 +67,7 @@ bool QNearFieldManagerPrivateImpl::isAvailable() const
void QNearFieldManagerPrivateImpl::reset()
{
- globalTagActivator->reset();
+ TagActivator::instance()->reset();
}
void QNearFieldManagerPrivateImpl::tagActivated(TagBase *tag)
diff --git a/src/nfc/qnearfieldtagtype2.cpp b/src/nfc/qnearfieldtagtype2.cpp
index 24ff8280..492dc5e3 100644
--- a/src/nfc/qnearfieldtagtype2.cpp
+++ b/src/nfc/qnearfieldtagtype2.cpp
@@ -307,9 +307,7 @@ void QNearFieldTagType2::timerEvent(QTimerEvent *event)
killTimer(event->timerId());
- QMutableMapIterator<QNearFieldTarget::RequestId, SectorSelectState> i(d->m_pendingSectorSelectCommands);
- while (i.hasNext()) {
- i.next();
+ for (auto i = d->m_pendingSectorSelectCommands.begin(), end = d->m_pendingSectorSelectCommands.end(); i != end; ++i) {
SectorSelectState &state = i.value();
@@ -318,8 +316,7 @@ void QNearFieldTagType2::timerEvent(QTimerEvent *event)
setResponseForRequest(i.key(), true);
- i.remove();
-
+ d->m_pendingSectorSelectCommands.erase(i);
break;
}
}
diff --git a/src/nfc/qnearfieldtarget.cpp b/src/nfc/qnearfieldtarget.cpp
index e9a6fa11..7d83db78 100644
--- a/src/nfc/qnearfieldtarget.cpp
+++ b/src/nfc/qnearfieldtarget.cpp
@@ -47,7 +47,7 @@
#include <QtCore/QDebug>
-#include <QTime>
+#include <QElapsedTimer>
#include <QCoreApplication>
QT_BEGIN_NAMESPACE
@@ -462,7 +462,7 @@ bool QNearFieldTarget::waitForRequestCompleted(const RequestId &id, int msecs)
{
Q_D(QNearFieldTarget);
- QTime timer;
+ QElapsedTimer timer;
timer.start();
do {
@@ -497,13 +497,12 @@ void QNearFieldTarget::setResponseForRequest(const QNearFieldTarget::RequestId &
{
Q_D(QNearFieldTarget);
- QMutableMapIterator<RequestId, QVariant> i(d->m_decodedResponses);
- while (i.hasNext()) {
- i.next();
-
+ for (auto i = d->m_decodedResponses.begin(), end = d->m_decodedResponses.end(); i != end; /* erasing */) {
// no more external references
if (i.key().refCount() == 1)
- i.remove();
+ i = d->m_decodedResponses.erase(i);
+ else
+ ++i;
}
d->m_decodedResponses.insert(id, response);
diff --git a/src/nfc/qnearfieldtarget_emulator.cpp b/src/nfc/qnearfieldtarget_emulator.cpp
index 0723b655..aecd743e 100644
--- a/src/nfc/qnearfieldtarget_emulator.cpp
+++ b/src/nfc/qnearfieldtarget_emulator.cpp
@@ -52,6 +52,8 @@ QT_BEGIN_NAMESPACE
static QMutex tagMutex;
static QMap<TagBase *, bool> tagMap;
+Q_GLOBAL_STATIC(TagActivator, globalTagActivator);
+
TagType1::TagType1(TagBase *tag, QObject *parent)
: QNearFieldTagType1(parent), m_tag(tag)
{
@@ -247,6 +249,11 @@ void TagActivator::reset()
tagMap.clear();
}
+TagActivator *TagActivator::instance()
+{
+ return globalTagActivator();
+}
+
void TagActivator::timerEvent(QTimerEvent *e)
{
Q_UNUSED(e);
diff --git a/src/nfc/qnearfieldtarget_emulator_p.h b/src/nfc/qnearfieldtarget_emulator_p.h
index 1b9f7bdb..70a67be8 100644
--- a/src/nfc/qnearfieldtarget_emulator_p.h
+++ b/src/nfc/qnearfieldtarget_emulator_p.h
@@ -122,8 +122,6 @@ private:
int timerId;
};
-Q_GLOBAL_STATIC(TagActivator, globalTagActivator);
-
QT_END_NAMESPACE
#endif // QNEARFIELDTARGET_EMULATOR_P_H
diff --git a/src/nfc/qqmlndefrecord.cpp b/src/nfc/qqmlndefrecord.cpp
index bc3667fe..5a96bec8 100644
--- a/src/nfc/qqmlndefrecord.cpp
+++ b/src/nfc/qqmlndefrecord.cpp
@@ -215,10 +215,9 @@ QQmlNdefRecord *qNewDeclarativeNdefRecordForNdefRecord(const QNdefRecord &record
{
const QString urn = urnForRecordType(record.typeNameFormat(), record.type());
- QMapIterator<QString, const QMetaObject *> i(*registeredNdefRecordTypes());
- while (i.hasNext()) {
- i.next();
+ const auto *rt = registeredNdefRecordTypes();
+ for (auto i = rt->cbegin(), end = rt->cend(); i != end; ++i) {
QRegularExpression rx(QRegularExpression::anchoredPattern(i.key()));
if (!rx.match(urn).hasMatch())
continue;