summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.tests/libbb2/libbb2.pro5
-rw-r--r--config.tests/libbb2/main.cpp39
-rw-r--r--examples/nfc/corkboard/bar-descriptor.xml32
-rw-r--r--examples/nfc/corkboard/corkboards.qml2
-rw-r--r--qtconnectivity.pro1
-rw-r--r--src/nfc/doc/src/nfc-blackberry.qdoc52
-rw-r--r--src/nfc/doc/src/nfc-index.qdoc3
-rw-r--r--src/nfc/nfc.pro45
-rw-r--r--src/nfc/qllcpserver.cpp2
-rw-r--r--src/nfc/qllcpserver_qnx_p.cpp120
-rw-r--r--src/nfc/qllcpserver_qnx_p.h86
-rw-r--r--src/nfc/qllcpsocket.cpp2
-rw-r--r--src/nfc/qllcpsocket_qnx_p.cpp309
-rw-r--r--src/nfc/qllcpsocket_qnx_p.h128
-rw-r--r--src/nfc/qnearfieldmanager.cpp4
-rw-r--r--src/nfc/qnearfieldmanager_qnx.cpp238
-rw-r--r--src/nfc/qnearfieldmanager_qnx_p.h95
-rw-r--r--src/nfc/qnearfieldsharemanager.cpp4
-rw-r--r--src/nfc/qnearfieldsharemanager_qnx_p.cpp143
-rw-r--r--src/nfc/qnearfieldsharemanager_qnx_p.h86
-rw-r--r--src/nfc/qnearfieldsharetarget.cpp4
-rw-r--r--src/nfc/qnearfieldsharetarget_qnx_p.cpp112
-rw-r--r--src/nfc/qnearfieldsharetarget_qnx_p.h88
-rw-r--r--src/nfc/qnearfieldtarget_qnx_p.h227
-rw-r--r--src/nfc/qnx/qnxnfceventfilter.cpp95
-rw-r--r--src/nfc/qnx/qnxnfceventfilter_p.h78
-rw-r--r--src/nfc/qnx/qnxnfcmanager.cpp484
-rw-r--r--src/nfc/qnx/qnxnfcmanager_p.h143
-rw-r--r--src/nfc/qnx/qnxnfcsharemanager_p.cpp272
-rw-r--r--src/nfc/qnx/qnxnfcsharemanager_p.h93
30 files changed, 3 insertions, 2989 deletions
diff --git a/config.tests/libbb2/libbb2.pro b/config.tests/libbb2/libbb2.pro
deleted file mode 100644
index 92c9b765..00000000
--- a/config.tests/libbb2/libbb2.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-TEMPLATE = app
-
-TARGET = blackberry
-
-SOURCES += main.cpp
diff --git a/config.tests/libbb2/main.cpp b/config.tests/libbb2/main.cpp
deleted file mode 100644
index f606744b..00000000
--- a/config.tests/libbb2/main.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtConnectivity module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** 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 The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#define BB_CORE_GLOBAL_HPP
-#include "bb2/bb/Global"
-
-int main()
-{
- return 0;
-}
diff --git a/examples/nfc/corkboard/bar-descriptor.xml b/examples/nfc/corkboard/bar-descriptor.xml
deleted file mode 100644
index f46eb355..00000000
--- a/examples/nfc/corkboard/bar-descriptor.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="no"?>
-<qnx >
- <id>com.qt-project.cork</id>
- <filename>corkboard</filename>
- <name>NFC Corkboard</name>
- <versionNumber>1.0.0</versionNumber>
-
- <!-- adding the invoke target for a nfc Text element -->
- <invoke-target id="com.fabian.cork">
- <type>APPLICATION</type>
- <filter>
- <action>bb.action.OPEN</action>
- <mime-type>application/vnd.rim.nfc.ndef</mime-type>
- <property var="uris" value="ndef://1/T"/>
- </filter>
- </invoke-target>
-
- <initialWindow>
- <systemChrome>none</systemChrome>
- <transparent>false</transparent>
- <autoOrients>true</autoOrients>
- <aspectRatio>portrait</aspectRatio>
- </initialWindow>
-
- <permission system="true">run_native</permission>
-
- <asset entry="true" path="qml_corkboard" type="Qnx/Elf">qml_corkboard</asset>
- <asset path="icon.png">icon.png</asset>
- <icon>
- <image>icon.png</image>
- </icon>
- </qnx>
diff --git a/examples/nfc/corkboard/corkboards.qml b/examples/nfc/corkboard/corkboards.qml
index 2f00bb5a..dc96865a 100644
--- a/examples/nfc/corkboard/corkboards.qml
+++ b/examples/nfc/corkboard/corkboards.qml
@@ -101,7 +101,7 @@ Rectangle {
name: "Work"
notes: [
//ListElement { noteText: "To write a tag, click the red flag of a note and then touch a tag" },
- ListElement { noteText: "https://developer.blackberry.com/native/documentation/core/com.qnx.doc.nfc/topic/manual/c_stub_nfcdevguide_general_introduction.html" }
+ ListElement { noteText: "https://www.qt.io" }
]
}
}
diff --git a/qtconnectivity.pro b/qtconnectivity.pro
index 115bd3ed..82346519 100644
--- a/qtconnectivity.pro
+++ b/qtconnectivity.pro
@@ -1,5 +1,4 @@
load(configure)
qtCompileTest(bluez)
qtCompileTest(bluez_le)
-qtCompileTest(libbb2)
load(qt_parts)
diff --git a/src/nfc/doc/src/nfc-blackberry.qdoc b/src/nfc/doc/src/nfc-blackberry.qdoc
deleted file mode 100644
index feebceb8..00000000
--- a/src/nfc/doc/src/nfc-blackberry.qdoc
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
-\ingroup connectivity-nfc
-\inmodule QtNfc
-\since 5.6
-\page nfc-blackberry.html
-\title Qt NFC on Blackberry
-\brief Notes on Nfc for Blackberry.
-
-\section1 Automatically launching NDEF message handlers on Blackberry
-On BlackBerry the registration for NDEF message handlers is done over the
-\l{https://developer.blackberry.com/native/documentation/core/invocation_framework.html}{Invocation Framework}.
-This means that the application has to set an invoke target in the bar descriptor xml file when using
-\l registerNdefMessageHandler().
-
-\code
-<invoke-target id="com.myapp.id">
- <type>APPLICATION</type>
- <filter>
- <action>bb.action.OPEN</action>
- <mime-type>application/vnd.rim.nfc.ndef</mime-type>
- </filter>
-</invoke-target>
-\endcode
-*/
-
diff --git a/src/nfc/doc/src/nfc-index.qdoc b/src/nfc/doc/src/nfc-index.qdoc
index b295f7ec..da8833d8 100644
--- a/src/nfc/doc/src/nfc-index.qdoc
+++ b/src/nfc/doc/src/nfc-index.qdoc
@@ -35,8 +35,7 @@
The NFC API provides connectivity between NFC enabled devices.
Currently the API is supported on \l{Qt for Android}{Android},
-\l{Qt for BlackBerry}{BlackBerry 10} and \l{Qt for Linux/X11}{Linux} using
-\l {https://01.org/linux-nfc}{Neard} v0.14 or later.
+and \l{Qt for Linux/X11}{Linux} using \l {https://01.org/linux-nfc}{Neard} v0.14 or later.
\section1 Overview
diff --git a/src/nfc/nfc.pro b/src/nfc/nfc.pro
index 83b8e236..16737e73 100644
--- a/src/nfc/nfc.pro
+++ b/src/nfc/nfc.pro
@@ -56,50 +56,7 @@ SOURCES += \
qnearfieldsharetarget.cpp \
qnfc.cpp
-CONFIG(blackberry) {
- NFC_BACKEND_AVAILABLE = yes
- DEFINES += QNX_NFC #QQNXNFC_DEBUG
-
- LIBS += -lnfc
-
- PRIVATE_HEADERS += \
- qllcpserver_qnx_p.h \
- qllcpsocket_qnx_p.h \
- qnearfieldmanager_qnx_p.h \
- qnx/qnxnfcmanager_p.h \
- qnearfieldtarget_qnx_p.h \
- qnx/qnxnfceventfilter_p.h
-
- SOURCES += \
- qllcpserver_qnx_p.cpp \
- qllcpsocket_qnx_p.cpp \
- 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
- }
-
-} else:linux:!android:qtHaveModule(dbus) {
+linux:!android:qtHaveModule(dbus) {
NFC_BACKEND_AVAILABLE = yes
QT += dbus
diff --git a/src/nfc/qllcpserver.cpp b/src/nfc/qllcpserver.cpp
index 4ee26eaf..17fb3369 100644
--- a/src/nfc/qllcpserver.cpp
+++ b/src/nfc/qllcpserver.cpp
@@ -35,8 +35,6 @@
#if defined(QT_SIMULATOR)
#include "qllcpserver_simulator_p.h"
-#elif defined(QNX_NFC)
-#include "qllcpserver_qnx_p.h"
#else
#include "qllcpserver_p_p.h"
#endif
diff --git a/src/nfc/qllcpserver_qnx_p.cpp b/src/nfc/qllcpserver_qnx_p.cpp
deleted file mode 100644
index 41168798..00000000
--- a/src/nfc/qllcpserver_qnx_p.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2012 Research In Motion
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtNfc module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** 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 The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qllcpserver_qnx_p.h"
-#include "qnx/qnxnfcmanager_p.h"
-
-QT_BEGIN_NAMESPACE
-
-QLlcpServerPrivate::QLlcpServerPrivate(QLlcpServer *q)
- : q_ptr(q), m_llcpSocket(0), m_connected(false), m_conListener(0)
-{
-}
-
-bool QLlcpServerPrivate::listen(const QString &serviceUri)
-{
- //The server is already listening
- if (isListening())
- return false;
-
- nfc_result_t result = nfc_llcp_register_connection_listener(NFC_LLCP_SERVER, 0, serviceUri.toStdString().c_str(), &m_conListener);
- m_connected = true;
- if (result == NFC_RESULT_SUCCESS) {
- m_serviceUri = serviceUri;
- qQNXNFCDebug() << "LLCP server registered" << serviceUri;
- } else {
- qWarning() << Q_FUNC_INFO << "Could not register for llcp connection listener";
- return false;
- }
- QNXNFCManager::instance()->registerLLCPConnection(m_conListener, this);
- return true;
-}
-
-bool QLlcpServerPrivate::isListening() const
-{
- return m_connected;
-}
-
-void QLlcpServerPrivate::close()
-{
- nfc_llcp_unregister_connection_listener(m_conListener);
- QNXNFCManager::instance()->unregisterLLCPConnection(m_conListener);
- m_serviceUri = QString();
- m_connected = false;
-}
-
-QString QLlcpServerPrivate::serviceUri() const
-{
- return m_serviceUri;
-}
-
-quint8 QLlcpServerPrivate::serverPort() const
-{
- unsigned int sap;
- if (nfc_llcp_get_local_sap(m_target, &sap) == NFC_RESULT_SUCCESS) {
- return sap;
- }
- return -1;
-}
-
-bool QLlcpServerPrivate::hasPendingConnections() const
-{
- return m_llcpSocket != 0;
-}
-
-QLlcpSocket *QLlcpServerPrivate::nextPendingConnection()
-{
- QLlcpSocket *socket = m_llcpSocket;
- m_llcpSocket = 0;
- return socket;
-}
-
-QLlcpSocket::SocketError QLlcpServerPrivate::serverError() const
-{
- return QLlcpSocket::UnknownSocketError;
-}
-
-void QLlcpServerPrivate::connected(nfc_target_t *target)
-{
- m_target = target;
- if (m_llcpSocket != 0) {
- qWarning() << Q_FUNC_INFO << "LLCP socket not cloesed properly";
- return;
- }
- m_llcpSocket = new QLlcpSocket();
- m_llcpSocket->bind(serverPort());
-}
-
-QT_END_NAMESPACE
-
-
diff --git a/src/nfc/qllcpserver_qnx_p.h b/src/nfc/qllcpserver_qnx_p.h
deleted file mode 100644
index 16e33784..00000000
--- a/src/nfc/qllcpserver_qnx_p.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2013 Research In Motion
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtNfc module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** 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 The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QLLCPSERVER_QNX_P_H
-#define QLLCPSERVER_QNX_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qllcpserver_p.h"
-#include "nfc/nfc.h"
-
-QT_BEGIN_NAMESPACE
-
-class QLlcpServerPrivate : public QObject
-{
- Q_OBJECT
-public:
- QLlcpServerPrivate(QLlcpServer *q);
-
- bool listen(const QString &serviceUri);
- bool isListening() const;
-
- void close();
-
- QString serviceUri() const;
- quint8 serverPort() const;
-
- bool hasPendingConnections() const;
- QLlcpSocket *nextPendingConnection();
-
- QLlcpSocket::SocketError serverError() const;
-
- Q_INVOKABLE void connected(nfc_target_t *);
-
-private:
- QLlcpServer *q_ptr;
- QLlcpSocket *m_llcpSocket;
- //We can not use m_conListener for the connection state
- bool m_connected;
- nfc_llcp_connection_listener_t m_conListener;
- QString m_serviceUri;
- nfc_target_t *m_target;
-};
-
-QT_END_NAMESPACE
-
-#endif // QLLCPSERVER_QNX_P_H
diff --git a/src/nfc/qllcpsocket.cpp b/src/nfc/qllcpsocket.cpp
index ae23f89c..07c0bfbb 100644
--- a/src/nfc/qllcpsocket.cpp
+++ b/src/nfc/qllcpsocket.cpp
@@ -35,8 +35,6 @@
#if defined(QT_SIMULATOR)
#include "qllcpsocket_simulator_p.h"
-#elif defined(QNX_NFC)
-#include "qllcpsocket_qnx_p.h"
#else
#include "qllcpsocket_p_p.h"
#endif
diff --git a/src/nfc/qllcpsocket_qnx_p.cpp b/src/nfc/qllcpsocket_qnx_p.cpp
deleted file mode 100644
index 2351a524..00000000
--- a/src/nfc/qllcpsocket_qnx_p.cpp
+++ /dev/null
@@ -1,309 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2012 Research In Motion
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtNfc module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** 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 The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qllcpsocket_qnx_p.h"
-#include <unistd.h>
-
-QT_BEGIN_NAMESPACE
-
-QLlcpSocketPrivate::QLlcpSocketPrivate(QLlcpSocket *q)
- : q_ptr(q), m_conListener(0), m_state(QLlcpSocket::UnconnectedState), m_server(false)
-{
-}
-
-QLlcpSocketPrivate::~QLlcpSocketPrivate()
-{
- disconnectFromService();
-}
-
-void QLlcpSocketPrivate::connectToService(QNearFieldTarget *target, const QString &serviceUri)
-{
- Q_UNUSED(target)
- if (m_state != QLlcpSocket::UnconnectedState) {
- qWarning() << Q_FUNC_INFO << "socket is already connected";
- return;
- }
-
- m_state = QLlcpSocket::ConnectingState;
- if (nfc_llcp_register_connection_listener(NFC_LLCP_CLIENT, 0, serviceUri.toLocal8Bit().constData(),
- &m_conListener) != NFC_RESULT_SUCCESS) {
- qWarning() << Q_FUNC_INFO << "could not register for connection listener";
- return;
- }
-
- QNXNFCManager::instance()->registerLLCPConnection(m_conListener, this);
-
- qQNXNFCDebug() << "Connecting client socket" << serviceUri << m_conListener;
- connect(QNXNFCManager::instance(), SIGNAL(llcpDisconnected()), this, SLOT(disconnectFromService()));
-}
-
-void QLlcpSocketPrivate::disconnectFromService()
-{
- Q_Q(QLlcpSocket);
- QNXNFCManager::instance()->unregisterTargetLost(this);
- qQNXNFCDebug() << "Shutting down LLCP socket";
- if (!m_server && nfc_llcp_unregister_connection_listener(m_conListener) != NFC_RESULT_SUCCESS) {
- qWarning() << Q_FUNC_INFO << "Error when trying to close LLCP socket";
- }
- QNXNFCManager::instance()->unregisterLLCPConnection(m_conListener);
- disconnect(QNXNFCManager::instance(), SIGNAL(llcpDisconnected()), this, SLOT(disconnectFromService()));
-
- q->disconnected();
- m_conListener = 0;
- m_state = QLlcpSocket::UnconnectedState;
-}
-
-bool QLlcpSocketPrivate::bind(quint8 port)
-{
- Q_UNUSED(port);
-
- m_state = QLlcpSocket::ConnectedState;
- m_server = true;
- connect(QNXNFCManager::instance(), SIGNAL(llcpDisconnected()), this, SLOT(disconnectFromService()));
- connected(QNXNFCManager::instance()->getLastTarget());
-
- return true;
-}
-
-bool QLlcpSocketPrivate::hasPendingDatagrams() const
-{
- return !m_receivedDatagrams.isEmpty();
-}
-
-qint64 QLlcpSocketPrivate::pendingDatagramSize() const
-{
- if (m_receivedDatagrams.isEmpty())
- return -1;
-
- return m_receivedDatagrams.first().length();
-}
-
-qint64 QLlcpSocketPrivate::writeDatagram(const char *data, qint64 size)
-{
- if (m_state == QLlcpSocket::ConnectedState)
- return writeData(data, size);
-
- return -1;
-}
-
-qint64 QLlcpSocketPrivate::writeDatagram(const QByteArray &datagram)
-{
- return writeDatagram(datagram.constData(), datagram.size());
-}
-
-qint64 QLlcpSocketPrivate::readDatagram(char *data, qint64 maxSize,
- QNearFieldTarget **target, quint8 *port)
-{
- Q_UNUSED(target);
- Q_UNUSED(port);
-
- if (m_state == QLlcpSocket::ConnectedState)
- return readData(data, maxSize);
-
- return -1;
-}
-
-qint64 QLlcpSocketPrivate::writeDatagram(const char *data, qint64 size,
- QNearFieldTarget *target, quint8 port)
-{
- Q_UNUSED(target);
- Q_UNUSED(port);
-
- return writeDatagram(data, size);
-}
-
-qint64 QLlcpSocketPrivate::writeDatagram(const QByteArray &datagram,
- QNearFieldTarget *target, quint8 port)
-{
- Q_UNUSED(datagram);
- Q_UNUSED(target);
- Q_UNUSED(port);
-
- return writeDatagram(datagram.constData(), datagram.size()-1);
-}
-
-QLlcpSocket::SocketError QLlcpSocketPrivate::error() const
-{
- return QLlcpSocket::UnknownSocketError;
-}
-
-QLlcpSocket::SocketState QLlcpSocketPrivate::state() const
-{
- return m_state;
-}
-
-qint64 QLlcpSocketPrivate::readData(char *data, qint64 maxlen)
-{
- if (m_receivedDatagrams.isEmpty())
- return 0;
-
- const QByteArray datagram = m_receivedDatagrams.takeFirst();
- qint64 size = qMin(maxlen, qint64(datagram.length()));
- memcpy(data, datagram.constData(), size);
- return size;
-}
-
-qint64 QLlcpSocketPrivate::writeData(const char *data, qint64 len)
-{
- if (socketState != Idle) {
- m_writeQueue.append(QByteArray(data, len));
- return len;
- } else {
- socketState = Writing;
- qQNXNFCDebug() << "LLCP write";
- nfc_result_t res = nfc_llcp_write(m_target, (uchar_t*)data, (size_t)len);
- if (res == NFC_RESULT_SUCCESS) {
- return len;
- } else {
- qWarning() << Q_FUNC_INFO << "Error writing to LLCP socket. Error" << res;
- enteringIdle();
- return -1;
- }
- }
-}
-
-qint64 QLlcpSocketPrivate::bytesAvailable() const
-{
- qint64 available = 0;
- foreach (const QByteArray &datagram, m_receivedDatagrams)
- available += datagram.length();
-
- return available;
-}
-
-bool QLlcpSocketPrivate::canReadLine() const
-{
- foreach (const QByteArray &datagram, m_receivedDatagrams) {
- if (datagram.contains('\n'))
- return true;
- }
-
- return false;
-}
-
-bool QLlcpSocketPrivate::waitForReadyRead(int msecs)
-{
- Q_UNUSED(msecs);
-
- return false;
-}
-
-bool QLlcpSocketPrivate::waitForBytesWritten(int msecs)
-{
- Q_UNUSED(msecs);
-
- return false;
-}
-
-bool QLlcpSocketPrivate::waitForConnected(int msecs)
-{
- Q_UNUSED(msecs);
-
- return false;
-}
-
-bool QLlcpSocketPrivate::waitForDisconnected(int msecs)
-{
- Q_UNUSED(msecs);
-
- return false;
-}
-
-void QLlcpSocketPrivate::connected(nfc_target_t *target)
-{
- Q_Q(QLlcpSocket);
- m_target = target;
-
- m_state = QLlcpSocket::ConnectedState;
- emit q->connected();
- qQNXNFCDebug() << "Socket connected";
-
- unsigned int targetId;
- nfc_get_target_connection_id(target, &targetId);
- QNXNFCManager::instance()->requestTargetLost(this, targetId);
- enteringIdle();
-}
-
-void QLlcpSocketPrivate::targetLost()
-{
- disconnectFromService();
- qQNXNFCDebug() << "LLCP target lost...socket disconnected";
-}
-
-void QLlcpSocketPrivate::dataRead(QByteArray& data)
-{
- Q_Q(QLlcpSocket);
- if (!data.isEmpty()) {
- m_receivedDatagrams.append(data);
- emit q->readyRead();
- }
- socketState = Idle;
- enteringIdle();
-}
-
-void QLlcpSocketPrivate::dataWritten()
-{
- enteringIdle();
-}
-
-void QLlcpSocketPrivate::read()
-{
- if (socketState != Idle) {
- qQNXNFCDebug() << "Trying to read but socket state not in idle..abort";
- return;
- }
- socketState = Reading;
- qQNXNFCDebug() << "LLCP read";
- if (nfc_llcp_read(m_target, 128) != NFC_RESULT_SUCCESS) {
- qWarning() << Q_FUNC_INFO << "Could not register for reading";
- socketState = Idle;
- }
-}
-
-void QLlcpSocketPrivate::enteringIdle()
-{
- qQNXNFCDebug() << "entering idle; Socket state:" << socketState;
- socketState = Idle;
- if (m_state == QLlcpSocket::ConnectedState) {
- if (m_writeQueue.isEmpty()) {
- qQNXNFCDebug() << "Write queue empty, reading in 50ms";
- QTimer::singleShot(50, this, SLOT(read()));
- } else {
- qQNXNFCDebug() << "Write first package in queue";
- writeDatagram(m_writeQueue.takeFirst());
- }
- }
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/nfc/qllcpsocket_qnx_p.h b/src/nfc/qllcpsocket_qnx_p.h
deleted file mode 100644
index 5e3b2c06..00000000
--- a/src/nfc/qllcpsocket_qnx_p.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2013 Research In Motion
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtNfc module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** 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 The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QLLCPSOCKET_QNX_P_H
-#define QLLCPSOCKET_QNX_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qllcpsocket_p.h"
-
-#include "qnearfieldtarget_qnx_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QLlcpSocketPrivate : public QObject
-{
- Q_OBJECT
- Q_DECLARE_PUBLIC(QLlcpSocket)
-
-public:
- QLlcpSocketPrivate(QLlcpSocket *q);
-
- ~QLlcpSocketPrivate();
-
- void connectToService(QNearFieldTarget *target, const QString &serviceUri);
-
- bool bind(quint8 port);
-
- bool hasPendingDatagrams() const;
- qint64 pendingDatagramSize() const;
-
- qint64 writeDatagram(const char *data, qint64 size);
- qint64 writeDatagram(const QByteArray &datagram);
-
- qint64 readDatagram(char *data, qint64 maxSize,
- QNearFieldTarget **target = 0, quint8 *port = 0);
- qint64 writeDatagram(const char *data, qint64 size,
- QNearFieldTarget *target, quint8 port);
- qint64 writeDatagram(const QByteArray &datagram, QNearFieldTarget *target, quint8 port);
-
- QLlcpSocket::SocketError error() const;
- QLlcpSocket::SocketState state() const;
-
- qint64 readData(char *data, qint64 maxlen);
- qint64 writeData(const char *data, qint64 len);
-
- qint64 bytesAvailable() const;
- bool canReadLine() const;
-
- bool waitForReadyRead(int msecs);
- bool waitForBytesWritten(int msecs);
- bool waitForConnected(int msecs);
- bool waitForDisconnected(int msecs);
-
- Q_INVOKABLE void connected(nfc_target_t *);
- Q_INVOKABLE void targetLost();
-
- void dataRead(QByteArray&);
- void dataWritten();
-
-public slots:
- void disconnectFromService();
-
-private:
- QLlcpSocket *q_ptr;
- unsigned int m_sap;
- nfc_llcp_connection_listener_t m_conListener;
- //NearFieldTarget *m_target;
- nfc_target_t *m_target;
-
- QLlcpSocket::SocketState m_state;
-
- QList<QByteArray> m_receivedDatagrams;
- QList<QByteArray> m_writeQueue;
-
- bool m_server;
-
- enum llcpState {
- Idle, Reading, Writing
- } socketState;
-
-private slots:
- void read();
- void enteringIdle();
-};
-
-QT_END_NAMESPACE
-
-#endif // QLLCPSOCKET_QNX_P_H
diff --git a/src/nfc/qnearfieldmanager.cpp b/src/nfc/qnearfieldmanager.cpp
index 84f00d91..d3ebb43f 100644
--- a/src/nfc/qnearfieldmanager.cpp
+++ b/src/nfc/qnearfieldmanager.cpp
@@ -36,8 +36,6 @@
#if defined(QT_SIMULATOR)
#include "qnearfieldmanager_simulator_p.h"
-#elif defined(QNX_NFC)
-#include "qnearfieldmanager_qnx_p.h"
#elif defined(NEARD_NFC)
#include "qnearfieldmanager_neard_p.h"
#elif defined(ANDROID_NFC)
@@ -103,8 +101,6 @@ QT_BEGIN_NAMESPACE
\snippet doc_src_qtnfc.cpp handleNdefMessage
Automatically launching NDEF message handlers is supported on
- \l{nfc-blackberry.html}{Blackberry}
- and
\l{nfc-android.html}{Android}.
\section3 NFC on Linux
diff --git a/src/nfc/qnearfieldmanager_qnx.cpp b/src/nfc/qnearfieldmanager_qnx.cpp
deleted file mode 100644
index f4508bd8..00000000
--- a/src/nfc/qnearfieldmanager_qnx.cpp
+++ /dev/null
@@ -1,238 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2012 Research In Motion
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtNfc module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** 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 The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qnearfieldmanager_qnx_p.h"
-#include <QDebug>
-#include "qnearfieldtarget_qnx_p.h"
-#include <QMetaMethod>
-#include "qndeffilter.h"
-#include "qndefrecord.h"
-
-QT_BEGIN_NAMESPACE
-
-QNearFieldManagerPrivateImpl::QNearFieldManagerPrivateImpl() :
- m_handlerID(0)
-{
- QNXNFCManager::instance()->registerForNewInstance();
- connect(QNXNFCManager::instance(), SIGNAL(ndefMessage(QNdefMessage,QNearFieldTarget*)), this, SLOT(handleMessage(QNdefMessage,QNearFieldTarget*)));
-
- m_requestedModes = QNearFieldManager::NdefWriteTargetAccess;
- qQNXNFCDebug() << "Nearfieldmanager created";
-}
-
-QNearFieldManagerPrivateImpl::~QNearFieldManagerPrivateImpl()
-{
- //First, remove all ndef message handlers
- QNXNFCManager::instance()->updateNdefFilters(QList<QByteArray>(), this);
- QNXNFCManager::instance()->unregisterForInstance();
-}
-
-bool QNearFieldManagerPrivateImpl::isAvailable() const
-{
- return QNXNFCManager::instance()->isAvailable();
-}
-
-bool QNearFieldManagerPrivateImpl::startTargetDetection()
-{
- qQNXNFCDebug() << "Starting targetdetection in nearfieldmanager";
- if (QNXNFCManager::instance()->startTargetDetection()) {
- 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";
- return false;
- }
-}
-
-void QNearFieldManagerPrivateImpl::stopTargetDetection()
-{
- disconnect(QNXNFCManager::instance(), SIGNAL(targetDetected(NearFieldTarget*,QList<QNdefMessage>)),
- this, SLOT(newTarget(NearFieldTarget*,QList<QNdefMessage>)));
- QNXNFCManager::instance()->unregisterTargetDetection(this);
-}
-
-int QNearFieldManagerPrivateImpl::registerNdefMessageHandler(QObject *object, const QMetaMethod &method)
-{
- QList<QByteArray> filterList;
- filterList += '*';
- QNXNFCManager::instance()->updateNdefFilters(filterList, this);
-
- ndefMessageHandlers.append(QPair<QPair<int, QObject *>, QMetaMethod>(QPair<int, QObject *>(m_handlerID, object), method));
-
- //Returns the handler ID and increments it afterwards
- return m_handlerID++;
-}
-
-int QNearFieldManagerPrivateImpl::registerNdefMessageHandler(const QNdefFilter &filter,
- QObject *object, const QMetaMethod &method)
-{
- //If no record is set in the filter, we ignore the filter
- if (filter.recordCount()==0)
- return registerNdefMessageHandler(object, method);
-
- ndefFilterHandlers.append(QPair<QPair<int, QObject*>, QPair<QNdefFilter, QMetaMethod> >
- (QPair<int, QObject*>(m_handlerID, object), QPair<QNdefFilter, QMetaMethod>(filter, method)));
-
- updateNdefFilter();
-
- return m_handlerID++;
-}
-
-bool QNearFieldManagerPrivateImpl::unregisterNdefMessageHandler(int handlerId)
-{
- for (int i=0; i<ndefMessageHandlers.count(); i++) {
- if (ndefMessageHandlers.at(i).first.first == handlerId) {
- ndefMessageHandlers.removeAt(i);
- updateNdefFilter();
- return true;
- }
- }
- for (int i=0; i<ndefFilterHandlers.count(); i++) {
- if (ndefFilterHandlers.at(i).first.first == handlerId) {
- ndefFilterHandlers.removeAt(i);
- updateNdefFilter();
- return true;
- }
- }
- return false;
-}
-
-void QNearFieldManagerPrivateImpl::requestAccess(QNearFieldManager::TargetAccessModes accessModes)
-{
- Q_UNUSED(accessModes);
- //Do nothing, because we don't have access modes for the target
-}
-
-void QNearFieldManagerPrivateImpl::releaseAccess(QNearFieldManager::TargetAccessModes accessModes)
-{
- Q_UNUSED(accessModes);
- //Do nothing, because we don't have access modes for the target
-}
-
-struct VerifyRecord
-{
- QNdefFilter::Record filterRecord;
- unsigned int count;
-};
-
-void QNearFieldManagerPrivateImpl::handleMessage(const QNdefMessage &message, QNearFieldTarget *target)
-{
- qQNXNFCDebug() << "Handling message in near field manager. Filtercount:"
- << ndefFilterHandlers.count() << message.count();
- //For message handlers without filters
- for (int i = 0; i < ndefMessageHandlers.count(); i++) {
- ndefMessageHandlers.at(i).second.invoke(ndefMessageHandlers.at(i).first.second, Q_ARG(QNdefMessage, message), Q_ARG(QNearFieldTarget*, target));
- }
-
- //For message handlers that specified a filter
- for (int i = 0; i < ndefFilterHandlers.count(); i++) {
- bool matched = true;
-
- QNdefFilter filter = ndefFilterHandlers.at(i).second.first;
-
- QList<VerifyRecord> filterRecords;
- for (int j = 0; j < filter.recordCount(); ++j) {
- VerifyRecord vr;
- vr.count = 0;
- vr.filterRecord = filter.recordAt(j);
-
- filterRecords.append(vr);
- }
-
- foreach (const QNdefRecord &record, message) {
- for (int j = 0; matched && (j < filterRecords.count()); ++j) {
- VerifyRecord &vr = filterRecords[j];
-
- if (vr.filterRecord.typeNameFormat == record.typeNameFormat() &&
- ( vr.filterRecord.type == record.type() ||
- vr.filterRecord.type.isEmpty()) ) {
- ++vr.count;
- break;
- } else {
- if (filter.orderMatch()) {
- if (vr.filterRecord.minimum <= vr.count &&
- vr.count <= vr.filterRecord.maximum) {
- continue;
- } else {
- matched = false;
- }
- }
- }
- }
- }
-
- for (int j = 0; matched && (j < filterRecords.count()); ++j) {
- const VerifyRecord &vr = filterRecords.at(j);
-
- if (vr.filterRecord.minimum <= vr.count && vr.count <= vr.filterRecord.maximum)
- continue;
- else
- matched = false;
- }
-
- if (matched) {
- ndefFilterHandlers.at(i).second.second.invoke(ndefFilterHandlers.at(i).first.second, Q_ARG(QNdefMessage, message), Q_ARG(QNearFieldTarget*, target));
- }
- }
-}
-
-void QNearFieldManagerPrivateImpl::newTarget(QNearFieldTarget *target, const QList<QNdefMessage> &messages)
-{
- Q_UNUSED(messages)
- qQNXNFCDebug() << "New Target";
- emit targetDetected(target);
-}
-
-void QNearFieldManagerPrivateImpl::updateNdefFilter()
-{
- qQNXNFCDebug() << "Updating NDEF filter";
- QList<QByteArray> filterList;
- if (ndefMessageHandlers.size() > 0) { ///SUbscribe for all ndef messages
- filterList += '*';
- QNXNFCManager::instance()->updateNdefFilters(filterList, this);
- } else if (ndefFilterHandlers.size() > 0){
- for (int i = 0; i < ndefFilterHandlers.count(); i++) {
- QByteArray filter = "ndef://" + QByteArray::number(ndefFilterHandlers.at(i).second.first.recordAt(0).typeNameFormat)
- + '/' + ndefFilterHandlers.at(i).second.first.recordAt(0).type;
- if (!filterList.contains(filter))
- filterList.append(filter);
- }
- QNXNFCManager::instance()->updateNdefFilters(filterList, this);
- } else { //Remove all ndef message handlers for this object
- QNXNFCManager::instance()->updateNdefFilters(filterList, this);
- }
-}
-
-
-QT_END_NAMESPACE
diff --git a/src/nfc/qnearfieldmanager_qnx_p.h b/src/nfc/qnearfieldmanager_qnx_p.h
deleted file mode 100644
index 6f00041a..00000000
--- a/src/nfc/qnearfieldmanager_qnx_p.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2012 Research In Motion
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtNfc module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** 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 The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QNEARFIELDMANAGER_QNX_P_H
-#define QNEARFIELDMANAGER_QNX_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qnearfieldmanager_p.h"
-#include "qnearfieldmanager.h"
-#include "qnearfieldtarget.h"
-
-#include "qnx/qnxnfcmanager_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QNearFieldManagerPrivateImpl : public QNearFieldManagerPrivate
-{
- Q_OBJECT
-
-public:
- QNearFieldManagerPrivateImpl();
- ~QNearFieldManagerPrivateImpl();
-
- bool isAvailable() const;
-
- bool startTargetDetection();
-
- void stopTargetDetection();
-
- int registerNdefMessageHandler(QObject *object, const QMetaMethod &method);
-
- int registerNdefMessageHandler(const QNdefFilter &filter, QObject *object, const QMetaMethod &method);
-
- bool unregisterNdefMessageHandler(int handlerId);
-
- void requestAccess(QNearFieldManager::TargetAccessModes accessModes);
-
- void releaseAccess(QNearFieldManager::TargetAccessModes accessModes);
-
-private slots:
- void handleMessage(const QNdefMessage&, QNearFieldTarget *);
- void newTarget(QNearFieldTarget *target, const QList<QNdefMessage> &);
-
-private:
- void updateNdefFilter();
- QList<QNearFieldTarget::Type> m_detectTargetTypes;
-
- int m_handlerID;
- QList< QPair<QPair<int, QObject *>, QMetaMethod> > ndefMessageHandlers;
- QList< QPair<QPair<int, QObject *>, QPair<QNdefFilter, QMetaMethod> > > ndefFilterHandlers;
-};
-
-QT_END_NAMESPACE
-
-#endif // QNEARFIELDMANAGER_QNX_P_H
diff --git a/src/nfc/qnearfieldsharemanager.cpp b/src/nfc/qnearfieldsharemanager.cpp
index e9b70739..c0c031dd 100644
--- a/src/nfc/qnearfieldsharemanager.cpp
+++ b/src/nfc/qnearfieldsharemanager.cpp
@@ -34,11 +34,7 @@
#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"
diff --git a/src/nfc/qnearfieldsharemanager_qnx_p.cpp b/src/nfc/qnearfieldsharemanager_qnx_p.cpp
deleted file mode 100644
index dd2814d6..00000000
--- a/src/nfc/qnearfieldsharemanager_qnx_p.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-/***************************************************************************
- **
- ** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
- ** Contact: http://www.qt.io/licensing/
- **
- ** This file is part of the QtNfc module of the Qt Toolkit.
- **
- ** $QT_BEGIN_LICENSE:LGPL21$
- ** 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 The Qt Company. For licensing terms
- ** and conditions see http://www.qt.io/terms-conditions. For further
- ** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free
- ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
- ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
- ** following information to ensure the GNU Lesser General Public License
- ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
- ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
- **
- ** As a special exception, The Qt Company gives you certain additional
- ** rights. These rights are described in The Qt Company LGPL Exception
- ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
- **
- ** $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
deleted file mode 100644
index c5cea224..00000000
--- a/src/nfc/qnearfieldsharemanager_qnx_p.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/***************************************************************************
- **
- ** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
- ** Contact: http://www.qt.io/licensing/
- **
- ** This file is part of the QtNfc module of the Qt Toolkit.
- **
- ** $QT_BEGIN_LICENSE:LGPL21$
- ** 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 The Qt Company. For licensing terms
- ** and conditions see http://www.qt.io/terms-conditions. For further
- ** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free
- ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
- ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
- ** following information to ensure the GNU Lesser General Public License
- ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
- ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
- **
- ** As a special exception, The Qt Company gives you certain additional
- ** rights. These rights are described in The Qt Company LGPL Exception
- ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
- **
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#ifndef QNEARFIELDSHAREMANAGER_QNX_P_H_
-#define QNEARFIELDSHAREMANAGER_QNX_P_H_
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#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 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/qnearfieldsharetarget.cpp b/src/nfc/qnearfieldsharetarget.cpp
index 86c6318e..9e79909b 100644
--- a/src/nfc/qnearfieldsharetarget.cpp
+++ b/src/nfc/qnearfieldsharetarget.cpp
@@ -34,11 +34,7 @@
#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"
diff --git a/src/nfc/qnearfieldsharetarget_qnx_p.cpp b/src/nfc/qnearfieldsharetarget_qnx_p.cpp
deleted file mode 100644
index 6dfea8d2..00000000
--- a/src/nfc/qnearfieldsharetarget_qnx_p.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/***************************************************************************
- **
- ** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
- ** Contact: http://www.qt.io/licensing/
- **
- ** This file is part of the QtNfc module of the Qt Toolkit.
- **
- ** $QT_BEGIN_LICENSE:LGPL21$
- ** 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 The Qt Company. For licensing terms
- ** and conditions see http://www.qt.io/terms-conditions. For further
- ** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free
- ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
- ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
- ** following information to ensure the GNU Lesser General Public License
- ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
- ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
- **
- ** As a special exception, The Qt Company gives you certain additional
- ** rights. These rights are described in The Qt Company LGPL Exception
- ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
- **
- ** $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
deleted file mode 100644
index 626d2cc1..00000000
--- a/src/nfc/qnearfieldsharetarget_qnx_p.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/***************************************************************************
- **
- ** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
- ** Contact: http://www.qt.io/licensing/
- **
- ** This file is part of the QtNfc module of the Qt Toolkit.
- **
- ** $QT_BEGIN_LICENSE:LGPL21$
- ** 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 The Qt Company. For licensing terms
- ** and conditions see http://www.qt.io/terms-conditions. For further
- ** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free
- ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
- ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
- ** following information to ensure the GNU Lesser General Public License
- ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
- ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
- **
- ** As a special exception, The Qt Company gives you certain additional
- ** rights. These rights are described in The Qt Company LGPL Exception
- ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
- **
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-
-#ifndef QNEARFIELDSHARETARGET_QNX_P_H
-#define QNEARFIELDSHARETARGET_QNX_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#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 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/qnearfieldtarget_qnx_p.h b/src/nfc/qnearfieldtarget_qnx_p.h
deleted file mode 100644
index eb785d81..00000000
--- a/src/nfc/qnearfieldtarget_qnx_p.h
+++ /dev/null
@@ -1,227 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2012 Research In Motion
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtNfc module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** 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 The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QNEARFIELDTARGET_QNX_H
-#define QNEARFIELDTARGET_QNX_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qnearfieldtarget.h>
-#include <qnearfieldtarget_p.h>
-#include <qndefmessage.h>
-
-#include <nfc/nfc.h>
-#include <nfc/nfc_types.h>
-
-#include "qnx/qnxnfcmanager_p.h"
-
-QT_BEGIN_NAMESPACE
-
-#define TAG_NAME_BUFFER 64
-
-template <typename T>
-class NearFieldTarget : public T
-{
-public:
-
- NearFieldTarget(QObject *parent, nfc_target_t *target, const QList<QNdefMessage> &messages)
- : T(parent), m_target(target)
- {
- char buf[TAG_NAME_BUFFER];
- size_t bufLength;
-
- if (nfc_get_tag_name(target, buf, TAG_NAME_BUFFER, &bufLength) != NFC_RESULT_SUCCESS)
- qWarning() << Q_FUNC_INFO << "Could not get tag name";
- else
- m_tagName = QByteArray(buf, bufLength);
-
- if (nfc_get_tag_id(target, reinterpret_cast<uchar_t *>(buf), TAG_NAME_BUFFER, &bufLength) != NFC_RESULT_SUCCESS)
- qWarning() << Q_FUNC_INFO << "Could not get tag id";
- else
- m_tagId = QByteArray(buf,bufLength);
-
- m_ndefMessages = messages;
- }
-
- ~NearFieldTarget()
- {
- //Not entierely sure if this is the right place to do that
- nfc_destroy_target(m_target);
- }
-
- QByteArray uid() const
- {
- return m_tagId;
- }
-
- QNearFieldTarget::Type type() const
- {
- if (m_tagName == QByteArray("Jewel"))
- return QNearFieldTarget::NfcTagType1;
- else if (m_tagName == QByteArray("Topaz"))
- return QNearFieldTarget::NfcTagType1;
- else if (m_tagName == QByteArray("Topaz 512"))
- return QNearFieldTarget::NfcTagType1;
- else if (m_tagName == QByteArray("Mifare UL"))
- return QNearFieldTarget::NfcTagType2;
- else if (m_tagName == QByteArray("Mifare UL C"))
- return QNearFieldTarget::NfcTagType2;
- else if (m_tagName == QByteArray("Mifare 1K"))
- return QNearFieldTarget::MifareTag;
- else if (m_tagName == QByteArray("Kovio"))
- return QNearFieldTarget::NfcTagType2;
-
- return QNearFieldTarget::ProprietaryTag;
- }
-
- QNearFieldTarget::AccessMethods accessMethods() const
- {
- QNearFieldTarget::AccessMethods result = QNearFieldTarget::NdefAccess;
- return result;
- }
-
- bool hasNdefMessage()
- {
- return m_ndefMessages.count() > 0;
- }
-
- QNearFieldTarget::RequestId readNdefMessages()
- {
- for (int i = 0; i < m_ndefMessages.size(); i++) {
- emit QNearFieldTarget::ndefMessageRead(m_ndefMessages.at(i));
- }
- QNearFieldTarget::RequestId requestId = QNearFieldTarget::RequestId(new QNearFieldTarget::RequestIdPrivate());
- QMetaObject::invokeMethod(this, "requestCompleted", Qt::QueuedConnection,
- Q_ARG(const QNearFieldTarget::RequestId, requestId));
- return requestId;
- }
-
- QNearFieldTarget::RequestId sendCommand(const QByteArray &command)
- {
- Q_UNUSED(command);
- #if 0
- const int max_nfc_command_length = 256;
- //Not tested
- bool isSupported;
- nfc_tag_supports_tag_type (m_target,TAG_TYPE_ISO_14443_3, &isSupported);
- nfc_tag_type_t tagType= TAG_TYPE_ISO_14443_3;
- if (!isSupported) {
- nfc_tag_supports_tag_type (m_target,TAG_TYPE_ISO_14443_4, &isSupported);
- tagType = TAG_TYPE_ISO_14443_4;
- if (!isSupported) {
- nfc_tag_supports_tag_type (m_target,TAG_TYPE_ISO_15693_3, &isSupported);
- tagType = TAG_TYPE_ISO_15693_3;
- //We don't support this tag
- if (!isSupported) {
- emit QNearFieldTarget::error(QNearFieldTarget::UnsupportedError, QNearFieldTarget::RequestId());
- return QNearFieldTarget::RequestId();
- }
- }
- }
- m_cmdRespons = reinterpret_cast<char *> malloc (max_nfc_command_length);
- nfc_result_t result = nfc_tag_transceive (m_target, tagType, command.data(), command.length(), m_cmdRespons, max_nfc_command_length, &m_cmdResponseLength);
- if (result != NFC_RESULT_SUCCESS) {
- emit QNearFieldTarget::error(QNearFieldTarget::UnknownError, QNearFieldTarget::RequestId());
- qWarning() << Q_FUNC_INFO << "nfc_tag_transceive failed"
- }
- #else
- emit QNearFieldTarget::error(QNearFieldTarget::UnsupportedError, QNearFieldTarget::RequestId());
- return QNearFieldTarget::RequestId();
- #endif
- }
-
- QNearFieldTarget::RequestId sendCommands(const QList<QByteArray> &commands)
- {
- Q_UNUSED(commands);
- QNearFieldTarget::RequestId requestId;
- for (int i = 0; i < commands.size(); i++) {
- requestId = sendCommand(commands.at(i)); //The request id of the last command will be returned
- }
- return requestId;
- }
-
- QNearFieldTarget::RequestId writeNdefMessages(const QList<QNdefMessage> &messages)
- {
- for (int i=0; i<messages.count(); i++) {
- nfc_ndef_message_t *newMessage;
- QByteArray msg = messages.at(i).toByteArray();
- nfc_result_t result = nfc_create_ndef_message_from_bytes(reinterpret_cast<const uchar_t *> (msg.constData()), msg.length(), &newMessage);
- if (result != NFC_RESULT_SUCCESS) {
- qWarning() << Q_FUNC_INFO << "Could not convert QNdefMessage to byte array" << result;
- nfc_delete_ndef_message(newMessage, true);
- emit QNearFieldTarget::error(QNearFieldTarget::UnknownError,
- QNearFieldTarget::RequestId());
- return QNearFieldTarget::RequestId();
- }
-
- result = nfc_write_ndef_message_to_tag(m_target, newMessage, i == 0 ? false : true);
- nfc_delete_ndef_message(newMessage, true);
-
- if (result != NFC_RESULT_SUCCESS) {
- qWarning() << Q_FUNC_INFO << "Could not write message";
- emit QNearFieldTarget::error(QNearFieldTarget::NdefWriteError,
- QNearFieldTarget::RequestId());
-
- return QNearFieldTarget::RequestId();
- }
-
- }
- QNearFieldTarget::RequestId requestId = QNearFieldTarget::RequestId(new QNearFieldTarget::RequestIdPrivate());
- QMetaObject::invokeMethod(this, "requestCompleted", Qt::QueuedConnection,
- Q_ARG(const QNearFieldTarget::RequestId, requestId));
- return requestId;
- }
-
-protected:
- nfc_target_t *m_target;
-#if 0
- char m_cmdRespons;
- size_t m_cmdResponseLength;
-#endif
- QByteArray m_tagName;
- QByteArray m_tagId;
- QList<QNdefMessage> m_ndefMessages;
-};
-
-QT_END_NAMESPACE
-
-#endif // QNEARFIELDTARGET_QNX_H
diff --git a/src/nfc/qnx/qnxnfceventfilter.cpp b/src/nfc/qnx/qnxnfceventfilter.cpp
deleted file mode 100644
index f3d3749a..00000000
--- a/src/nfc/qnx/qnxnfceventfilter.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2012 Research In Motion
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtNfc module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** 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 The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qnxnfceventfilter_p.h"
-#include <QDebug>
-#include "nfc/nfc.h"
-#include "qnxnfcmanager_p.h"
-
-QT_BEGIN_NAMESPACE
-
-QNXNFCEventFilter::QNXNFCEventFilter()
-{
-}
-
-void QNXNFCEventFilter::installOnEventDispatcher(QAbstractEventDispatcher *dispatcher)
-{
- dispatcher->installNativeEventFilter(this);
- // start flow of navigator events
- navigator_request_events(0);
-}
-
-void QNXNFCEventFilter::uninstallEventFilter()
-{
- removeEventFilter(this);
-}
-
-bool QNXNFCEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, long *result)
-{
- Q_UNUSED(eventType);
- Q_UNUSED(result);
- bps_event_t *event = static_cast<bps_event_t *>(message);
-
- int code = bps_event_get_code(event);
-
- if (code == NAVIGATOR_INVOKE_TARGET) {
- // extract bps request from event
- const navigator_invoke_invocation_t *invoke = navigator_invoke_event_get_invocation(event);
- const char *uri = navigator_invoke_invocation_get_uri(invoke);
- const char *type = navigator_invoke_invocation_get_type(invoke);
- int dataLength = navigator_invoke_invocation_get_data_length(invoke);
- const char *raw_data = (const char*)navigator_invoke_invocation_get_data(invoke);
- QByteArray data(raw_data, dataLength);
-
- //message.fromByteArray(data);
-
- //const char* metadata = navigator_invoke_invocation_get_metadata(invoke);
-
- nfc_ndef_message_t *ndefMessage;
- nfc_create_ndef_message_from_bytes(reinterpret_cast<const uchar_t *>(data.data()),
- data.length(), &ndefMessage);
-
- QNdefMessage message = QNXNFCManager::instance()->decodeMessage(ndefMessage);
-
- unsigned int ndefRecordCount;
- nfc_get_ndef_record_count(ndefMessage, &ndefRecordCount);
-
- qQNXNFCDebug() << "Got Invoke event" << uri << "Type" << type;
-
- emit ndefEvent(message);
- }
-
- return false;
-}
-
-QT_END_NAMESPACE
diff --git a/src/nfc/qnx/qnxnfceventfilter_p.h b/src/nfc/qnx/qnxnfceventfilter_p.h
deleted file mode 100644
index c8a7a9ea..00000000
--- a/src/nfc/qnx/qnxnfceventfilter_p.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2012 Research In Motion
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtNfc module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** 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 The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QNXNFCEVENTFILTER_H
-#define QNXNFCEVENTFILTER_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QAbstractNativeEventFilter>
-#include <QAbstractEventDispatcher>
-//#include "qnxnfcmanager_p.h"
-#include <bps/navigator.h>
-#include "bps/bps.h"
-#include "bps/navigator_invoke.h"
-#include "../qnfcglobal.h"
-#include "../qndefmessage.h"
-
-QT_BEGIN_NAMESPACE
-
-class QNXNFCEventFilter : public QObject, public QAbstractNativeEventFilter
-{
- Q_OBJECT
-public:
- QNXNFCEventFilter();
-
- void installOnEventDispatcher(QAbstractEventDispatcher *dispatcher);
- void uninstallEventFilter();
-private:
- bool nativeEventFilter(const QByteArray &eventType, void *message, long *result);
-
- QAbstractNativeEventFilter *prevFilter;
-
-signals:
- void ndefEvent(const QNdefMessage &msg);
-};
-
-QT_END_NAMESPACE
-
-#endif // QNXNFCEVENTFILTER_H
diff --git a/src/nfc/qnx/qnxnfcmanager.cpp b/src/nfc/qnx/qnxnfcmanager.cpp
deleted file mode 100644
index 3db11158..00000000
--- a/src/nfc/qnx/qnxnfcmanager.cpp
+++ /dev/null
@@ -1,484 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2012 Research In Motion
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtNfc module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** 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 The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qnxnfcmanager_p.h"
-#include <QMetaMethod>
-#include <QMetaObject>
-#include "../qllcpsocket_qnx_p.h"
-#include <QCoreApplication>
-#include <QStringList>
-
-QT_BEGIN_NAMESPACE
-
-QNXNFCManager *QNXNFCManager::m_instance = 0;
-
-QNXNFCManager *QNXNFCManager::instance()
-{
- if (!m_instance) {
- qQNXNFCDebug() << "creating manager instance";
- m_instance = new QNXNFCManager;
- }
-
- return m_instance;
-}
-
-void QNXNFCManager::registerForNewInstance()
-{
- m_instanceCount++;
-}
-
-void QNXNFCManager::unregisterForInstance()
-{
- if (m_instanceCount>=1) {
- m_instanceCount--;
- if (m_instanceCount==0) {
- delete m_instance;
- m_instance = 0;
- }
- } else {
- qWarning() << Q_FUNC_INFO << "instance count below 0";
- }
-}
-
-void QNXNFCManager::unregisterTargetDetection(QObject *obj)
-{
- Q_UNUSED(obj)
- //TODO another instance of the nearfieldmanager might still
- //want to detect targets so we have to do ref counting
- nfc_unregister_tag_readerwriter();
-}
-
-nfc_target_t *QNXNFCManager::getLastTarget()
-{
- return m_lastTarget;
-}
-
-bool QNXNFCManager::isAvailable()
-{
- return m_available;
-}
-
-void QNXNFCManager::registerLLCPConnection(nfc_llcp_connection_listener_t listener, QObject *obj)
-{
- llcpConnections.append(QPair<nfc_llcp_connection_listener_t, QObject*> (listener, obj));
-}
-
-void QNXNFCManager::unregisterLLCPConnection(nfc_llcp_connection_listener_t listener)
-{
- for (int i=0; i<llcpConnections.size(); i++) {
- if (llcpConnections.at(i).first == listener) {
- llcpConnections.removeAt(i);
- }
- }
-}
-
-void QNXNFCManager::requestTargetLost(QObject *object, int targetId)
-{
- nfcTargets.append(QPair<unsigned int, QObject*> (targetId, object));
-}
-
-void QNXNFCManager::unregisterTargetLost(QObject *object)
-{
- for (int i=0; i<nfcTargets.size(); i++) {
- if (nfcTargets.at(i).second == object) {
- nfcTargets.removeAt(i);
- break;
- }
- }
-}
-
-QNXNFCManager::QNXNFCManager()
- : QObject(), nfcNotifier(0)
-{
- nfc_set_verbosity(2);
- qQNXNFCDebug() << "Initializing BB NFC";
-
- if (nfc_connect() != NFC_RESULT_SUCCESS) {
- qWarning() << Q_FUNC_INFO << "Could not connect to NFC system";
- return;
- }
-
- bool nfcStatus;
- nfc_get_setting(NFC_SETTING_ENABLED, &nfcStatus);
- qQNXNFCDebug() << "NFC status" << nfcStatus;
- if (!nfcStatus) {
- qWarning() << "NFC not enabled...enabling";
- nfc_set_setting(NFC_SETTING_ENABLED, true);
- }
- m_available = true;
-
- if (nfc_get_fd(NFC_CHANNEL_TYPE_PUBLIC, &nfcFD) != NFC_RESULT_SUCCESS) {
- qWarning() << Q_FUNC_INFO << "Could not get NFC FD";
- return;
- }
-
- nfcNotifier = new QSocketNotifier(nfcFD, QSocketNotifier::Read);
- qQNXNFCDebug() << "Connecting SocketNotifier" << connect(nfcNotifier, SIGNAL(activated(int)), this, SLOT(newNfcEvent(int)));
-
- ndefEventFilter = new QNXNFCEventFilter();
- ndefEventFilter->installOnEventDispatcher(QAbstractEventDispatcher::instance());
- connect(ndefEventFilter, SIGNAL(ndefEvent(QNdefMessage)), this, SLOT(invokeNdefMessage(QNdefMessage)));
-}
-
-QNXNFCManager::~QNXNFCManager()
-{
- nfc_disconnect();
-
- if (nfcNotifier)
- delete nfcNotifier;
- ndefEventFilter->uninstallEventFilter();
-}
-
-QList<QNdefMessage> QNXNFCManager::decodeTargetMessage(nfc_target_t *target)
-{
- unsigned int messageCount;
- QList<QNdefMessage> ndefMessages;
-
- if (nfc_get_ndef_message_count(target, &messageCount) != NFC_RESULT_SUCCESS)
- qWarning() << Q_FUNC_INFO << "Could not get ndef message count";
-
- for (unsigned int i=0; i<messageCount; i++) {
- nfc_ndef_message_t *nextMessage;
- if (nfc_get_ndef_message(target, i, &nextMessage) != NFC_RESULT_SUCCESS) {
- qWarning() << Q_FUNC_INFO << "Could not get ndef message";
- } else {
- QNdefMessage newNdefMessage = decodeMessage(nextMessage);
- ndefMessages.append(newNdefMessage);
- }
- }
- return ndefMessages;
-}
-
-void QNXNFCManager::newNfcEvent(int fd)
-{
- nfc_event_t *nfcEvent;
- nfc_event_type_t nfcEventType;
-
- if (nfc_read_event(fd, &nfcEvent) != NFC_RESULT_SUCCESS) {
- qWarning() << Q_FUNC_INFO << "Could not read NFC event";
- return;
- }
-
- if (nfc_get_event_type(nfcEvent, &nfcEventType) != NFC_RESULT_SUCCESS) {
- qWarning() << Q_FUNC_INFO << "Could not get NFC event type";
- return;
- }
-
- switch (nfcEventType) { //TODO handle all the events
- case NFC_TAG_READWRITE_EVENT: qQNXNFCDebug() << "NFC read write event"; nfcReadWriteEvent(nfcEvent); break;
- case NFC_OFF_EVENT: qQNXNFCDebug() << "NFC is off"; break;
- case NFC_ON_EVENT: qQNXNFCDebug() << "NFC is on"; break;
- case NFC_HANDOVER_COMPLETE_EVENT: qQNXNFCDebug() << "NFC handover event"; break;
- case NFC_HANDOVER_DETECTED_EVENT: qQNXNFCDebug() << "NFC Handover detected"; break;
- case NFC_SNEP_CONNECTION_EVENT: qQNXNFCDebug() << "NFC SNEP detected"; break;
- case NFC_LLCP_READ_COMPLETE_EVENT: llcpReadComplete(nfcEvent); break;
- case NFC_LLCP_WRITE_COMPLETE_EVENT: llcpWriteComplete(nfcEvent); break;
- case NFC_LLCP_CONNECTION_EVENT: llcpConnectionEvent(nfcEvent); break;
- case NFC_TARGET_LOST_EVENT: targetLostEvent(nfcEvent); break;
- default: qQNXNFCDebug() << "Got NFC event" << nfcEventType; break;
- }
-
- nfc_free_event (nfcEvent);
-}
-
-void QNXNFCManager::invokeNdefMessage(const QNdefMessage &msg)
-{
- emit ndefMessage(msg, 0);
-}
-
-void QNXNFCManager::llcpReadComplete(nfc_event_t *nfcEvent)
-{
- nfc_target_t *target;
- if (nfc_get_target(nfcEvent, &target) != NFC_RESULT_SUCCESS) {
- qWarning() << Q_FUNC_INFO << "Could not retrieve LLCP NFC target";
- return;
- }
- nfc_result_t result;
- unsigned int bufferLength = -1;
- result = nfc_llcp_get_local_miu(target, &bufferLength);
- if (result != NFC_RESULT_SUCCESS) {
- qWarning() << Q_FUNC_INFO << "could not get local miu";
- }
- uchar_t buffer[bufferLength];
-
- size_t bytesRead;
-
- m_lastTarget = target;
- unsigned int targetId;
- nfc_get_target_connection_id(target, &targetId);
-
- QByteArray data;
- result = nfc_llcp_get_read_result(getLastTarget(), buffer, bufferLength, &bytesRead);
- if (result == NFC_RESULT_SUCCESS) {
- data = QByteArray(reinterpret_cast<char *> (buffer), bytesRead);
- qQNXNFCDebug() << "Read LLCP data" << bytesRead << data;
- } else if (result == NFC_RESULT_READ_FAILED) { //This most likely means, that the target has been disconnected
- qWarning() << Q_FUNC_INFO << "LLCP read failed";
- nfc_llcp_close(target);
- targetLost(targetId);
- return;
- } else {
- qWarning() << Q_FUNC_INFO << "LLCP read unknown error";
- //return;
- }
-
- for (int i=0; i<nfcTargets.size(); i++) {
- if (nfcTargets.at(i).first == targetId) {
- qobject_cast<QLlcpSocketPrivate*>(nfcTargets.at(i).second)->dataRead(data);
- }
- }
-}
-
-void QNXNFCManager::llcpWriteComplete(nfc_event_t *nfcEvent)
-{
- nfc_target_t *target;
- if (nfc_get_target(nfcEvent, &target) != NFC_RESULT_SUCCESS) {
- qWarning() << Q_FUNC_INFO << "Could not retrieve LLCP NFC target";
- return;
- }
-
- if (nfc_llcp_get_write_status(target) != NFC_RESULT_SUCCESS) {
- qWarning() << Q_FUNC_INFO << "LLCP write failed";
- } else {
- qQNXNFCDebug() << "write completed succesfull";
- }
-
- unsigned int targetId;
- nfc_get_target_connection_id(target, &targetId);
-
- for (int i=0; i<nfcTargets.size(); i++) {
- if (nfcTargets.at(i).first == targetId) {
- qobject_cast<QLlcpSocketPrivate*>(nfcTargets.at(i).second)->dataWritten();
- }
- }
-}
-
-void QNXNFCManager::nfcReadWriteEvent(nfc_event_t *nfcEvent)
-{
- nfc_target_t *target;
-
- if (nfc_get_target(nfcEvent, &target) != NFC_RESULT_SUCCESS) {
- qWarning() << Q_FUNC_INFO << "Could not retrieve NFC target";
- return;
- }
- tag_variant_type_t variant;
- nfc_get_tag_variant(target, &variant);
- qQNXNFCDebug() << "Variant:" << variant;
-
- QList<QNdefMessage> targetMessages = decodeTargetMessage(target);
- NearFieldTarget<QNearFieldTarget> *bbNFTarget = new NearFieldTarget<QNearFieldTarget>(this, target, targetMessages);
- emit targetDetected(bbNFTarget, targetMessages);
- for (int i=0; i< targetMessages.count(); i++) {
- emit ndefMessage(targetMessages.at(i), reinterpret_cast<QNearFieldTarget *> (bbNFTarget));
- }
-}
-
-void QNXNFCManager::llcpConnectionEvent(nfc_event_t *nfcEvent)
-{
- nfc_target_t *target;
-
- if (nfc_get_target(nfcEvent, &target) != NFC_RESULT_SUCCESS) {
- qWarning() << Q_FUNC_INFO << "Could not retrieve NFC target";
- return;
- }
- nfc_llcp_connection_listener_t conListener;
- nfc_llcp_get_connection_status(target, &conListener);
- unsigned int lmiu;
- nfc_llcp_get_local_miu(target, &lmiu);
- m_lastTarget = target;
-
- qQNXNFCDebug() << "LLCP connection event; local MIU" << lmiu;
- for (int i=0; i<llcpConnections.size(); i++) {
- if (llcpConnections.at(i).first == conListener) {
- //Do we also have to destroy the conn listener afterwards?
- QMetaObject::invokeMethod(llcpConnections.at(i).second, "connected",
- Q_ARG(nfc_target_t *, target));
- break;
- }
- }
-}
-void QNXNFCManager::setupInvokeTarget() {
- qQNXNFCDebug() << "Setting up invoke target";
- QByteArray uriFilter;
- bool registerAll = false;
-
- if (!absNdefFilters.isEmpty()) {
- uriFilter = "uris=";
- }
- for (int i=0; i<absNdefFilters.size(); i++) {
- if (absNdefFilters.at(i) == "*") {
- registerAll = true;
- break;
- }
- uriFilter.append(absNdefFilters.at(i));
- if (i==absNdefFilters.size()-1)
- uriFilter += ';';
- else
- uriFilter += ',';
- }
- if (registerAll) {
- uriFilter = "uris=ndef://;";
- }
-
- const char *filters[1];
- QByteArray filter = "actions=bb.action.OPEN;types=application/vnd.rim.nfc.ndef;" + uriFilter;
- filters[0] = filter.constData();
-
- //Get the correct target-id
- QString targetId = QCoreApplication::instance()->arguments().first();
- 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";
- } else {
- qQNXNFCDebug() << "NFC share target filter set" << filters[0] << " Target:" << targetId;
- }
-}
-
-void QNXNFCManager::targetLostEvent(nfc_event_t *nfcEvent)
-{
- unsigned int targetId;
- nfc_get_notification_value(nfcEvent, &targetId);
- qQNXNFCDebug() << "Target lost with target ID:" << targetId;
- targetLost(targetId);
-}
-
-void QNXNFCManager::targetLost(unsigned int targetId)
-{
- for (int i=0; i<nfcTargets.size(); i++) {
- if (nfcTargets.at(i).first == targetId) {
- QMetaObject::invokeMethod(nfcTargets.at(i).second, "targetLost");
- nfcTargets.removeAt(i);
- break;
- }
- }
-}
-
-bool QNXNFCManager::startTargetDetection()
-{
- qQNXNFCDebug() << "Start target detection for all types";
- //TODO handle the target types
- if (nfc_register_tag_readerwriter(TAG_TYPE_ALL) == NFC_RESULT_SUCCESS) {
- return true;
- } else {
- qWarning() << Q_FUNC_INFO << "Could not start Target detection";
- return false;
- }
-}
-
-void QNXNFCManager::updateNdefFilters(QList<QByteArray> filters, QObject *obj)
-{
- qQNXNFCDebug() << Q_FUNC_INFO << "NDEF Filter update";
- //Updating the filters for an object
- if (!filters.isEmpty()) {
- if (ndefFilters.contains(obj)) {
- ndefFilters[obj] = filters;
- qQNXNFCDebug() << "Updateing filter list for"<< obj;
- } else {
- qQNXNFCDebug() << "Appending new filter for"<< obj;
- ndefFilters[obj] = filters;
- }
- } else {
- ndefFilters.remove(obj);
- }
-
- //Iterate over all registered object filters and construct a filter list for the application
- QList<QByteArray> newFilters;
- if (ndefFilters.size() > 0) {
- QHash<QObject*, QList<QByteArray> >::const_iterator it=ndefFilters.constBegin();
- do {
- foreach (const QByteArray filter, it.value()) {
- if (!newFilters.contains(filter)) {
- newFilters.append(filter);
- qQNXNFCDebug() << "Appending Filter" << filter;
- }
- }
- it++;
- } while (it != ndefFilters.constEnd());
- }
-
- if (newFilters != absNdefFilters) {
- absNdefFilters = newFilters;
- setupInvokeTarget();
- }
-}
-
-QNdefMessage QNXNFCManager::decodeMessage(nfc_ndef_message_t *nextMessage)
-{
- QNdefMessage newNdefMessage;
- unsigned int recordCount;
- nfc_get_ndef_record_count(nextMessage, &recordCount);
- for (unsigned int j=0; j<recordCount; j++) {
- nfc_ndef_record_t *newRecord;
- char *recordType;
- uchar_t *payLoad;
- char *recordId;
- size_t payLoadSize;
- tnf_type_t typeNameFormat;
-
- nfc_get_ndef_record(nextMessage, j, &newRecord);
-
- nfc_get_ndef_record_type(newRecord, &recordType);
- QNdefRecord newNdefRecord;
- newNdefRecord.setType(QByteArray(recordType));
-
- nfc_get_ndef_record_payload(newRecord, &payLoad, &payLoadSize);
- newNdefRecord.setPayload(QByteArray(reinterpret_cast<const char*>(payLoad), payLoadSize));
-
- nfc_get_ndef_record_id(newRecord, &recordId);
- newNdefRecord.setId(QByteArray(recordId));
-
- nfc_get_ndef_record_tnf(newRecord, &typeNameFormat);
- QNdefRecord::TypeNameFormat recordTnf = QNdefRecord::Unknown;
- switch (typeNameFormat) {
- case NDEF_TNF_WELL_KNOWN: recordTnf = QNdefRecord::NfcRtd; break;
- case NDEF_TNF_EMPTY: recordTnf = QNdefRecord::Empty; break;
- case NDEF_TNF_MEDIA: recordTnf = QNdefRecord::Mime; break;
- case NDEF_TNF_ABSOLUTE_URI: recordTnf = QNdefRecord::Uri; break;
- case NDEF_TNF_EXTERNAL: recordTnf = QNdefRecord::ExternalRtd; break;
- case NDEF_TNF_UNKNOWN: recordTnf = QNdefRecord::Unknown; break;
- //TODO add the rest
- case NDEF_TNF_UNCHANGED: recordTnf = QNdefRecord::Unknown; break;
- }
-
- newNdefRecord.setTypeNameFormat(recordTnf);
- qQNXNFCDebug() << "Adding NFC record";
- newNdefMessage << newNdefRecord;
- delete recordType;
- delete payLoad;
- delete recordId;
- }
- return newNdefMessage;
-}
-
-QT_END_NAMESPACE
diff --git a/src/nfc/qnx/qnxnfcmanager_p.h b/src/nfc/qnx/qnxnfcmanager_p.h
deleted file mode 100644
index 17425198..00000000
--- a/src/nfc/qnx/qnxnfcmanager_p.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2012 Research In Motion
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtNfc module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** 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 The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QNXNFCMANAGER_H
-#define QNXNFCMANAGER_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "nfc/nfc_types.h"
-#include "nfc/nfc.h"
-#include <QSocketNotifier>
-#include <QDebug>
-#include "../qndefmessage.h"
-#include "../qndefrecord.h"
-#include <bps/navigator_invoke.h>
-#include "../qnearfieldtarget_qnx_p.h"
-#include <QTimer>
-#include "qnxnfceventfilter_p.h"
-
-#ifdef QQNXNFC_DEBUG
-#define qQNXNFCDebug qDebug
-#else
-#define qQNXNFCDebug QT_NO_QDEBUG_MACRO
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class QLlcpSocketPrivate;
-
-class Q_DECL_EXPORT QNXNFCManager : public QObject
-{
- Q_OBJECT
-public:
- static QNXNFCManager *instance();
- void registerForNewInstance();
- void unregisterForInstance();
- void unregisterTargetDetection(QObject *);
- nfc_target_t *getLastTarget();
- bool isAvailable();
- void registerLLCPConnection(nfc_llcp_connection_listener_t, QObject *);
- void unregisterLLCPConnection(nfc_llcp_connection_listener_t);
- void requestTargetLost(QObject *, int);
- void unregisterTargetLost(QObject *);
-
-private:
- QNXNFCManager();
- ~QNXNFCManager();
-
- static QNXNFCManager *m_instance;
- int m_instanceCount;
-
- QNXNFCEventFilter *ndefEventFilter;
-
- int nfcFD;
- QSocketNotifier *nfcNotifier;
-
- QList<QNdefMessage> decodeTargetMessage(nfc_target_t *);
- QList<QPair<nfc_llcp_connection_listener_t, QObject *> > llcpConnections;
- QList<QPair<unsigned int ,QObject*> > nfcTargets;
-
- QHash<QObject *, QList<QByteArray> > ndefFilters;
- QList<QByteArray> absNdefFilters;
-
- //QList<QPair<QObject*, QMetaMethod> > ndefMessageHandlers;
-
- //There can only be one target. The last detected one is saved here
- //currently we do not get notified when the target is disconnected. So the target might be invalid
- nfc_target_t *m_lastTarget;
- bool m_available;
-
- void llcpReadComplete(nfc_event_t *nfcEvent);
- void llcpWriteComplete(nfc_event_t *nfcEvent);
- void nfcReadWriteEvent(nfc_event_t *nfcEvent);
- void llcpConnectionEvent(nfc_event_t *nfcEvent);
- void targetLostEvent(nfc_event_t *nfcEvent);
- void targetLost(unsigned int target);
- void startBTHandover();
-
- void setupInvokeTarget();
-
-private slots:
- void newNfcEvent(int fd);
- void invokeNdefMessage(const QNdefMessage &);
-
-public:
- //TODO add a parameter to only detect a special target for now we are detecting all target types
- bool startTargetDetection();
-
- void updateNdefFilters(QList<QByteArray>,QObject *);
-
- QNdefMessage decodeMessage(nfc_ndef_message_t *nextMessage);
-
-signals:
- void newLlcpConnection(nfc_target_t *);
- void ndefMessage(const QNdefMessage &, QNearFieldTarget *);
- void targetDetected(QNearFieldTarget *, const QList<QNdefMessage> &);
- void readResult(QByteArray&, nfc_target_t *);
- void llcpDisconnected();
-};
-
-QT_END_NAMESPACE
-
-#endif
-
diff --git a/src/nfc/qnx/qnxnfcsharemanager_p.cpp b/src/nfc/qnx/qnxnfcsharemanager_p.cpp
deleted file mode 100644
index ea6aeb13..00000000
--- a/src/nfc/qnx/qnxnfcsharemanager_p.cpp
+++ /dev/null
@@ -1,272 +0,0 @@
-/***************************************************************************
- **
- ** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
- ** Contact: http://www.qt.io/licensing/
- **
- ** This file is part of the QtNfc module of the Qt Toolkit.
- **
- ** $QT_BEGIN_LICENSE:LGPL21$
- ** 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 The Qt Company. For licensing terms
- ** and conditions see http://www.qt.io/terms-conditions. For further
- ** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free
- ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
- ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
- ** following information to ensure the GNU Lesser General Public License
- ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
- ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
- **
- ** As a special exception, The Qt Company gives you certain additional
- ** rights. These rights are described in The Qt Company LGPL Exception
- ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
- **
- ** $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
deleted file mode 100644
index d6774c41..00000000
--- a/src/nfc/qnx/qnxnfcsharemanager_p.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/***************************************************************************
- **
- ** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
- ** Contact: http://www.qt.io/licensing/
- **
- ** This file is part of the QtNfc module of the Qt Toolkit.
- **
- ** $QT_BEGIN_LICENSE:LGPL21$
- ** 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 The Qt Company. For licensing terms
- ** and conditions see http://www.qt.io/terms-conditions. For further
- ** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free
- ** Software Foundation and appearing in the file LICENSE.LGPLv21 and
- ** LICENSE.LGPLv3 included in the packaging of this file. Please review the
- ** following information to ensure the GNU Lesser General Public License
- ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
- ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
- **
- ** As a special exception, The Qt Company gives you certain additional
- ** rights. These rights are described in The Qt Company LGPL Exception
- ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
- **
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#ifndef QNXNFCSHAREMANAGER_P_H
-#define QNXNFCSHAREMANAGER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#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;
-
-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 */