April 1, 2012

Milad90 Milad90
Lab Rat
1 posts

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.

2 replies

April 4, 2012

kahon kahon
Lab Rat
14 posts

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

  1.  import QtQuick 1.0
  2.  import QtMobility.connectivity 1.2
  3.  
  4.  Item {
  5.      id: root
  6.  
  7.      property BluetoothService bluetoothService
  8.      property bool available : false
  9.  
  10.      NearFieldSocket {
  11.          id: socket
  12.  
  13.          uri: "urn:nfc:sn:com.nokia.qtmobility.tennis"
  14.          connected: true
  15.  
  16.          function parse(s) {
  17.              var args = s.split(" ");
  18.              if (args.length == 2) {
  19.                  bluetoothService.deviceAddress = args[0];
  20.                  bluetoothService.servicePort = args[1];
  21.                  root.bluetoothServiceChanged();
  22.              }
  23.          }
  24.  
  25.          onDataAvailable: parse(socket.stringData)
  26.  
  27.          onStateChanged: {
  28.              if (state == "Connecting") {
  29.                  available = true;
  30.              }
  31.          }
  32.      }
  33.  }

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

April 4, 2012

Milad90 Milad90
Lab Rat
1 posts

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

 
  ‹‹ height and width of the image with unknow sizes      [solved]Does qt quick support s60v5 phones? ››

You must log in to post a reply. Not a member yet? Register here!