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
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
You must log in to post a reply. Not a member yet? Register here!
