summaryrefslogtreecommitdiffstats
path: root/src/nfc
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@digia.com>2014-02-17 10:38:48 +0100
committerAlex Blasche <alexander.blasche@digia.com>2014-02-17 10:38:48 +0100
commit8fe7fbe6b552b0d196967cfea85fede5e7c211b9 (patch)
treeb90f246cc3b8847cedaf6b5f8dc045cfc563b9be /src/nfc
parent9bcb79f0c741f7805dad17c467a5c2041227a18a (diff)
parentb4bde05d8459cc57c25bac3f7be19fcf03908606 (diff)
Merge branch 'dev' into btle
Conflicts: examples/bluetooth/bluetooth.pro src/bluetooth/doc/src/examples.qdoc src/bluetooth/qbluetoothdevicediscoveryagent_qnx.cpp src/bluetooth/qbluetoothservicediscoveryagent_bluez.cpp src/bluetooth/qbluetoothservicediscoveryagent_p.h src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp Change-Id: Ie1577e4b0f469cd5a6b05a61cbe94f180a64448d
Diffstat (limited to 'src/nfc')
-rw-r--r--src/nfc/doc/qtnfc.qdocconf2
-rw-r--r--src/nfc/doc/src/examples.qdoc3
-rw-r--r--src/nfc/doc/src/nfc-index.qdoc1
-rw-r--r--src/nfc/nfc.pro53
-rw-r--r--src/nfc/qllcpserver_p.cpp2
-rw-r--r--src/nfc/qllcpsocket.cpp2
-rw-r--r--src/nfc/qllcpsocket_p.cpp2
-rw-r--r--src/nfc/qnearfieldmanager_qnx.cpp10
-rw-r--r--src/nfc/qnearfieldsharemanager.cpp186
-rw-r--r--src/nfc/qnearfieldsharemanager.h106
-rw-r--r--src/nfc/qnearfieldsharemanager_p.h82
-rw-r--r--src/nfc/qnearfieldsharemanager_qnx_p.cpp151
-rw-r--r--src/nfc/qnearfieldsharemanager_qnx_p.h83
-rw-r--r--src/nfc/qnearfieldsharemanagerimpl_p.cpp60
-rw-r--r--src/nfc/qnearfieldsharemanagerimpl_p.h60
-rw-r--r--src/nfc/qnearfieldsharetarget.cpp151
-rw-r--r--src/nfc/qnearfieldsharetarget.h86
-rw-r--r--src/nfc/qnearfieldsharetarget_p.h99
-rw-r--r--src/nfc/qnearfieldsharetarget_qnx_p.cpp120
-rw-r--r--src/nfc/qnearfieldsharetarget_qnx_p.h85
-rw-r--r--src/nfc/qnearfieldsharetargetimpl_p.cpp55
-rw-r--r--src/nfc/qnearfieldsharetargetimpl_p.h59
-rw-r--r--src/nfc/qnx/qnxnfcmanager.cpp4
-rw-r--r--src/nfc/qnx/qnxnfcsharemanager_p.cpp280
-rw-r--r--src/nfc/qnx/qnxnfcsharemanager_p.h90
-rw-r--r--src/nfc/qqmlndefrecord.cpp1
26 files changed, 1814 insertions, 19 deletions
diff --git a/src/nfc/doc/qtnfc.qdocconf b/src/nfc/doc/qtnfc.qdocconf
index e136ddf7..2d5b0ef5 100644
--- a/src/nfc/doc/qtnfc.qdocconf
+++ b/src/nfc/doc/qtnfc.qdocconf
@@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtNfc
description = Qt NFC Reference Documentation
-url = http://qt-project.org/doc/qt-$QT_VER/qtnfc
+url = http://qt-project.org/doc/qt-$QT_VER
version = $QT_VERSION
examplesinstallpath = nfc
diff --git a/src/nfc/doc/src/examples.qdoc b/src/nfc/doc/src/examples.qdoc
index 64cc0982..9bdbd880 100644
--- a/src/nfc/doc/src/examples.qdoc
+++ b/src/nfc/doc/src/examples.qdoc
@@ -55,6 +55,9 @@ in their own documentation, but they are also accessible from here.
\li Example
\li Description
\row
+ \li \l{corkboard} {CorkBoard}
+ \li Displays NDEF text tags on a corkboard.
+ \row
\li \l{poster}{QML Poster}
\li Displays URLs stored on NFC Forum Tags.
\endtable
diff --git a/src/nfc/doc/src/nfc-index.qdoc b/src/nfc/doc/src/nfc-index.qdoc
index 7309e4cc..2ec40891 100644
--- a/src/nfc/doc/src/nfc-index.qdoc
+++ b/src/nfc/doc/src/nfc-index.qdoc
@@ -67,6 +67,7 @@ import statement in your \c .qml file:
\list
\li QML
\list
+ \li \l {corkboard}{CorkBoard}
\li \l {poster}{QML Poster}
\endlist
\li C++
diff --git a/src/nfc/nfc.pro b/src/nfc/nfc.pro
index dfa1d3ef..7b88d4f0 100644
--- a/src/nfc/nfc.pro
+++ b/src/nfc/nfc.pro
@@ -16,7 +16,9 @@ PUBLIC_HEADERS += \
qndeffilter.h \
qndefnfcurirecord.h \
qqmlndefrecord.h \
- qndefnfcsmartposterrecord.h
+ qndefnfcsmartposterrecord.h \
+ qnearfieldsharemanager.h \
+ qnearfieldsharetarget.h
PRIVATE_HEADERS += \
qllcpsocket_p.h \
@@ -29,7 +31,9 @@ PRIVATE_HEADERS += \
qnearfieldtagtype3_p.h \
qnearfieldtagtype4_p.h \
qtlv_p.h \
- qndefnfcsmartposterrecord_p.h
+ qndefnfcsmartposterrecord_p.h \
+ qnearfieldsharemanager_p.h \
+ qnearfieldsharetarget_p.h
SOURCES += \
qnearfieldmanager.cpp \
@@ -47,9 +51,11 @@ SOURCES += \
qtlv.cpp \
qllcpserver.cpp \
qqmlndefrecord.cpp \
- qndefnfcsmartposterrecord.cpp
+ qndefnfcsmartposterrecord.cpp \
+ qnearfieldsharemanager.cpp \
+ qnearfieldsharetarget.cpp
-qnx {
+CONFIG(blackberry) {
NFC_BACKEND_AVAILABLE = yes
DEFINES += QNX_NFC #QQNXNFC_DEBUG
@@ -69,6 +75,28 @@ qnx {
qnearfieldmanager_qnx.cpp \
qnx/qnxnfcmanager.cpp \
qnx/qnxnfceventfilter.cpp
+
+ config_libbb2 {
+ SOURCES += \
+ qnearfieldsharemanager_qnx_p.cpp \
+ qnearfieldsharetarget_qnx_p.cpp \
+ qnx/qnxnfcsharemanager_p.cpp
+
+ PRIVATE_HEADERS += \
+ qnearfieldsharemanager_qnx_p.h \
+ qnearfieldsharetarget_qnx_p.h \
+ qnx/qnxnfcsharemanager_p.h
+
+ LIBS += -l:libbbsystem.so.2
+ } else {
+ SOURCES += \
+ qnearfieldsharemanagerimpl_p.cpp \
+ qnearfieldsharetargetimpl_p.cpp
+
+ PRIVATE_HEADERS += \
+ qnearfieldsharemanagerimpl_p.h \
+ qnearfieldsharetargetimpl_p.h
+ }
}
simulator {
@@ -80,13 +108,18 @@ simulator {
qnearfieldmanagervirtualbase_p.h \
qnearfieldmanager_simulator_p.h \
qllcpsocket_simulator_p.h \
- qllcpserver_simulator_p.h
+ qllcpserver_simulator_p.h \
+ qnearfieldsharemanagerimpl_p.h \
+ qnearfieldsharetargetimpl_p.h
+
SOURCES += \
qnearfieldmanagervirtualbase.cpp \
qnearfieldmanager_simulator.cpp \
qllcpsocket_simulator_p.cpp \
- qllcpserver_simulator_p.cpp
+ qllcpserver_simulator_p.cpp \
+ qnearfieldsharemanagerimpl_p.cpp \
+ qnearfieldsharetargetimpl_p.cpp
}
isEmpty(NFC_BACKEND_AVAILABLE) {
@@ -95,12 +128,16 @@ isEmpty(NFC_BACKEND_AVAILABLE) {
PRIVATE_HEADERS += \
qllcpsocket_p_p.h \
qllcpserver_p_p.h \
- qnearfieldmanagerimpl_p.h
+ qnearfieldmanagerimpl_p.h \
+ qnearfieldsharemanagerimpl_p.h \
+ qnearfieldsharetargetimpl_p.h
SOURCES += \
qllcpsocket_p.cpp \
qllcpserver_p.cpp \
- qnearfieldmanagerimpl_p.cpp
+ qnearfieldmanagerimpl_p.cpp \
+ qnearfieldsharemanagerimpl_p.cpp \
+ qnearfieldsharetargetimpl_p.cpp
}
HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS
diff --git a/src/nfc/qllcpserver_p.cpp b/src/nfc/qllcpserver_p.cpp
index 55d2a866..c22c868a 100644
--- a/src/nfc/qllcpserver_p.cpp
+++ b/src/nfc/qllcpserver_p.cpp
@@ -49,7 +49,7 @@ QLlcpServerPrivate::QLlcpServerPrivate(QLlcpServer *q)
}
QLlcpServerPrivate::~QLlcpServerPrivate()
-{
+{
}
bool QLlcpServerPrivate::listen(const QString &serviceUri)
diff --git a/src/nfc/qllcpsocket.cpp b/src/nfc/qllcpsocket.cpp
index 2bf3e2c3..79cb1284 100644
--- a/src/nfc/qllcpsocket.cpp
+++ b/src/nfc/qllcpsocket.cpp
@@ -231,7 +231,7 @@ qint64 QLlcpSocket::writeDatagram(const char *data, qint64 size)
*/
bool QLlcpSocket::isSequential() const
{
- return true;
+ return true;
}
/*!
diff --git a/src/nfc/qllcpsocket_p.cpp b/src/nfc/qllcpsocket_p.cpp
index 4d076b9c..b1af336f 100644
--- a/src/nfc/qllcpsocket_p.cpp
+++ b/src/nfc/qllcpsocket_p.cpp
@@ -50,7 +50,7 @@ QLlcpSocketPrivate::QLlcpSocketPrivate(QLlcpSocket *q)
QLlcpSocketPrivate::~QLlcpSocketPrivate()
{
-
+
}
void QLlcpSocketPrivate::connectToService(QNearFieldTarget *target, const QString &serviceUri)
diff --git a/src/nfc/qnearfieldmanager_qnx.cpp b/src/nfc/qnearfieldmanager_qnx.cpp
index e405ecc0..b09a6ed4 100644
--- a/src/nfc/qnearfieldmanager_qnx.cpp
+++ b/src/nfc/qnearfieldmanager_qnx.cpp
@@ -52,7 +52,7 @@ QNearFieldManagerPrivateImpl::QNearFieldManagerPrivateImpl() :
m_handlerID(0)
{
QNXNFCManager::instance()->registerForNewInstance();
- connect(QNXNFCManager::instance(), SIGNAL(ndefMessage(const QNdefMessage&, QNearFieldTarget *)), this, SLOT(handleMessage(const QNdefMessage&, QNearFieldTarget *)));
+ connect(QNXNFCManager::instance(), SIGNAL(ndefMessage(QNdefMessage,QNearFieldTarget*)), this, SLOT(handleMessage(QNdefMessage,QNearFieldTarget*)));
m_requestedModes = QNearFieldManager::NdefWriteTargetAccess;
qQNXNFCDebug() << "Nearfieldmanager created";
@@ -74,8 +74,8 @@ bool QNearFieldManagerPrivateImpl::startTargetDetection()
{
qQNXNFCDebug() << "Starting targetdetection in nearfieldmanager";
if (QNXNFCManager::instance()->startTargetDetection()) {
- connect(QNXNFCManager::instance(), SIGNAL(targetDetected(QNearFieldTarget *, const QList<QNdefMessage>&)),
- this, SLOT(newTarget(QNearFieldTarget *, const QList<QNdefMessage>&)));
+ connect(QNXNFCManager::instance(), SIGNAL(targetDetected(QNearFieldTarget*,QList<QNdefMessage>)),
+ this, SLOT(newTarget(QNearFieldTarget*,QList<QNdefMessage>)));
return true;
} else {
qWarning()<<Q_FUNC_INFO<<"Could not start Target detection";
@@ -85,8 +85,8 @@ bool QNearFieldManagerPrivateImpl::startTargetDetection()
void QNearFieldManagerPrivateImpl::stopTargetDetection()
{
- disconnect(QNXNFCManager::instance(), SIGNAL(targetDetected(NearFieldTarget *, const QList<QNdefMessage> &)),
- this, SLOT(newTarget(NearFieldTarget *, const QList<QNdefMessage> &)));
+ disconnect(QNXNFCManager::instance(), SIGNAL(targetDetected(NearFieldTarget*,QList<QNdefMessage>)),
+ this, SLOT(newTarget(NearFieldTarget*,QList<QNdefMessage>)));
QNXNFCManager::instance()->unregisterTargetDetection(this);
}
diff --git a/src/nfc/qnearfieldsharemanager.cpp b/src/nfc/qnearfieldsharemanager.cpp
new file mode 100644
index 00000000..b3e736b6
--- /dev/null
+++ b/src/nfc/qnearfieldsharemanager.cpp
@@ -0,0 +1,186 @@
+/***************************************************************************
+ **
+ ** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+ ** Contact: http://www.qt-project.org/legal
+ **
+ ** This file is part of the QtNfc module of the Qt Toolkit.
+ **
+ ** $QT_BEGIN_LICENSE:LGPL$
+ ** Commercial License Usage
+ ** Licensees holding valid commercial Qt licenses may use this file in
+ ** accordance with the commercial license agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
+ ** use the contact form at http://qt.digia.com/contact-us.
+ **
+ ** GNU Lesser General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
+ ** General Public License version 2.1 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.LGPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU Lesser General Public License version 2.1 requirements
+ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ **
+ ** In addition, as a special exception, Digia gives you certain additional
+ ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+ **
+ ** GNU General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU
+ ** General Public License version 3.0 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.GPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU General Public License version 3.0 requirements will be
+ ** met: http://www.gnu.org/copyleft/gpl.html.
+ **
+ **
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#include "qnearfieldsharemanager.h"
+#include "qnearfieldsharemanager_p.h"
+
+#if defined(QNX_NFC)
+#include "qnearfieldsharemanager_qnx_p.h"
+#else
+#include "qnearfieldsharemanagerimpl_p.h"
+#endif
+
+#include "qnearfieldsharetarget.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QNearFieldShareManager
+ \brief The QNearFieldShareManager class manages all interactions related to sharing files and data over NFC.
+
+ \ingroup connectivity-nfc
+ \inmodule QtNfc
+
+ Applications can share NDEF data or file content using NFC technology by tapping two NFC-enabled devices
+ together. The QNearFieldShareManager provides a high level entry point to access this functionality.
+
+ The class allows both NDEF data and/or files to be shared between two devices by calling the setShareModes()
+ method. This method specifies either an NDEF Data and/or a File transfer. The targetDetected() signal is emitted
+ each time a share target is detected. A QNearFieldShareTarget pointer is passed with the signal, which can
+ be used to share either an NDEF message or one or more files.
+
+ The process of sharing files via NFC involves other underlying communication transports such as Bluetooth or Wi-Fi Direct.
+ It is implementation specific how and what type of transports are used to perform file transfer. The overall time taken to
+ transfer content depends on the maximum speed of the transport used. Note that the process of sharing NDEF message/data
+ does not require the use of other transports outside NFC.
+
+ If an error occurs, shareError() returns the error type.
+
+ Platforms that do not support both NDEF data and file content sharing modes can return the supported subset in the
+ supportedShareModes() method. Applications that call setShareModes() with an unsupported mode will receive an error
+ signal with a UnsupportedShareModeError.
+
+ Since sharing data over NFC is effectively a data pipe between two processes (one on the sender and one of
+ the receiver), the application developer should only create a single instance of QNearFieldShareManager per
+ application. This avoids the possibility that different parts of the same application attempt to all consume
+ data transferred over NFC.
+*/
+
+/*!
+ \enum QNearFieldShareManager::ShareError
+
+ This enum specifies the share error type.
+
+ \value NoError No error.
+ \value UnknownError Unknown or internal error occurred.
+ \value InvalidShareContentError Invalid content was provided for sharing.
+ \value ShareCanceledError Data or file sharing is canceled on the local or remote device.
+ \value ShareInterruptedError Data or file sharing is interrupted due to an I/O error.
+ \value ShareRejectedError Data or file sharing is rejected by the remote device.
+ \value UnsupportedShareModeError Data or file sharing is not supported by the share target.
+ \value ShareAlreadyInProgressError Data or file sharing is already in progress.
+ \value SharePermissionDeniedError File sharing is denied due to insufficient permission.
+*/
+
+/*!
+ \enum QNearFieldShareManager::ShareMode
+
+ This enum specifies the content type to be shared.
+
+ \value NoShare No content is currently set to be shared.
+ \value NdefShare Share NDEF message with target.
+ \value FileShare Share file with target.
+*/
+
+/*!
+ \fn void QNearFieldShareManager::targetDetected(QNearFieldShareTarget* shareTarget)
+
+ This signal is emitted whenever a \a shareTarget is detected. The \a shareTarget
+ instance is owned by QNearFieldShareManager and must not be deleted by the application.
+*/
+
+/*!
+ \fn void QNearFieldShareManager::shareModesChanged(ShareModes modes)
+
+ This signal is emitted whenever the share \a modes are changed.
+*/
+
+/*!
+ \fn void QNearFieldShareManager::error(ShareError error)
+
+ This signal is emitted whenever an \a error occurs related to a share request.
+*/
+
+/*!
+ Constructs a new near field share manager with \a parent.
+*/
+QNearFieldShareManager::QNearFieldShareManager(QObject *parent)
+: QObject(parent), d_ptr(new QNearFieldShareManagerPrivateImpl(this))
+{
+}
+
+/*!
+ Destroys the near field share manager.
+*/
+QNearFieldShareManager::~QNearFieldShareManager()
+{
+}
+
+/*!
+ Initializes the NFC share \a mode to detect a QNearFieldShareTarget for data and/or file sharing.
+ Calls to this method will overwrite previous share modes.
+
+ A shareModesChanged() signal will be emitted when share modes are different from previous modes.
+ A targetDetected() signal will be emitted if a share target is detected.
+*/
+void QNearFieldShareManager::setShareModes(ShareModes mode)
+{
+ Q_D(QNearFieldShareManager);
+ return d->setShareModes(mode);
+}
+
+/*!
+ Returns the shared modes supported by NFC.
+*/
+QNearFieldShareManager::ShareModes QNearFieldShareManager::supportedShareModes()
+{
+ return QNearFieldShareManagerPrivateImpl::supportedShareModes();
+}
+
+/*!
+ Returns which shared modes are set.
+*/
+QNearFieldShareManager::ShareModes QNearFieldShareManager::shareModes() const
+{
+ Q_D(const QNearFieldShareManager);
+ return d->shareModes();
+}
+
+/*!
+ Returns the error code of the error that occurred.
+ */
+QNearFieldShareManager::ShareError QNearFieldShareManager::shareError() const
+{
+ Q_D(const QNearFieldShareManager);
+ return d->shareError();
+}
+
+QT_END_NAMESPACE
diff --git a/src/nfc/qnearfieldsharemanager.h b/src/nfc/qnearfieldsharemanager.h
new file mode 100644
index 00000000..00879d24
--- /dev/null
+++ b/src/nfc/qnearfieldsharemanager.h
@@ -0,0 +1,106 @@
+/***************************************************************************
+ **
+ ** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+ ** Contact: http://www.qt-project.org/legal
+ **
+ ** This file is part of the QtNfc module of the Qt Toolkit.
+ **
+ ** $QT_BEGIN_LICENSE:LGPL$
+ ** Commercial License Usage
+ ** Licensees holding valid commercial Qt licenses may use this file in
+ ** accordance with the commercial license agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
+ ** use the contact form at http://qt.digia.com/contact-us.
+ **
+ ** GNU Lesser General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
+ ** General Public License version 2.1 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.LGPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU Lesser General Public License version 2.1 requirements
+ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ **
+ ** In addition, as a special exception, Digia gives you certain additional
+ ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+ **
+ ** GNU General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU
+ ** General Public License version 3.0 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.GPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU General Public License version 3.0 requirements will be
+ ** met: http://www.gnu.org/copyleft/gpl.html.
+ **
+ **
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#ifndef QNEARFIELDSHAREMANAGER_H
+#define QNEARFIELDSHAREMANAGER_H
+
+#include <QtCore/QObject>
+#include <QtNfc/qnfcglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+class QNearFieldShareManagerPrivate;
+class QNearFieldShareTarget;
+
+class Q_NFC_EXPORT QNearFieldShareManager : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(ShareError)
+ Q_ENUMS(ShareMode)
+
+public:
+ explicit QNearFieldShareManager(QObject *parent = 0);
+ ~QNearFieldShareManager();
+
+ enum ShareError {
+ NoError,
+ UnknownError,
+ InvalidShareContentError,
+ ShareCanceledError,
+ ShareInterruptedError,
+ ShareRejectedError,
+ UnsupportedShareModeError,
+ ShareAlreadyInProgressError,
+ SharePermissionDeniedError
+ };
+
+ enum ShareMode {
+ NoShare = 0x00,
+ NdefShare = 0x01,
+ FileShare = 0x02
+ };
+ Q_DECLARE_FLAGS(ShareModes, ShareMode)
+
+public:
+ static QNearFieldShareManager::ShareModes supportedShareModes();
+ void setShareModes(ShareModes modes);
+ QNearFieldShareManager::ShareModes shareModes() const;
+ QNearFieldShareManager::ShareError shareError() const;
+
+Q_SIGNALS:
+ void targetDetected(QNearFieldShareTarget* shareTarget);
+ void shareModesChanged(QNearFieldShareManager::ShareModes modes);
+ void error(QNearFieldShareManager::ShareError error);
+
+private:
+ QScopedPointer<QNearFieldShareManagerPrivate> const d_ptr;
+ Q_DECLARE_PRIVATE(QNearFieldShareManager)
+ Q_DISABLE_COPY(QNearFieldShareManager)
+
+ friend class QNearFieldShareManagerPrivateImpl;
+ friend class QNearFieldShareTargetPrivateImpl;
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QNearFieldShareManager::ShareModes)
+
+QT_END_NAMESPACE
+
+#endif /* QNEARFIELDSHAREMANAGER_H */
diff --git a/src/nfc/qnearfieldsharemanager_p.h b/src/nfc/qnearfieldsharemanager_p.h
new file mode 100644
index 00000000..42e3adfe
--- /dev/null
+++ b/src/nfc/qnearfieldsharemanager_p.h
@@ -0,0 +1,82 @@
+/***************************************************************************
+ **
+ ** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+ ** Contact: http://www.qt-project.org/legal
+ **
+ ** This file is part of the QtNfc module of the Qt Toolkit.
+ **
+ ** $QT_BEGIN_LICENSE:LGPL$
+ ** Commercial License Usage
+ ** Licensees holding valid commercial Qt licenses may use this file in
+ ** accordance with the commercial license agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
+ ** use the contact form at http://qt.digia.com/contact-us.
+ **
+ ** GNU Lesser General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
+ ** General Public License version 2.1 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.LGPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU Lesser General Public License version 2.1 requirements
+ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ **
+ ** In addition, as a special exception, Digia gives you certain additional
+ ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+ **
+ ** GNU General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU
+ ** General Public License version 3.0 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.GPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU General Public License version 3.0 requirements will be
+ ** met: http://www.gnu.org/copyleft/gpl.html.
+ **
+ **
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#ifndef QNEARFIELDSHAREMANAGER_P_H_
+#define QNEARFIELDSHAREMANAGER_P_H_
+
+#include "qnearfieldsharemanager.h"
+#include <QtCore/QObject>
+
+QT_BEGIN_NAMESPACE
+
+class QNearFieldShareManagerPrivate : public QObject
+{
+ Q_OBJECT
+
+public:
+ QNearFieldShareManagerPrivate(QNearFieldShareManager* q)
+ : QObject(q)
+ {
+ }
+
+ ~QNearFieldShareManagerPrivate()
+ {
+ }
+
+ virtual void setShareModes(QNearFieldShareManager::ShareModes modes)
+ {
+ Q_UNUSED(modes)
+ }
+
+ virtual QNearFieldShareManager::ShareModes shareModes() const
+ {
+ return QNearFieldShareManager::NoShare;
+ }
+
+ virtual QNearFieldShareManager::ShareError shareError() const
+ {
+ return QNearFieldShareManager::NoError;
+ }
+};
+
+QT_END_NAMESPACE
+
+#endif /* QNEARFIELDSHAREMANAGER_P_H_ */
diff --git a/src/nfc/qnearfieldsharemanager_qnx_p.cpp b/src/nfc/qnearfieldsharemanager_qnx_p.cpp
new file mode 100644
index 00000000..41700afe
--- /dev/null
+++ b/src/nfc/qnearfieldsharemanager_qnx_p.cpp
@@ -0,0 +1,151 @@
+/***************************************************************************
+ **
+ ** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+ ** Contact: http://www.qt-project.org/legal
+ **
+ ** This file is part of the QtNfc module of the Qt Toolkit.
+ **
+ ** $QT_BEGIN_LICENSE:LGPL$
+ ** Commercial License Usage
+ ** Licensees holding valid commercial Qt licenses may use this file in
+ ** accordance with the commercial license agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
+ ** use the contact form at http://qt.digia.com/contact-us.
+ **
+ ** GNU Lesser General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
+ ** General Public License version 2.1 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.LGPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU Lesser General Public License version 2.1 requirements
+ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ **
+ ** In addition, as a special exception, Digia gives you certain additional
+ ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+ **
+ ** GNU General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU
+ ** General Public License version 3.0 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.GPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU General Public License version 3.0 requirements will be
+ ** met: http://www.gnu.org/copyleft/gpl.html.
+ **
+ **
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#include "qnearfieldsharemanager_qnx_p.h"
+#include "qnearfieldsharetarget.h"
+#include "qnx/qnxnfcsharemanager_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace bb::system;
+
+QNearFieldShareManagerPrivateImpl::QNearFieldShareManagerPrivateImpl(QNearFieldShareManager* q)
+ : QNearFieldShareManagerPrivate(q), q_ptr(q), _manager(0), _target(0), _shareError(QNearFieldShareManager::NoError)
+{
+ _manager = QNXNFCShareManager::instance();
+ _manager->connect(this);
+}
+
+QNearFieldShareManagerPrivateImpl::~QNearFieldShareManagerPrivateImpl()
+{
+ if (_target) {
+ delete _target;
+ }
+
+ _manager->disconnect(this);
+}
+
+void QNearFieldShareManagerPrivateImpl::onShareModeChanged(NfcShareMode::Type mode)
+{
+ switch (mode) {
+ case NfcShareMode::DataSnep: {
+ emit q_ptr->shareModesChanged(QNearFieldShareManager::NdefShare);
+ break;
+ }
+
+ case NfcShareMode::File: {
+ emit q_ptr->shareModesChanged(QNearFieldShareManager::FileShare);
+ break;
+ }
+
+ case NfcShareMode::Disabled: {
+ emit q_ptr->shareModesChanged(QNearFieldShareManager::NoShare);
+ break;
+ }
+
+ default: {
+ }
+ }
+}
+
+void QNearFieldShareManagerPrivateImpl::onError(NfcShareError::Type error)
+{
+ _shareError = QNXNFCShareManager::toShareError(error);
+
+ if (_shareError != QNearFieldShareManager::NoError)
+ emit q_ptr->error(_shareError);
+}
+
+void QNearFieldShareManagerPrivateImpl::onFinished(NfcShareSuccess::Type result)
+{
+ Q_UNUSED(result)
+}
+
+void QNearFieldShareManagerPrivateImpl::onTargetAcquired()
+{
+ if (_target) {
+ delete _target;
+ _target = 0;
+ }
+
+ _target = new QNearFieldShareTarget(shareModes(), this);
+ emit q_ptr->targetDetected(_target);
+}
+
+void QNearFieldShareManagerPrivateImpl::onTargetCancelled()
+{
+}
+
+QNearFieldShareManager::ShareModes QNearFieldShareManagerPrivateImpl::supportedShareModes()
+{
+ return QNearFieldShareManager::NdefShare | QNearFieldShareManager::FileShare;
+}
+
+void QNearFieldShareManagerPrivateImpl::setShareModes(QNearFieldShareManager::ShareModes modes)
+{
+ _shareError = QNearFieldShareManager::NoError;
+
+ if (modes == QNearFieldShareManager::NoShare) {
+ _manager->setShareMode(NfcShareMode::Disabled);
+ _manager->reset();
+ }
+
+ else {
+ // TODO: Fix NfcShareManager to handle multiple share modes simultaneously
+ if (modes.testFlag(QNearFieldShareManager::NdefShare))
+ _manager->setShareMode(NfcShareMode::DataSnep);
+
+ if (modes.testFlag(QNearFieldShareManager::FileShare))
+ _manager->setShareMode(NfcShareMode::File);
+ }
+}
+
+QNearFieldShareManager::ShareModes QNearFieldShareManagerPrivateImpl::shareModes() const
+{
+ return QNXNFCShareManager::toShareModes(_manager->shareMode());
+}
+
+QNearFieldShareManager::ShareError QNearFieldShareManagerPrivateImpl::shareError() const
+{
+ return _shareError;
+}
+
+QT_END_NAMESPACE
diff --git a/src/nfc/qnearfieldsharemanager_qnx_p.h b/src/nfc/qnearfieldsharemanager_qnx_p.h
new file mode 100644
index 00000000..5d973bcf
--- /dev/null
+++ b/src/nfc/qnearfieldsharemanager_qnx_p.h
@@ -0,0 +1,83 @@
+/***************************************************************************
+ **
+ ** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+ ** Contact: http://www.qt-project.org/legal
+ **
+ ** This file is part of the QtNfc module of the Qt Toolkit.
+ **
+ ** $QT_BEGIN_LICENSE:LGPL$
+ ** Commercial License Usage
+ ** Licensees holding valid commercial Qt licenses may use this file in
+ ** accordance with the commercial license agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
+ ** use the contact form at http://qt.digia.com/contact-us.
+ **
+ ** GNU Lesser General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
+ ** General Public License version 2.1 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.LGPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU Lesser General Public License version 2.1 requirements
+ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ **
+ ** In addition, as a special exception, Digia gives you certain additional
+ ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+ **
+ ** GNU General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU
+ ** General Public License version 3.0 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.GPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU General Public License version 3.0 requirements will be
+ ** met: http://www.gnu.org/copyleft/gpl.html.
+ **
+ **
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#ifndef QNEARFIELDSHAREMANAGER_QNX_P_H_
+#define QNEARFIELDSHAREMANAGER_QNX_P_H_
+
+#include "qnearfieldsharemanager_p.h"
+#include <bb/system/NfcShareManager>
+
+QT_BEGIN_NAMESPACE
+
+class QNXNFCShareManager;
+
+class QNearFieldShareManagerPrivateImpl : public QNearFieldShareManagerPrivate
+{
+ Q_OBJECT
+
+public:
+ QNearFieldShareManagerPrivateImpl(QNearFieldShareManager* q);
+ ~QNearFieldShareManagerPrivateImpl();
+
+ static QNearFieldShareManager::ShareModes supportedShareModes();
+ void setShareModes(QNearFieldShareManager::ShareModes modes);
+ QNearFieldShareManager::ShareModes shareModes() const;
+ QNearFieldShareManager::ShareError shareError() const;
+
+private Q_SLOTS:
+ void onShareModeChanged(bb::system::NfcShareMode::Type mode);
+ void onError(bb::system::NfcShareError::Type error);
+ void onFinished(bb::system::NfcShareSuccess::Type result);
+ void onTargetAcquired();
+ void onTargetCancelled();
+
+private:
+ QNearFieldShareManager * const q_ptr;
+ Q_DECLARE_PUBLIC(QNearFieldShareManager)
+
+ QNXNFCShareManager *_manager;
+ QNearFieldShareTarget *_target;
+ QNearFieldShareManager::ShareError _shareError;
+};
+
+QT_END_NAMESPACE
+
+#endif /* QNEARFIELDSHAREMANAGER_QNX_P_H_ */
diff --git a/src/nfc/qnearfieldsharemanagerimpl_p.cpp b/src/nfc/qnearfieldsharemanagerimpl_p.cpp
new file mode 100644
index 00000000..d9cd2f45
--- /dev/null
+++ b/src/nfc/qnearfieldsharemanagerimpl_p.cpp
@@ -0,0 +1,60 @@
+/***************************************************************************
+ **
+ ** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+ ** Contact: http://www.qt-project.org/legal
+ **
+ ** This file is part of the QtNfc module of the Qt Toolkit.
+ **
+ ** $QT_BEGIN_LICENSE:LGPL$
+ ** Commercial License Usage
+ ** Licensees holding valid commercial Qt licenses may use this file in
+ ** accordance with the commercial license agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
+ ** use the contact form at http://qt.digia.com/contact-us.
+ **
+ ** GNU Lesser General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
+ ** General Public License version 2.1 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.LGPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU Lesser General Public License version 2.1 requirements
+ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ **
+ ** In addition, as a special exception, Digia gives you certain additional
+ ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+ **
+ ** GNU General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU
+ ** General Public License version 3.0 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.GPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU General Public License version 3.0 requirements will be
+ ** met: http://www.gnu.org/copyleft/gpl.html.
+ **
+ **
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#include "qnearfieldsharemanagerimpl_p.h"
+
+QT_BEGIN_NAMESPACE
+
+QNearFieldShareManagerPrivateImpl::QNearFieldShareManagerPrivateImpl(QNearFieldShareManager* q)
+ : QNearFieldShareManagerPrivate(q)
+{
+}
+
+QNearFieldShareManagerPrivateImpl::~QNearFieldShareManagerPrivateImpl()
+{
+}
+
+QNearFieldShareManager::ShareModes QNearFieldShareManagerPrivateImpl::supportedShareModes()
+{
+ return QNearFieldShareManager::NoShare;
+}
+
+QT_END_NAMESPACE
diff --git a/src/nfc/qnearfieldsharemanagerimpl_p.h b/src/nfc/qnearfieldsharemanagerimpl_p.h
new file mode 100644
index 00000000..0c7d9ac5
--- /dev/null
+++ b/src/nfc/qnearfieldsharemanagerimpl_p.h
@@ -0,0 +1,60 @@
+/***************************************************************************
+ **
+ ** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+ ** Contact: http://www.qt-project.org/legal
+ **
+ ** This file is part of the QtNfc module of the Qt Toolkit.
+ **
+ ** $QT_BEGIN_LICENSE:LGPL$
+ ** Commercial License Usage
+ ** Licensees holding valid commercial Qt licenses may use this file in
+ ** accordance with the commercial license agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
+ ** use the contact form at http://qt.digia.com/contact-us.
+ **
+ ** GNU Lesser General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
+ ** General Public License version 2.1 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.LGPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU Lesser General Public License version 2.1 requirements
+ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ **
+ ** In addition, as a special exception, Digia gives you certain additional
+ ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+ **
+ ** GNU General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU
+ ** General Public License version 3.0 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.GPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU General Public License version 3.0 requirements will be
+ ** met: http://www.gnu.org/copyleft/gpl.html.
+ **
+ **
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#ifndef QNEARFIELDSHAREMANAGERIMPL_P_H_
+#define QNEARFIELDSHAREMANAGERIMPL_P_H_
+
+#include "qnearfieldsharemanager_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QNearFieldShareManagerPrivateImpl : public QNearFieldShareManagerPrivate
+{
+public:
+ QNearFieldShareManagerPrivateImpl(QNearFieldShareManager* q);
+ ~QNearFieldShareManagerPrivateImpl();
+
+ static QNearFieldShareManager::ShareModes supportedShareModes();
+};
+
+QT_END_NAMESPACE
+
+#endif /* QNEARFIELDSHAREMANAGERIMPL_P_H_ */
diff --git a/src/nfc/qnearfieldsharetarget.cpp b/src/nfc/qnearfieldsharetarget.cpp
new file mode 100644
index 00000000..9ac66c5c
--- /dev/null
+++ b/src/nfc/qnearfieldsharetarget.cpp
@@ -0,0 +1,151 @@
+/***************************************************************************
+ **
+ ** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+ ** Contact: http://www.qt-project.org/legal
+ **
+ ** This file is part of the QtNfc module of the Qt Toolkit.
+ **
+ ** $QT_BEGIN_LICENSE:LGPL$
+ ** Commercial License Usage
+ ** Licensees holding valid commercial Qt licenses may use this file in
+ ** accordance with the commercial license agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
+ ** use the contact form at http://qt.digia.com/contact-us.
+ **
+ ** GNU Lesser General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
+ ** General Public License version 2.1 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.LGPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU Lesser General Public License version 2.1 requirements
+ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ **
+ ** In addition, as a special exception, Digia gives you certain additional
+ ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+ **
+ ** GNU General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU
+ ** General Public License version 3.0 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.GPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU General Public License version 3.0 requirements will be
+ ** met: http://www.gnu.org/copyleft/gpl.html.
+ **
+ **
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#include "qnearfieldsharetarget.h"
+#include "qnearfieldsharetarget_p.h"
+
+#if defined(QNX_NFC)
+#include "qnearfieldsharetarget_qnx_p.h"
+#else
+#include "qnearfieldsharetargetimpl_p.h"
+#endif
+
+#include "qnearfieldsharemanager.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QNearFieldShareTarget
+ \brief The QNearFieldShareTarget class transfers data to remote device over NFC.
+
+ \ingroup connectivity-nfc
+ \inmodule QtNfc
+
+ The QNearFieldShareTarget class can be used for sharing NDEF message or files to a remote
+ NFC enabled device supporting the same protocol.
+*/
+
+/*!
+ \fn void QNearFieldShareTarget::error(QNearFieldShareManager::ShareError error)
+
+ This signal is emitted whenever an \a error occurs during transfer.
+*/
+
+/*!
+ \fn void QNearFieldShareTarget::shareFinished()
+
+ This signal is emitted whenever a data or file transfer has completed successfully.
+*/
+
+/*!
+ Constructs a new near field share target with \a parent.
+*/
+QNearFieldShareTarget::QNearFieldShareTarget(QNearFieldShareManager::ShareModes modes, QObject *parent)
+: QObject(parent), d_ptr(new QNearFieldShareTargetPrivateImpl(modes, this))
+{
+}
+
+/*!
+ Destroys the near field share target.
+*/
+QNearFieldShareTarget::~QNearFieldShareTarget()
+{
+}
+
+/*!
+ Returns the share mode supported by the share target.
+*/
+QNearFieldShareManager::ShareModes QNearFieldShareTarget::shareModes() const
+{
+ Q_D(const QNearFieldShareTarget);
+ return d->shareModes();
+}
+
+/*!
+ Share the NDEF \a message via the share target. This method starts sharing asynchronously and returns immediately.
+ The method returns true if the request is accepted, otherwise returns false. Sharing is completed when the shareFinished()
+ signal is emitted.
+*/
+bool QNearFieldShareTarget::share(const QNdefMessage &message)
+{
+ Q_D(QNearFieldShareTarget);
+ return d->share(message);
+}
+
+/*!
+ Share the \a files via the share target. This method starts sharing asynchronously and returns immediately.
+ The method returns true if the request is accepted, otherwise returns false. Sharing is completed when the shareFinished()
+ signal is emitted.
+*/
+bool QNearFieldShareTarget::share(const QList<QFileInfo> &files)
+{
+ Q_D(QNearFieldShareTarget);
+ return d->share(files);
+}
+
+/*!
+ Cancel the data or file sharing in progress.
+*/
+void QNearFieldShareTarget::cancel()
+{
+ Q_D(QNearFieldShareTarget);
+ d->cancel();
+}
+
+/*!
+ Returns true if data or file sharing is in progress, otherwise returns false.
+*/
+bool QNearFieldShareTarget::isShareInProgress() const
+{
+ Q_D(const QNearFieldShareTarget);
+ return d->isShareInProgress();
+}
+
+/*!
+ Returns the error code of the error that occurred.
+ */
+QNearFieldShareManager::ShareError QNearFieldShareTarget::shareError() const
+{
+ Q_D(const QNearFieldShareTarget);
+ return d->shareError();
+}
+
+QT_END_NAMESPACE
diff --git a/src/nfc/qnearfieldsharetarget.h b/src/nfc/qnearfieldsharetarget.h
new file mode 100644
index 00000000..96a4a312
--- /dev/null
+++ b/src/nfc/qnearfieldsharetarget.h
@@ -0,0 +1,86 @@
+/***************************************************************************
+ **
+ ** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+ ** Contact: http://www.qt-project.org/legal
+ **
+ ** This file is part of the QtNfc module of the Qt Toolkit.
+ **
+ ** $QT_BEGIN_LICENSE:LGPL$
+ ** Commercial License Usage
+ ** Licensees holding valid commercial Qt licenses may use this file in
+ ** accordance with the commercial license agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
+ ** use the contact form at http://qt.digia.com/contact-us.
+ **
+ ** GNU Lesser General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
+ ** General Public License version 2.1 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.LGPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU Lesser General Public License version 2.1 requirements
+ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ **
+ ** In addition, as a special exception, Digia gives you certain additional
+ ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+ **
+ ** GNU General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU
+ ** General Public License version 3.0 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.GPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU General Public License version 3.0 requirements will be
+ ** met: http://www.gnu.org/copyleft/gpl.html.
+ **
+ **
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+
+#ifndef QNEARFIELDSHARETARGET_H
+#define QNEARFIELDSHARETARGET_H
+
+#include <QtCore/QObject>
+#include <QFileInfo>
+#include <QtNfc/QNdefMessage>
+#include <QtNfc/QNearFieldShareManager>
+
+QT_BEGIN_NAMESPACE
+
+class QNearFieldShareTargetPrivate;
+
+class Q_NFC_EXPORT QNearFieldShareTarget : public QObject
+{
+ Q_OBJECT
+
+public:
+ ~QNearFieldShareTarget();
+
+ QNearFieldShareManager::ShareModes shareModes() const;
+ bool share(const QNdefMessage &message);
+ bool share(const QList<QFileInfo> &files);
+ void cancel();
+ bool isShareInProgress() const;
+ QNearFieldShareManager::ShareError shareError() const;
+
+Q_SIGNALS:
+ void error(QNearFieldShareManager::ShareError error);
+ void shareFinished();
+
+private:
+ explicit QNearFieldShareTarget(QNearFieldShareManager::ShareModes modes, QObject *parent = 0);
+
+ QNearFieldShareTargetPrivate *d_ptr;
+ Q_DECLARE_PRIVATE(QNearFieldShareTarget)
+ Q_DISABLE_COPY(QNearFieldShareTarget)
+
+ friend class QNearFieldShareManagerPrivateImpl;
+ friend class QNearFieldShareTargetPrivateImpl;
+};
+
+QT_END_NAMESPACE
+
+#endif /* QNEARFIELDSHARETARGET_H */
diff --git a/src/nfc/qnearfieldsharetarget_p.h b/src/nfc/qnearfieldsharetarget_p.h
new file mode 100644
index 00000000..729acb0e
--- /dev/null
+++ b/src/nfc/qnearfieldsharetarget_p.h
@@ -0,0 +1,99 @@
+/***************************************************************************
+ **
+ ** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+ ** Contact: http://www.qt-project.org/legal
+ **
+ ** This file is part of the QtNfc module of the Qt Toolkit.
+ **
+ ** $QT_BEGIN_LICENSE:LGPL$
+ ** Commercial License Usage
+ ** Licensees holding valid commercial Qt licenses may use this file in
+ ** accordance with the commercial license agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
+ ** use the contact form at http://qt.digia.com/contact-us.
+ **
+ ** GNU Lesser General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
+ ** General Public License version 2.1 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.LGPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU Lesser General Public License version 2.1 requirements
+ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ **
+ ** In addition, as a special exception, Digia gives you certain additional
+ ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+ **
+ ** GNU General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU
+ ** General Public License version 3.0 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.GPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU General Public License version 3.0 requirements will be
+ ** met: http://www.gnu.org/copyleft/gpl.html.
+ **
+ **
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+
+#ifndef QNEARFIELDSHARETARGET_P_H
+#define QNEARFIELDSHARETARGET_P_H
+
+#include "qnearfieldsharetarget.h"
+
+QT_BEGIN_NAMESPACE
+
+class QNearFieldShareTargetPrivate : public QObject
+{
+ Q_OBJECT
+
+public:
+ QNearFieldShareTargetPrivate(QNearFieldShareManager::ShareModes modes, QNearFieldShareTarget *q)
+ : QObject(q)
+ {
+ Q_UNUSED(modes)
+ }
+
+ ~QNearFieldShareTargetPrivate()
+ {
+ }
+
+ virtual QNearFieldShareManager::ShareModes shareModes() const
+ {
+ return QNearFieldShareManager::NoShare;
+ }
+
+ virtual bool share(const QNdefMessage &message)
+ {
+ Q_UNUSED(message)
+ return false;
+ }
+
+ virtual bool share(const QList<QFileInfo> &files)
+ {
+ Q_UNUSED(files)
+ return false;
+ }
+
+ virtual void cancel()
+ {
+ }
+
+ virtual bool isShareInProgress() const
+ {
+ return false;
+ }
+
+ virtual QNearFieldShareManager::ShareError shareError() const
+ {
+ return QNearFieldShareManager::NoError;
+ }
+};
+
+QT_END_NAMESPACE
+
+#endif /* QNEARFIELDSHARETARGET_P_H */
diff --git a/src/nfc/qnearfieldsharetarget_qnx_p.cpp b/src/nfc/qnearfieldsharetarget_qnx_p.cpp
new file mode 100644
index 00000000..01445641
--- /dev/null
+++ b/src/nfc/qnearfieldsharetarget_qnx_p.cpp
@@ -0,0 +1,120 @@
+/***************************************************************************
+ **
+ ** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+ ** Contact: http://www.qt-project.org/legal
+ **
+ ** This file is part of the QtNfc module of the Qt Toolkit.
+ **
+ ** $QT_BEGIN_LICENSE:LGPL$
+ ** Commercial License Usage
+ ** Licensees holding valid commercial Qt licenses may use this file in
+ ** accordance with the commercial license agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
+ ** use the contact form at http://qt.digia.com/contact-us.
+ **
+ ** GNU Lesser General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
+ ** General Public License version 2.1 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.LGPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU Lesser General Public License version 2.1 requirements
+ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ **
+ ** In addition, as a special exception, Digia gives you certain additional
+ ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+ **
+ ** GNU General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU
+ ** General Public License version 3.0 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.GPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU General Public License version 3.0 requirements will be
+ ** met: http://www.gnu.org/copyleft/gpl.html.
+ **
+ **
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#include "qnearfieldsharetarget_qnx_p.h"
+#include "qnearfieldsharemanager_p.h"
+#include "qnx/qnxnfcsharemanager_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace bb::system;
+
+QNearFieldShareTargetPrivateImpl::QNearFieldShareTargetPrivateImpl(QNearFieldShareManager::ShareModes modes, QNearFieldShareTarget *q)
+: QNearFieldShareTargetPrivate(modes, q), q_ptr(q), _error(QNearFieldShareManager::NoError)
+{
+ _manager = QNXNFCShareManager::instance();
+ _manager->connect(this);
+}
+
+QNearFieldShareTargetPrivateImpl::~QNearFieldShareTargetPrivateImpl()
+{
+ _manager->disconnect(this);
+}
+
+QNearFieldShareManager::ShareModes QNearFieldShareTargetPrivateImpl::shareModes() const
+{
+ return QNXNFCShareManager::toShareModes(_manager->shareMode());
+}
+
+bool QNearFieldShareTargetPrivateImpl::share(const QNdefMessage &message)
+{
+ return _manager->shareNdef(message);
+}
+
+bool QNearFieldShareTargetPrivateImpl::share(const QList<QFileInfo> &files)
+{
+ return _manager->shareFiles(files);
+}
+
+void QNearFieldShareTargetPrivateImpl::cancel()
+{
+ _manager->cancel();
+}
+
+bool QNearFieldShareTargetPrivateImpl::isShareInProgress() const
+{
+ return QNXNFCShareManager::toShareModes(_manager->shareMode()) != QNearFieldShareManager::NoShare;
+}
+
+QNearFieldShareManager::ShareError QNearFieldShareTargetPrivateImpl::shareError() const
+{
+ return _error;
+}
+
+void QNearFieldShareTargetPrivateImpl::onShareModeChanged(NfcShareMode::Type mode)
+{
+ Q_UNUSED(mode)
+}
+
+void QNearFieldShareTargetPrivateImpl::onError(NfcShareError::Type error)
+{
+ _error = QNXNFCShareManager::toShareError(error);
+
+ if (_error != QNearFieldShareManager::NoError) {
+ emit q_ptr->error(_error);
+ }
+}
+
+void QNearFieldShareTargetPrivateImpl::onFinished(NfcShareSuccess::Type result)
+{
+ Q_UNUSED(result)
+ emit q_ptr->shareFinished();
+}
+
+void QNearFieldShareTargetPrivateImpl::onTargetAcquired()
+{
+}
+
+void QNearFieldShareTargetPrivateImpl::onTargetCancelled()
+{
+}
+
+QT_END_NAMESPACE
diff --git a/src/nfc/qnearfieldsharetarget_qnx_p.h b/src/nfc/qnearfieldsharetarget_qnx_p.h
new file mode 100644
index 00000000..16bf429f
--- /dev/null
+++ b/src/nfc/qnearfieldsharetarget_qnx_p.h
@@ -0,0 +1,85 @@
+/***************************************************************************
+ **
+ ** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+ ** Contact: http://www.qt-project.org/legal
+ **
+ ** This file is part of the QtNfc module of the Qt Toolkit.
+ **
+ ** $QT_BEGIN_LICENSE:LGPL$
+ ** Commercial License Usage
+ ** Licensees holding valid commercial Qt licenses may use this file in
+ ** accordance with the commercial license agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
+ ** use the contact form at http://qt.digia.com/contact-us.
+ **
+ ** GNU Lesser General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
+ ** General Public License version 2.1 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.LGPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU Lesser General Public License version 2.1 requirements
+ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ **
+ ** In addition, as a special exception, Digia gives you certain additional
+ ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+ **
+ ** GNU General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU
+ ** General Public License version 3.0 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.GPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU General Public License version 3.0 requirements will be
+ ** met: http://www.gnu.org/copyleft/gpl.html.
+ **
+ **
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+
+#ifndef QNEARFIELDSHARETARGET_QNX_P_H
+#define QNEARFIELDSHARETARGET_QNX_P_H
+
+#include "qnearfieldsharetarget_p.h"
+#include <bb/system/NfcShareManager>
+
+QT_BEGIN_NAMESPACE
+
+class QNXNFCShareManager;
+
+class QNearFieldShareTargetPrivateImpl : public QNearFieldShareTargetPrivate
+{
+ Q_OBJECT
+
+public:
+ QNearFieldShareTargetPrivateImpl(QNearFieldShareManager::ShareModes modes, QNearFieldShareTarget *q);
+ ~QNearFieldShareTargetPrivateImpl();
+
+ QNearFieldShareManager::ShareModes shareModes() const;
+ bool share(const QNdefMessage &message);
+ bool share(const QList<QFileInfo> &files);
+ void cancel();
+ bool isShareInProgress() const;
+ QNearFieldShareManager::ShareError shareError() const;
+
+private Q_SLOTS:
+ void onShareModeChanged(bb::system::NfcShareMode::Type mode);
+ void onError(bb::system::NfcShareError::Type error);
+ void onFinished(bb::system::NfcShareSuccess::Type result);
+ void onTargetAcquired();
+ void onTargetCancelled();
+
+private:
+ QNearFieldShareTarget * const q_ptr;
+ Q_DECLARE_PUBLIC(QNearFieldShareTarget)
+
+ QNXNFCShareManager *_manager;
+ QNearFieldShareManager::ShareError _error;
+};
+
+QT_END_NAMESPACE
+
+#endif /* QNEARFIELDSHARETARGET_QNX_P_H */
diff --git a/src/nfc/qnearfieldsharetargetimpl_p.cpp b/src/nfc/qnearfieldsharetargetimpl_p.cpp
new file mode 100644
index 00000000..f5d86cf6
--- /dev/null
+++ b/src/nfc/qnearfieldsharetargetimpl_p.cpp
@@ -0,0 +1,55 @@
+/***************************************************************************
+ **
+ ** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+ ** Contact: http://www.qt-project.org/legal
+ **
+ ** This file is part of the QtNfc module of the Qt Toolkit.
+ **
+ ** $QT_BEGIN_LICENSE:LGPL$
+ ** Commercial License Usage
+ ** Licensees holding valid commercial Qt licenses may use this file in
+ ** accordance with the commercial license agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
+ ** use the contact form at http://qt.digia.com/contact-us.
+ **
+ ** GNU Lesser General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
+ ** General Public License version 2.1 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.LGPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU Lesser General Public License version 2.1 requirements
+ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ **
+ ** In addition, as a special exception, Digia gives you certain additional
+ ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+ **
+ ** GNU General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU
+ ** General Public License version 3.0 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.GPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU General Public License version 3.0 requirements will be
+ ** met: http://www.gnu.org/copyleft/gpl.html.
+ **
+ **
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#include "qnearfieldsharetargetimpl_p.h"
+
+QT_BEGIN_NAMESPACE
+
+QNearFieldShareTargetPrivateImpl::QNearFieldShareTargetPrivateImpl(QNearFieldShareManager::ShareModes /*modes*/, QNearFieldShareTarget *q)
+ : QNearFieldShareTargetPrivate(QNearFieldShareManager::NoShare, q)
+{
+}
+
+QNearFieldShareTargetPrivateImpl::~QNearFieldShareTargetPrivateImpl()
+{
+}
+
+QT_END_NAMESPACE
diff --git a/src/nfc/qnearfieldsharetargetimpl_p.h b/src/nfc/qnearfieldsharetargetimpl_p.h
new file mode 100644
index 00000000..93b6f81d
--- /dev/null
+++ b/src/nfc/qnearfieldsharetargetimpl_p.h
@@ -0,0 +1,59 @@
+/***************************************************************************
+ **
+ ** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+ ** Contact: http://www.qt-project.org/legal
+ **
+ ** This file is part of the QtNfc module of the Qt Toolkit.
+ **
+ ** $QT_BEGIN_LICENSE:LGPL$
+ ** Commercial License Usage
+ ** Licensees holding valid commercial Qt licenses may use this file in
+ ** accordance with the commercial license agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
+ ** use the contact form at http://qt.digia.com/contact-us.
+ **
+ ** GNU Lesser General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
+ ** General Public License version 2.1 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.LGPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU Lesser General Public License version 2.1 requirements
+ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ **
+ ** In addition, as a special exception, Digia gives you certain additional
+ ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+ **
+ ** GNU General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU
+ ** General Public License version 3.0 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.GPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU General Public License version 3.0 requirements will be
+ ** met: http://www.gnu.org/copyleft/gpl.html.
+ **
+ **
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+
+#ifndef QNEARFIELDSHARETARGETIMPL_P_H
+#define QNEARFIELDSHARETARGETIMPL_P_H
+
+#include "qnearfieldsharetarget_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QNearFieldShareTargetPrivateImpl : public QNearFieldShareTargetPrivate
+{
+public:
+ QNearFieldShareTargetPrivateImpl(QNearFieldShareManager::ShareModes modes, QNearFieldShareTarget *q);
+ ~QNearFieldShareTargetPrivateImpl();
+};
+
+QT_END_NAMESPACE
+
+#endif /* QNEARFIELDSHARETARGETIMPL_P_H */
diff --git a/src/nfc/qnx/qnxnfcmanager.cpp b/src/nfc/qnx/qnxnfcmanager.cpp
index 3fde4d18..92152c26 100644
--- a/src/nfc/qnx/qnxnfcmanager.cpp
+++ b/src/nfc/qnx/qnxnfcmanager.cpp
@@ -155,7 +155,7 @@ QNXNFCManager::QNXNFCManager()
ndefEventFilter = new QNXNFCEventFilter();
ndefEventFilter->installOnEventDispatcher(QAbstractEventDispatcher::instance());
- connect(ndefEventFilter, SIGNAL(ndefEvent(const QNdefMessage&)), this, SLOT(invokeNdefMessage(const QNdefMessage&)));
+ connect(ndefEventFilter, SIGNAL(ndefEvent(QNdefMessage)), this, SLOT(invokeNdefMessage(QNdefMessage)));
}
QNXNFCManager::~QNXNFCManager()
@@ -364,7 +364,7 @@ void QNXNFCManager::setupInvokeTarget() {
//Get the correct target-id
QString targetId = QCoreApplication::instance()->arguments().first();
- targetId = targetId.left(targetId.lastIndexOf("."));
+ targetId = targetId.left(targetId.lastIndexOf(QLatin1Char('.')));
if (BPS_SUCCESS != navigator_invoke_set_filters("20", targetId.toLatin1().constData(), filters, 1)) {
qWarning() << "NFC Error setting share target filter";
diff --git a/src/nfc/qnx/qnxnfcsharemanager_p.cpp b/src/nfc/qnx/qnxnfcsharemanager_p.cpp
new file mode 100644
index 00000000..684a1a46
--- /dev/null
+++ b/src/nfc/qnx/qnxnfcsharemanager_p.cpp
@@ -0,0 +1,280 @@
+/***************************************************************************
+ **
+ ** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+ ** Contact: http://www.qt-project.org/legal
+ **
+ ** This file is part of the QtNfc module of the Qt Toolkit.
+ **
+ ** $QT_BEGIN_LICENSE:LGPL$
+ ** Commercial License Usage
+ ** Licensees holding valid commercial Qt licenses may use this file in
+ ** accordance with the commercial license agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
+ ** use the contact form at http://qt.digia.com/contact-us.
+ **
+ ** GNU Lesser General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
+ ** General Public License version 2.1 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.LGPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU Lesser General Public License version 2.1 requirements
+ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ **
+ ** In addition, as a special exception, Digia gives you certain additional
+ ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+ **
+ ** GNU General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU
+ ** General Public License version 3.0 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.GPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU General Public License version 3.0 requirements will be
+ ** met: http://www.gnu.org/copyleft/gpl.html.
+ **
+ **
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#include "qnxnfcsharemanager_p.h"
+
+QT_BEGIN_NAMESPACE
+
+using namespace bb::system;
+
+const char *QNXNFCShareManager::RECORD_NDEF = "application/vnd.rim.nfc.ndef";
+Q_GLOBAL_STATIC(QNXNFCShareManager, shareStatic)
+
+QNXNFCShareManager *QNXNFCShareManager::instance()
+{
+ return shareStatic();
+}
+
+bool QNXNFCShareManager::shareNdef(const QNdefMessage &message)
+{
+ bool ok = false;
+ NfcShareDataContent content;
+ content.setMimeType(RECORD_NDEF);
+ content.setData(message.toByteArray());
+
+ NfcShareSetContentError::Type err = _manager->setShareContent(content);
+
+ switch (err) {
+ case NfcShareSetContentError::None: {
+ ok = true;
+ break;
+ }
+
+ case NfcShareSetContentError::TransferInProgress: {
+ emit error(NfcShareError::TransferInProgress);
+ break;
+ }
+
+ case NfcShareSetContentError::InvalidShareMode:
+ case NfcShareSetContentError::InvalidShareRequest: {
+ emit error(NfcShareError::UnsupportedShareMode);
+ break;
+ }
+
+ case NfcShareSetContentError::Unknown: {
+ emit error(NfcShareError::Unknown);
+ break;
+ }
+ }
+
+ if (ok)
+ _manager->startTransfer();
+
+ return ok;
+}
+
+bool QNXNFCShareManager::shareFiles(const QList<QFileInfo> &files)
+{
+ bool ok = false;
+ NfcShareFilesContent content;
+ QList<QUrl> urls;
+
+ for (int i=0; i<files.size(); i++) {
+ urls.append(QUrl::fromLocalFile(files[i].filePath()));
+ }
+
+ content.setFileUrls(urls);
+
+ NfcShareSetContentError::Type err = _manager->setShareContent(content);
+
+ switch (err) {
+ case NfcShareSetContentError::None: {
+ ok = true;
+ break;
+ }
+
+ case NfcShareSetContentError::TransferInProgress: {
+ emit error(NfcShareError::TransferInProgress);
+ break;
+ }
+
+ case NfcShareSetContentError::InvalidShareMode:
+ case NfcShareSetContentError::InvalidShareRequest: {
+ emit error(NfcShareError::UnsupportedShareMode);
+ break;
+ }
+
+ case NfcShareSetContentError::Unknown: {
+ emit error(NfcShareError::Unknown);
+ break;
+ }
+ }
+
+ if (ok)
+ _manager->startTransfer();
+
+ return ok;
+}
+
+void QNXNFCShareManager::cancel()
+{
+ _manager->cancelTarget();
+}
+
+void QNXNFCShareManager::setShareMode(NfcShareMode::Type type)
+{
+ _manager->setShareMode(type, NfcShareStartTransferMode::OnDemand);
+}
+
+NfcShareMode::Type QNXNFCShareManager::shareMode() const
+{
+ return _manager->shareMode();
+}
+
+void QNXNFCShareManager::connect(QObject *obj)
+{
+ QObject::connect(this, SIGNAL(shareModeChanged(bb::system::NfcShareMode::Type)),
+ obj, SLOT(onShareModeChanged(bb::system::NfcShareMode::Type)));
+ QObject::connect(this, SIGNAL(error(bb::system::NfcShareError::Type)),
+ obj, SLOT(onError(bb::system::NfcShareError::Type)));
+ QObject::connect(this, SIGNAL(finished(bb::system::NfcShareSuccess::Type)),
+ obj, SLOT(onFinished(bb::system::NfcShareSuccess::Type)));
+ QObject::connect(this, SIGNAL(targetAcquired()),
+ obj, SLOT(onTargetAcquired()));
+ QObject::connect(this, SIGNAL(targetCancelled()),
+ obj, SLOT(onTargetCancelled()));
+}
+
+void QNXNFCShareManager::disconnect(QObject *obj)
+{
+ QObject::disconnect(this, SIGNAL(shareModeChanged(bb::system::NfcShareMode::Type)),
+ obj, SLOT(onShareModeChanged(bb::system::NfcShareMode::Type)));
+ QObject::disconnect(this, SIGNAL(error(bb::system::NfcShareError::Type)),
+ obj, SLOT(onError(bb::system::NfcShareError::Type)));
+ QObject::disconnect(this, SIGNAL(finished(bb::system::NfcShareSuccess::Type)),
+ obj, SLOT(onFinished(bb::system::NfcShareSuccess::Type)));
+ QObject::disconnect(this, SIGNAL(targetAcquired()),
+ obj, SLOT(onTargetAcquired()));
+ QObject::disconnect(this, SIGNAL(targetCancelled()),
+ obj, SLOT(onTargetCancelled()));
+}
+
+void QNXNFCShareManager::reset()
+{
+ _manager->reset();
+}
+
+QNXNFCShareManager::QNXNFCShareManager()
+ : QObject()
+{
+ _manager = new NfcShareManager(this);
+ QObject::connect(_manager, SIGNAL(shareModeChanged(bb::system::NfcShareMode::Type)),
+ this, SIGNAL(shareModeChanged(bb::system::NfcShareMode::Type)));
+ QObject::connect(_manager, SIGNAL(error(bb::system::NfcShareError::Type)),
+ this, SIGNAL(error(bb::system::NfcShareError::Type)));
+ QObject::connect(_manager, SIGNAL(finished(bb::system::NfcShareSuccess::Type)),
+ this, SIGNAL(finished(bb::system::NfcShareSuccess::Type)));
+ QObject::connect(_manager, SIGNAL(targetAcquired()),
+ this, SIGNAL(targetAcquired()));
+ QObject::connect(_manager, SIGNAL(targetCancelled()),
+ this, SIGNAL(targetCancelled()));
+}
+
+QNXNFCShareManager::~QNXNFCShareManager()
+{
+ delete _manager;
+}
+
+QNearFieldShareManager::ShareError QNXNFCShareManager::toShareError(NfcShareError::Type nfcShareError)
+{
+ QNearFieldShareManager::ShareError shareError = QNearFieldShareManager::NoError;
+
+ switch (nfcShareError) {
+ case NfcShareError::Unknown: {
+ shareError = QNearFieldShareManager::UnknownError;
+ break;
+ }
+
+ case NfcShareError::NoContentToShare:
+ case NfcShareError::MessageSize:
+ case NfcShareError::TagLocked:
+ case NfcShareError::UnsupportedTagType: {
+ shareError = QNearFieldShareManager::InvalidShareContentError;
+ break;
+ }
+
+ case NfcShareError::RegisterFileSharing:
+ case NfcShareError::RegisterDataSharing: {
+ shareError = QNearFieldShareManager::InvalidShareContentError;
+ break;
+ }
+
+ case NfcShareError::DataTransferFailed:
+ case NfcShareError::BluetoothFileTransferFailed:
+ case NfcShareError::WiFiDirectFileTransferFailed:
+ case NfcShareError::HandoverFailed: {
+ shareError = QNearFieldShareManager::ShareInterruptedError;
+ break;
+ }
+
+ case NfcShareError::BluetoothFileTransferCancelled:
+ case NfcShareError::WiFiDirectFileTransferCancelled: {
+ shareError = QNearFieldShareManager::ShareCanceledError;
+ break;
+ }
+
+ case NfcShareError::TransferInProgress: {
+ shareError = QNearFieldShareManager::ShareAlreadyInProgressError;
+ break;
+ }
+
+ case NfcShareError::UnsupportedShareMode: {
+ shareError = QNearFieldShareManager::UnsupportedShareModeError;
+ break;
+ }
+
+ case NfcShareError::NoTransferTarget: {
+ shareError = QNearFieldShareManager::ShareRejectedError;
+ break;
+ }
+
+ default: {
+ shareError = QNearFieldShareManager::UnknownError;
+ }
+ }
+
+ return shareError;
+}
+
+QNearFieldShareManager::ShareModes QNXNFCShareManager::toShareModes(NfcShareMode::Type nfcShareMode)
+{
+ QNearFieldShareManager::ShareModes modes = QNearFieldShareManager::NoShare;
+
+ if (nfcShareMode == NfcShareMode::DataSnep)
+ modes |= QNearFieldShareManager::NdefShare;
+
+ else if (nfcShareMode == NfcShareMode::File)
+ modes |= QNearFieldShareManager::FileShare;
+
+ return modes;
+}
+
+QT_END_NAMESPACE
diff --git a/src/nfc/qnx/qnxnfcsharemanager_p.h b/src/nfc/qnx/qnxnfcsharemanager_p.h
new file mode 100644
index 00000000..ae6511eb
--- /dev/null
+++ b/src/nfc/qnx/qnxnfcsharemanager_p.h
@@ -0,0 +1,90 @@
+/***************************************************************************
+ **
+ ** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+ ** Contact: http://www.qt-project.org/legal
+ **
+ ** This file is part of the QtNfc module of the Qt Toolkit.
+ **
+ ** $QT_BEGIN_LICENSE:LGPL$
+ ** Commercial License Usage
+ ** Licensees holding valid commercial Qt licenses may use this file in
+ ** accordance with the commercial license agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
+ ** use the contact form at http://qt.digia.com/contact-us.
+ **
+ ** GNU Lesser General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
+ ** General Public License version 2.1 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.LGPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU Lesser General Public License version 2.1 requirements
+ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ **
+ ** In addition, as a special exception, Digia gives you certain additional
+ ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+ **
+ ** GNU General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU
+ ** General Public License version 3.0 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.GPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU General Public License version 3.0 requirements will be
+ ** met: http://www.gnu.org/copyleft/gpl.html.
+ **
+ **
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#ifndef QNXNFCSHAREMANAGER_P_H
+#define QNXNFCSHAREMANAGER_P_H
+
+#include "qnearfieldsharemanager.h"
+#include <bb/system/NfcShareManager>
+#include <QFileInfo>
+#include <QNdefMessage>
+
+QT_BEGIN_NAMESPACE
+
+class Q_DECL_EXPORT QNXNFCShareManager : public QObject
+{
+ Q_OBJECT
+public:
+ static QNXNFCShareManager *instance();
+
+ QNXNFCShareManager();
+ ~QNXNFCShareManager();
+
+ bool shareNdef(const QNdefMessage &message);
+ bool shareFiles(const QList<QFileInfo> &files);
+ void cancel();
+
+ void setShareMode(bb::system::NfcShareMode::Type type);
+ bb::system::NfcShareMode::Type shareMode() const;
+
+ void connect(QObject *obj);
+ void disconnect(QObject *obj);
+
+ void reset();
+
+ static QNearFieldShareManager::ShareError toShareError(bb::system::NfcShareError::Type nfcShareError);
+ static QNearFieldShareManager::ShareModes toShareModes(bb::system::NfcShareMode::Type nfcShareMode);
+
+private:
+ bb::system::NfcShareManager *_manager;
+ static const char *RECORD_NDEF;
+
+Q_SIGNALS:
+ void shareModeChanged(bb::system::NfcShareMode::Type);
+ void error(bb::system::NfcShareError::Type);
+ void finished(bb::system::NfcShareSuccess::Type);
+ void targetAcquired();
+ void targetCancelled();
+};
+
+QT_END_NAMESPACE
+
+#endif /* QNXNFCSHAREMANAGER_P_H */
diff --git a/src/nfc/qqmlndefrecord.cpp b/src/nfc/qqmlndefrecord.cpp
index 8a3f24d7..c94578eb 100644
--- a/src/nfc/qqmlndefrecord.cpp
+++ b/src/nfc/qqmlndefrecord.cpp
@@ -262,6 +262,7 @@ QQmlNdefRecord::QQmlNdefRecord(const QNdefRecord &record, QObject *parent)
\value Uri The NDEF record type follows the construct described in RFC 3986.
\value ExternalRtd The NDEF record type follows the construct for external type names
described the NFC RTD Specification.
+ \value Unknown The NDEF record type is unknown.
*/
/*!