[Interest] NFC issues
Jason H
jhihn at gmx.com
Mon Feb 4 21:27:50 CET 2019
So I have a fre issues with NFC.
1. a tag I wrote, it's just got text on it. I'm using the annotatedurl example as a base.
I've removed the filter so I can see every tag.
The problem is, 50% of the time it does not work, at least right away. I present the tag and sometimes the app gets the text. The other times, it goes to the default NFC handler. If I then close the default NFC handler, it will read the tag. If I wait a while (indeterminate amount of time) it will "just work" as it should. Has anyone seen this before?
The extent of my code change (aside from debug statements) is:
//int result = manager->registerNdefMessageHandler(filter, this, SLOT(handleMessage(QNdefMessage,QNearFieldTarget*)));
int result = manager->registerNdefMessageHandler(this, SLOT(handleMessage(QNdefMessage,QNearFieldTarget*)));
I think the issue the adapter might not be ready, which brings me to the next issue:
2. I'm also having problems connecting to adapterStateChange:
connect(manager, SIGNAL(adapterStateChanged(QNearFieldManager::AdapterState)), this, SLOT(handleStateChange(QNearFieldManager::AdapterState)));
pubic slots:
void handleStateChange(QNearFieldManager::AdapterState state);
void AnnotatedUrl::handleStateChange(QNearFieldManager::AdapterState state) {
qDebug() << "*********************************";
qDebug() << Q_FUNC_INFO << state;
qDebug() << "*********************************";
}
I get, depending on the variant of the connect syntax I try:
libannotatedurl.so: QObject::connect: Incompatible sender/receiver arguments
W libannotatedurl.so: QNearFieldManager::adapterStateChanged(AdapterState) --> AnnotatedUrl::handleStateChange(QNearFieldManager::AdapterState)
(was connect(manager, SIGNAL(adapterStateChanged(AdapterState)), this, SLOT(handleStateChange(QNearFieldManager::AdapterState)));)
or
W libannotatedurl.so: QObject::connect: No such signal QNearFieldManager::adapterStateChanged(QNearFieldManager::AdapterState) in annotatedurl.cpp:107
(was connect(manager, SIGNAL(adapterStateChanged(QNearFieldManager::AdapterState)), this, SLOT(handleStateChange(QNearFieldManager::AdapterState)));)
or
W libannotatedurl.so: QObject::connect: No such slot AnnotatedUrl::handleStateChange(AdapterState) in annotatedurl.cpp:107
(was connect(manager, SIGNAL(adapterStateChanged(AdapterState)), this, SLOT(handleStateChange(AdapterState)));)
In the .h for it, it is declared as:
/* in class Q_NFC_EXPORT QNearFieldManager : public QObject */
Q_SIGNALS:
void adapterStateChanged(AdapterState state);
What is the proper connection syntax?
More information about the Interest
mailing list