NFC QML



  • Hello I would just like to know if there is a way to use QML to create a communication between two phones. So basically one phone is to be used as a tag and the other as reader and then vice versa. Please if anyone can show a clear example on how to use the new Qt Mobility 1.2.1 NFC QML elements as seen on this link:
    http://doc.qt.nokia.com/qtmobility-1.2/connectivity-api.html#nfc

    Thank you in advance.



  • It is an example how to connect two devices by NFC.

    @ import QtQuick 1.0
    import QtMobility.connectivity 1.2

    Item {
    id: root

     property BluetoothService bluetoothService
     property bool available : false
    
     NearFieldSocket {
         id: socket
    
         uri: "urn:nfc:sn:com.nokia.qtmobility.tennis"
         connected: true
    
         function parse(s) {
             var args = s.split(" ");
             if (args.length == 2) {
                 bluetoothService.deviceAddress = args[0];
                 bluetoothService.servicePort = args[1];
                 root.bluetoothServiceChanged();
             }
         }
    
         onDataAvailable: parse(socket.stringData)
    
         onStateChanged: {
             if (state == "Connecting") {
                 available = true;
             }
         }
     }
    

    }
    @
    It is in Tennis QML example.
    I hope it is heplfull for you.
    Best.
    Fernando Moreno



  • This example I saw but I want to know what are the important things to have to make sure the connection is working or that it will work no matter what


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.