Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

NFC, NearField and uuid



  • Hi, I need to get the uuid of the tag on signal "onTagFound".
    Can you suggest me the way? Up to now I can't find it.

        NearField {
            polling: true
            onTagFound: {
                console.log("TAG found !!")
            }
        }
    


  • I've never tried to work with NFC, but according to code you should listen onMessageRecordsChanged signal.



  • @IntruderExcluder Hi,

    The QML API doesn't seem providing a way for accessing this information. But you could use the C++ API which seems to provide it through QNearFIeldTarget::uid().

    See QNearFieldManager::targetDetected(QNearFieldTarget *target) and QNearFieldTarget



  • Perfect, now I can get the uuid of my mifare badge.
    Now my mifare badge has got some data stored in a particular secor. In order to read that sector I have to use a particular password.
    How can I pass to the component the number of the sector that I want to read and the sector password?

    Another problem. In order to use the nfc reader I use the lines of the code below:

        NearFieldManager= new QNearFieldManager(this);
        connect(NearFieldManager, SIGNAL(targetDetected(QNearFieldTarget*)), this, SLOT(targetDetected(QNearFieldTarget*)));
        NearFieldManager->startTargetDetection();
    

    and then

            NearFieldManager->stopTargetDetection();
            delete NearFieldManager;
    

    The nfc reader works only the first app start. After that I have to restart the mobile.



  • @mrdebug said in NFC, NearField and uuid:

    How can I pass to the component the number of the sector that I want to read and the sector password?
    Another problem. In order to use the nfc reader I use the lines of the code below:

    could it be possible that you create separate topics for these two issues?

    You're burying them in this topic related to getting the uuid from your NFC badge, which by the way seems solved.



  • In order to get the uid of the mifare badge readed by nfc reader these lines of codes are enough

     NearFieldManager= new QNearFieldManager(this);
        connect(NearFieldManager, SIGNAL(targetDetected(QNearFieldTarget*)), this, SLOT(targetDetected(QNearFieldTarget*)));
        NearFieldManager->startTargetDetection();
    
    
    void QCMainForm::targetDetected(QNearFieldTarget *target) {
        ...
        target->uid()
        ...
    }
    
    

Log in to reply