Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    NFC QML

    QML and Qt Quick
    2
    3
    2222
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Milad90 last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • K
        kahon last edited by

        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

        1 Reply Last reply Reply Quote 0
        • M
          Milad90 last edited by

          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

          1 Reply Last reply Reply Quote 0
          • First post
            Last post