summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@digia.com>2013-10-22 11:37:08 +0200
committerAlex Blasche <alexander.blasche@digia.com>2013-10-22 11:39:44 +0200
commitb00388ea1448cfd977c54f53d038d1a270562d53 (patch)
treec6097a3d9ce61d0da5e2a5a4e977250aa5e376ed /examples
parent672413c65685883136f4572d34f7d08f7b952641 (diff)
parent782a09be7c89352b27083bca7ee5b032d9e56ca6 (diff)
Merge branch 'stable' into dev
Diffstat (limited to 'examples')
-rw-r--r--examples/bluetooth/btchat/chat.cpp50
-rw-r--r--examples/bluetooth/btchat/chat.h6
-rw-r--r--examples/bluetooth/btchat/chat.ui26
-rw-r--r--examples/bluetooth/btchat/chatclient.cpp2
-rw-r--r--examples/bluetooth/btchat/chatserver.cpp23
-rw-r--r--examples/bluetooth/btchat/chatserver.h3
-rw-r--r--examples/bluetooth/btchat/doc/src/btchat.qdoc82
-rw-r--r--examples/bluetooth/btchat/remoteselector.cpp20
-rw-r--r--examples/bluetooth/btchat/remoteselector.h2
-rw-r--r--examples/bluetooth/scanner/scanner.qml9
-rw-r--r--examples/nfc/annotatedurl/doc/src/annotatedurl.qdoc4
-rw-r--r--examples/nfc/poster/doc/src/poster.qdoc4
-rw-r--r--examples/nfc/poster/poster.qml6
13 files changed, 158 insertions, 79 deletions
diff --git a/examples/bluetooth/btchat/chat.cpp b/examples/bluetooth/btchat/chat.cpp
index 37bfb85c..f3df7aa1 100644
--- a/examples/bluetooth/btchat/chat.cpp
+++ b/examples/bluetooth/btchat/chat.cpp
@@ -56,7 +56,7 @@
static const QLatin1String serviceUuid("e8e10f95-1a70-4b27-9ccf-02010264e9c8");
Chat::Chat(QWidget *parent)
-: QDialog(parent), ui(new Ui_Chat)
+ : QDialog(parent), currentAdapterIndex(0), ui(new Ui_Chat)
{
//! [Construct UI]
ui->setupUi(this);
@@ -66,6 +66,22 @@ Chat::Chat(QWidget *parent)
connect(ui->sendButton, SIGNAL(clicked()), this, SLOT(sendClicked()));
//! [Construct UI]
+ localAdapters = QBluetoothLocalDevice::allDevices();
+ if (localAdapters.count() < 2) {
+ ui->localAdapterBox->setVisible(false);
+ } else {
+ //we ignore more than two adapters
+ ui->localAdapterBox->setVisible(true);
+ ui->firstAdapter->setText(tr("Default (%1)", "%1 = Bluetooth address").
+ arg(localAdapters.at(0).address().toString()));
+ ui->secondAdapter->setText(localAdapters.at(1).address().toString());
+ ui->firstAdapter->setChecked(true);
+ connect(ui->firstAdapter, SIGNAL(clicked()), this, SLOT(newAdapterSelected()));
+ connect(ui->secondAdapter, SIGNAL(clicked()), this, SLOT(newAdapterSelected()));
+ QBluetoothLocalDevice adapter(localAdapters.at(0).address());
+ adapter.setHostMode(QBluetoothLocalDevice::HostDiscoverable);
+ }
+
//! [Create Chat Server]
server = new ChatServer(this);
connect(server, SIGNAL(clientConnected(QString)), this, SLOT(clientConnected(QString)));
@@ -104,6 +120,32 @@ void Chat::connected(const QString &name)
{
ui->chat->insertPlainText(QString::fromLatin1("Joined chat with %1.\n").arg(name));
}
+
+void Chat::newAdapterSelected()
+{
+ const int newAdapterIndex = adapterFromUserSelection();
+ if (currentAdapterIndex != newAdapterIndex) {
+ server->stopServer();
+ currentAdapterIndex = newAdapterIndex;
+ const QBluetoothHostInfo info = localAdapters.at(currentAdapterIndex);
+ QBluetoothLocalDevice adapter(info.address());
+ adapter.setHostMode(QBluetoothLocalDevice::HostDiscoverable);
+ server->startServer(info.address());
+ localName = info.name();
+ }
+}
+
+int Chat::adapterFromUserSelection() const
+{
+ int result = 0;
+ QBluetoothAddress newAdapter = localAdapters.at(0).address();
+
+ if (ui->secondAdapter->isChecked()) {
+ newAdapter = localAdapters.at(1).address();
+ result = 1;
+ }
+ return result;
+}
//! [connected]
//! [clientDisconnected]
@@ -123,7 +165,11 @@ void Chat::connectClicked()
ui->connectButton->setEnabled(false);
// scan for services
- RemoteSelector remoteSelector;
+ const QBluetoothAddress adapter = localAdapters.isEmpty() ?
+ QBluetoothAddress() :
+ localAdapters.at(currentAdapterIndex).address();
+
+ RemoteSelector remoteSelector(adapter);
remoteSelector.startDiscovery(QBluetoothUuid(serviceUuid));
if (remoteSelector.exec() == QDialog::Accepted) {
QBluetoothServiceInfo service = remoteSelector.service();
diff --git a/examples/bluetooth/btchat/chat.h b/examples/bluetooth/btchat/chat.h
index fed850f1..75d7669f 100644
--- a/examples/bluetooth/btchat/chat.h
+++ b/examples/bluetooth/btchat/chat.h
@@ -44,6 +44,7 @@
#include <qbluetoothserviceinfo.h>
#include <qbluetoothsocket.h>
+#include <qbluetoothhostinfo.h>
#include <QDebug>
@@ -75,11 +76,16 @@ private slots:
void clientDisconnected();
void connected(const QString &name);
+ void newAdapterSelected();
+
private:
+ int adapterFromUserSelection() const;
+ int currentAdapterIndex;
Ui_Chat *ui;
ChatServer *server;
QList<ChatClient *> clients;
+ QList<QBluetoothHostInfo> localAdapters;
QString localName;
};
diff --git a/examples/bluetooth/btchat/chat.ui b/examples/bluetooth/btchat/chat.ui
index acebc937..d7829294 100644
--- a/examples/bluetooth/btchat/chat.ui
+++ b/examples/bluetooth/btchat/chat.ui
@@ -15,6 +15,32 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
+ <widget class="QGroupBox" name="localAdapterBox">
+ <property name="title">
+ <string>Local Bluetooth Adapter</string>
+ </property>
+ <property name="checkable">
+ <bool>false</bool>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QRadioButton" name="firstAdapter">
+ <property name="text">
+ <string>Default</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="secondAdapter">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
<widget class="QTextEdit" name="chat">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
diff --git a/examples/bluetooth/btchat/chatclient.cpp b/examples/bluetooth/btchat/chatclient.cpp
index b6ba7c52..06930145 100644
--- a/examples/bluetooth/btchat/chatclient.cpp
+++ b/examples/bluetooth/btchat/chatclient.cpp
@@ -62,7 +62,7 @@ void ChatClient::startClient(const QBluetoothServiceInfo &remoteService)
socket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol);
qDebug() << "Create socket";
socket->connectToService(remoteService);
- qDebug() << "ConnecttoService done";
+ qDebug() << "ConnectToService done";
connect(socket, SIGNAL(readyRead()), this, SLOT(readSocket()));
connect(socket, SIGNAL(connected()), this, SLOT(connected()));
diff --git a/examples/bluetooth/btchat/chatserver.cpp b/examples/bluetooth/btchat/chatserver.cpp
index 863078fc..0b29b87b 100644
--- a/examples/bluetooth/btchat/chatserver.cpp
+++ b/examples/bluetooth/btchat/chatserver.cpp
@@ -42,6 +42,7 @@
#include <qbluetoothserver.h>
#include <qbluetoothsocket.h>
+#include <qbluetoothlocaldevice.h>
//! [Service UUID]
static const QLatin1String serviceUuid("e8e10f95-1a70-4b27-9ccf-02010264e9c8");
@@ -57,7 +58,7 @@ ChatServer::~ChatServer()
stopServer();
}
-void ChatServer::startServer()
+void ChatServer::startServer(const QBluetoothAddress& localAdapter)
{
if (rfcommServer)
return;
@@ -65,14 +66,23 @@ void ChatServer::startServer()
//! [Create the server]
rfcommServer = new QBluetoothServer(QBluetoothServiceInfo::RfcommProtocol, this);
connect(rfcommServer, SIGNAL(newConnection()), this, SLOT(clientConnected()));
- rfcommServer->listen();
+ bool result = rfcommServer->listen(localAdapter);
+ if (!result) {
+ qWarning() << "Cannot bind chat server to" << localAdapter.toString();
+ return;
+ }
//! [Create the server]
- serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceRecordHandle, (uint)0x00010010);
+ //serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceRecordHandle, (uint)0x00010010);
//! [Class Uuuid must contain at least 1 entry]
QBluetoothServiceInfo::Sequence classId;
- classId << QVariant::fromValue(QBluetoothUuid(serviceUuid));
+
+ classId << QVariant::fromValue(QBluetoothUuid(QBluetoothUuid::SerialPort));
+ serviceInfo.setAttribute(QBluetoothServiceInfo::BluetoothProfileDescriptorList,
+ classId);
+
+ classId.prepend(QVariant::fromValue(QBluetoothUuid(serviceUuid)));
serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceClassIds, classId);
//! [Class Uuuid must contain at least 1 entry]
@@ -81,7 +91,7 @@ void ChatServer::startServer()
serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceName, tr("Bt Chat Server"));
serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceDescription,
tr("Example bluetooth chat server"));
- serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceProvider, tr("Nokia, QtDF"));
+ serviceInfo.setAttribute(QBluetoothServiceInfo::ServiceProvider, tr("qt-project.org"));
//! [Service name, description and provider]
//! [Service UUID set]
@@ -107,7 +117,7 @@ void ChatServer::startServer()
//! [Protocol descriptor list]
//! [Register service]
- serviceInfo.registerService();
+ serviceInfo.registerService(localAdapter);
//! [Register service]
}
@@ -146,7 +156,6 @@ void ChatServer::clientConnected()
connect(socket, SIGNAL(readyRead()), this, SLOT(readSocket()));
connect(socket, SIGNAL(disconnected()), this, SLOT(clientDisconnected()));
clientSockets.append(socket);
-
emit clientConnected(socket->peerName());
}
//! [clientConnected]
diff --git a/examples/bluetooth/btchat/chatserver.h b/examples/bluetooth/btchat/chatserver.h
index 2a3c3503..8af21f55 100644
--- a/examples/bluetooth/btchat/chatserver.h
+++ b/examples/bluetooth/btchat/chatserver.h
@@ -42,6 +42,7 @@
#define CHATSERVER_H
#include <qbluetoothserviceinfo.h>
+#include <qbluetoothaddress.h>
#include <QtCore/QObject>
#include <QtCore/QList>
@@ -60,7 +61,7 @@ public:
explicit ChatServer(QObject *parent = 0);
~ChatServer();
- void startServer();
+ void startServer(const QBluetoothAddress &localAdapter = QBluetoothAddress());
void stopServer();
public slots:
diff --git a/examples/bluetooth/btchat/doc/src/btchat.qdoc b/examples/bluetooth/btchat/doc/src/btchat.qdoc
index 6f1f040d..77f73fd1 100644
--- a/examples/bluetooth/btchat/doc/src/btchat.qdoc
+++ b/examples/bluetooth/btchat/doc/src/btchat.qdoc
@@ -34,36 +34,36 @@
\image btchat-example.png
- The Bluetooth Chat example implements a simple chat program between multiple parties. The
+ The Bluetooth Chat example implements a simple chat program between multiple parties. The
application always acts as both a server and a client eliminating the need to determine who
should connect to whom.
\section1 Chat Server
- The chat server is implemented by the ChatServer class. The ChatServer class is declared as:
+ The chat server is implemented by the ChatServer class. The ChatServer class is declared as:
\snippet btchat/chatserver.h declaration
The first thing the chat server needs to do is create an instance of QRfcommServer to listen
- for incoming Bluetooth connections. Our clientConnected() slot will be called whenever a new
+ for incoming Bluetooth connections. Our clientConnected() slot will be called whenever a new
connection is created.
\snippet btchat/chatserver.cpp Create the server
- The chat server is only useful if others know that it is there. To enable other devices to
- discover it a record describing the service needs to be published in the systems SDP (Service
- Discovery Protocol) database. The QBluetoothServiceInfo class encapsulates a service record.
+ The chat server is only useful if others know that it is there. To enable other devices to
+ discover it, a record describing the service needs to be published in the systems SDP (Service
+ Discovery Protocol) database. The QBluetoothServiceInfo class encapsulates a service record.
We will publish a service record that contains some textural descriptions of the services, a
- UUID that uniquely identifies the service, the discoverability attribute and connection
+ UUID that uniquely identifies the service, the discoverability attribute, and connection
parameters.
- The textural description of the service is stored in the ServiceName, ServiceDescription and
+ The textural description of the service is stored in the ServiceName, ServiceDescription, and
ServiceProvider attributes.
\snippet btchat/chatserver.cpp Service name, description and provider
- Bluetooth uses UUIDs as unique identifiers. Our chat service is uses a randomly generated
+ Bluetooth uses UUIDs as unique identifiers. The chat service uses a randomly generated
UUID.
\snippet btchat/chatserver.cpp Service UUID
@@ -74,78 +74,78 @@
\snippet btchat/chatserver.cpp Service Discoverability
The ProtocolDescriptorList attribute is used to publish the connection parameters that the
- remote device requires to connect to our service. Here we specify that the Rfcomm protocol is
- used and set the port number to port that our rfcommServer instance is listening to.
+ remote device requires to connect to our service. Here we specify that the Rfcomm protocol is
+ used and set the port number to the port that our rfcommServer instance is listening to.
\snippet btchat/chatserver.cpp Protocol descriptor list
- Finally we register the service record with the system.
+ Finally, we register the service record with the system.
\snippet btchat/chatserver.cpp Register service
- As mentioned earlier incoming connections are handled in the clientConnected() slot. In this
- slot we get a pointer a QBluetoothSocket representing the next pending connection connect up
- slots to the readyRead() and disconnected() signals and emit a signal to notify others that a
- new client has connected.
+
+ As mentioned earlier, incoming connections are handled in the clientConnected() slot where
+ pending connections are connected to the readyRead() and disconnected() signals. The signals
+ notify others that a new client has connected.
\snippet btchat/chatserver.cpp clientConnected
- The readSocket() slot is called whenever data is ready to be read from a client socket. The
- slot reads individual lines from the socket converts them from UTF-8 and emits the
+ The readSocket() slot is called whenever data is ready to be read from a client socket. The
+ slot reads individual lines from the socket, converts them from UTF-8, and emits the
messageReceived() signal.
\snippet btchat/chatserver.cpp readSocket
- The clientDisconnected() slot is called whenever a client disconnects from the service. The
- slot emits a signal to notify others that a client has disconnected and deletes the socket.
+ The clientDisconnected() slot is called whenever a client disconnects from the service. The
+ slot emits a signal to notify others that a client has disconnected, and deletes the socket.
\snippet btchat/chatserver.cpp clientDisconnected
- The sendMessage() slot is used to send a message to all connected clients. The message is
+ The sendMessage() slot is used to send a message to all connected clients. The message is
converted into UTF-8 and appended with a newline before being sent to all clients.
\snippet btchat/chatserver.cpp sendMessage
- When the chat server is stop the service record is removed from the system SDP database, all
- connected client sockets are deleted and the QRfcommServer instance is deleted.
+ When the chat server is stopped the service record is removed from the system SDP database, all
+ connected client sockets are deleted, and the QRfcommServer instance is deleted.
\snippet btchat/chatserver.cpp stopServer
\section1 Chat Client
- The chat client is implemented by the ChatClient class. The ChatClient class is declared as:
+ The chat client is implemented by the ChatClient class. The ChatClient class is declared as:
\snippet btchat/chatclient.h declaration
The client creates a new QBluetoothSocket and connects to the remote service described by the
- \e remoteService parameter. Slots are connected to the sockets readyRead(), connected() and
+ \e remoteService parameter. Slots are connected to the sockets readyRead(), connected() and
disconnected() signals.
\snippet btchat/chatclient.cpp startClient
- On sucessfull socket connection we emit a signal to notify other.
+ On successful socket connection we emit a signal to notify others.
\snippet btchat/chatclient.cpp connected
- Similarily to the chat server the readSocket() slot is called when data is available from the
- socket. Lines are read individually and converted from UTF-8. The messageReceived() signal
+ Similarly to the chat server, the readSocket() slot is called when data is available from the
+ socket. Lines are read individually and converted from UTF-8. The messageReceived() signal
is emitted.
\snippet btchat/chatclient.cpp readSocket
- The sendMessage() slot is used to send a message to the remote device. The message is
- converted to UTF-8 and a newline appended.
+ The sendMessage() slot is used to send a message to the remote device. The message is
+ converted to UTF-8 and a newline is appended.
\snippet btchat/chatclient.cpp sendMessage
- To disconnect from the remote chat service the QBluetoothSocket instance is deleted.
+ To disconnect from the remote chat service, the QBluetoothSocket instance is deleted.
\snippet btchat/chatclient.cpp stopClient
\section1 Chat Dialog
- The main window of this example is the chat dialog, implemented in the Chat class. This class
- displays a chat session between a single ChatServer and zero or more ChatClients. The Chat
+ The main window of this example is the chat dialog, implemented in the Chat class. This class
+ displays a chat session between a single ChatServer and zero or more ChatClients. The Chat
class is declared as:
\snippet btchat/chat.h declaration
@@ -155,27 +155,27 @@
\snippet btchat/chat.cpp Construct UI
We create an instance of the ChatServer and respond to its clientConnected(),
- clientDiconnected() and messageReceived() signals.
+ clientDiconnected(), and messageReceived() signals.
\snippet btchat/chat.cpp Create Chat Server
- In response to the clientConnected() and clientDisconnected() signals of the ChatServer we
- display the typical "foo has joined chat." and "foo has left." messages in the chat session.
+ In response to the clientConnected() and clientDisconnected() signals of the ChatServer, we
+ display the typical "X has joined chat." and "Y has left." messages in the chat session.
\snippet btchat/chat.cpp clientConnected clientDisconnected
Incoming messages from clients connected to the ChatServer are handled in the showMessage()
- slot. The message text tagged with the remote device name is displayed in the chat session.
+ slot. The message text tagged with the remote device name is displayed in the chat session.
\snippet btchat/chat.cpp showMessage
- In response to the connect button being clicked the application starts service discovery and
- presents a list of discovered chat services on remote devices. A ChatClient for the service
- selected by the user.
+ In response to the connect button being clicked, the application starts service discovery and
+ presents a list of discovered chat services on remote devices. A ChatClient for the service
+ is selected by the user.
\snippet btchat/chat.cpp Connect to remote service
- In reponse to connected() signals from ChatClient we display the a "Joined chat with foo."
+ In reponse to the connected() signals from ChatClient, we display the a "Joined chat with X."
message in the chat session.
\snippet btchat/chat.cpp connected
diff --git a/examples/bluetooth/btchat/remoteselector.cpp b/examples/bluetooth/btchat/remoteselector.cpp
index f660a815..e6fd728f 100644
--- a/examples/bluetooth/btchat/remoteselector.cpp
+++ b/examples/bluetooth/btchat/remoteselector.cpp
@@ -47,29 +47,17 @@
QT_USE_NAMESPACE
-RemoteSelector::RemoteSelector(QWidget *parent)
+RemoteSelector::RemoteSelector(const QBluetoothAddress &localAdapter, QWidget *parent)
: QDialog(parent), ui(new Ui::RemoteSelector)
{
ui->setupUi(this);
- //Using default Bluetooth adapter
- QBluetoothLocalDevice localDevice;
- QBluetoothAddress adapterAddress = localDevice.address();
-
- /*
- * In case of multiple Bluetooth adapters it is possible to
- * set which adapter will be used by providing MAC Address.
- * Example code:
- *
- * QBluetoothAddress adapterAddress("XX:XX:XX:XX:XX:XX");
- * m_discoveryAgent = new QBluetoothServiceDiscoveryAgent(adapterAddress);
- */
-
- m_discoveryAgent = new QBluetoothServiceDiscoveryAgent(adapterAddress);
+ m_discoveryAgent = new QBluetoothServiceDiscoveryAgent(localAdapter);
connect(m_discoveryAgent, SIGNAL(serviceDiscovered(QBluetoothServiceInfo)),
this, SLOT(serviceDiscovered(QBluetoothServiceInfo)));
connect(m_discoveryAgent, SIGNAL(finished()), this, SLOT(discoveryFinished()));
+ connect(m_discoveryAgent, SIGNAL(canceled()), this, SLOT(discoveryFinished()));
}
RemoteSelector::~RemoteSelector()
@@ -80,6 +68,7 @@ RemoteSelector::~RemoteSelector()
void RemoteSelector::startDiscovery(const QBluetoothUuid &uuid)
{
+ ui->status->setText(tr("Scanning..."));
if (m_discoveryAgent->isActive())
m_discoveryAgent->stop();
@@ -88,7 +77,6 @@ void RemoteSelector::startDiscovery(const QBluetoothUuid &uuid)
m_discoveryAgent->setUuidFilter(uuid);
m_discoveryAgent->start();
- ui->status->setText(tr("Scanning..."));
}
void RemoteSelector::stopDiscovery()
diff --git a/examples/bluetooth/btchat/remoteselector.h b/examples/bluetooth/btchat/remoteselector.h
index 3f6e15c9..5b123127 100644
--- a/examples/bluetooth/btchat/remoteselector.h
+++ b/examples/bluetooth/btchat/remoteselector.h
@@ -63,7 +63,7 @@ class RemoteSelector : public QDialog
Q_OBJECT
public:
- explicit RemoteSelector(QWidget *parent = 0);
+ explicit RemoteSelector(const QBluetoothAddress &localAdapter, QWidget *parent = 0);
~RemoteSelector();
void startDiscovery(const QBluetoothUuid &uuid);
diff --git a/examples/bluetooth/scanner/scanner.qml b/examples/bluetooth/scanner/scanner.qml
index 52182362..48b2ee53 100644
--- a/examples/bluetooth/scanner/scanner.qml
+++ b/examples/bluetooth/scanner/scanner.qml
@@ -40,7 +40,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtBluetooth 5.0
+import QtBluetooth 5.2
Item {
id: top
@@ -52,7 +52,8 @@ Item {
running: true
discoveryMode: BluetoothDiscoveryModel.DeviceDiscovery
onDiscoveryModeChanged: console.log("Discovery mode: " + discoveryMode)
- onNewServiceDiscovered: console.log("Found new service " + service.deviceAddress + " " + service.deviceName + " " + service.serviceName);
+ onServiceDiscovered: console.log("Found new service " + service.deviceAddress + " " + service.deviceName + " " + service.serviceName);
+ onDeviceDiscovered: console.log("New device: " + device)
}
Rectangle {
@@ -86,6 +87,9 @@ Item {
width: top.width
anchors.top: busy.bottom
anchors.bottom: buttonGroup.top
+ anchors.bottomMargin: 10
+ anchors.topMargin: 10
+ clip: true
model: btModel
delegate: Rectangle {
@@ -128,7 +132,6 @@ Item {
if (s.serviceName) { str += "<br>Service: " + s.serviceName; }
if (s.serviceDescription) { str += "<br>Description: " + s.serviceDescription; }
if (s.serviceProtocol) { str += "<br>Protocol: " + s.serviceProtocol; }
- if (s.servicePort) { str += "<br>Port: " + s.servicePort; }
return str;
}
}
diff --git a/examples/nfc/annotatedurl/doc/src/annotatedurl.qdoc b/examples/nfc/annotatedurl/doc/src/annotatedurl.qdoc
index 157b3e17..2a84c8b3 100644
--- a/examples/nfc/annotatedurl/doc/src/annotatedurl.qdoc
+++ b/examples/nfc/annotatedurl/doc/src/annotatedurl.qdoc
@@ -29,8 +29,8 @@
\example annotatedurl
\title Annotated URL Example
-The Annotated URL example displays the contents of specifically formated NDEF messages read from
-an NFC Tag. The NDEF message should contain a URI record, an optional image/* MIME record and one
+The Annotated URL example displays the contents of specifically formatted NDEF messages read from
+an NFC Tag. The NDEF message should contain a URI record, an optional image/* MIME record, and one
or more localized Text records.
\image annotatedurl.png
diff --git a/examples/nfc/poster/doc/src/poster.qdoc b/examples/nfc/poster/doc/src/poster.qdoc
index 8d0317c9..125afd95 100644
--- a/examples/nfc/poster/doc/src/poster.qdoc
+++ b/examples/nfc/poster/doc/src/poster.qdoc
@@ -29,8 +29,8 @@
\example poster
\title QML Poster Example
-The QML Poster example displays the contents of specifically formated NDEF messages read from an
-NFC Tag. The NDEF message should contain a URI record, an optional image/* MIME record and one
+The QML Poster example displays the contents of specifically formatted NDEF messages read from an
+NFC Tag. The NDEF message should contain a URI record, an optional image/* MIME record, and one
or more localized Text records.
\image qml-poster-example.png
diff --git a/examples/nfc/poster/poster.qml b/examples/nfc/poster/poster.qml
index 058f8e4f..c50c702b 100644
--- a/examples/nfc/poster/poster.qml
+++ b/examples/nfc/poster/poster.qml
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtNfc 5.0
+import QtNfc 5.2
Rectangle {
id: root
@@ -50,8 +50,8 @@ Rectangle {
id: nearfield
filter: [
- NdefFilter { type: "urn:nfc:wkt:U"; minimum: 1; maximum: 1 },
- NdefFilter { type: "urn:nfc:wkt:T"; minimum: 1 }
+ NdefFilter { type: "U"; typeNameFormat: NearFiledRecord.NfcRtd; minimum: 1; maximum: 1 },
+ NdefFilter { type: "T"; typeNameFormat: NearFiledRecord.NfcRtd; minimum: 1 }
]
onMessageRecordsChanged: {