summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlex Blasche <alexander.blasche@digia.com>2014-10-01 14:32:50 +0200
committerAlex Blasche <alexander.blasche@digia.com>2014-10-01 16:23:48 +0200
commite1045264c024b5c1ffa9b1ecec77d0b0f5a1d41e (patch)
tree5ea4f58467cb749038f670e85650bd5267f117d1 /tests
parent7d1de5c312ccf0a85ba0a6a047240cc5777ea18d (diff)
Remove nfctestserver test application
It is realted to nfc socket streaming which we don't support at this stage. Change-Id: Idae80decad7aa2cdf7eb67b82ddc3e20384df8b8 Reviewed-by: Martin Leutelt <martin.leutelt@basyskom.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/nfctestserver/main.cpp54
-rw-r--r--tests/nfctestserver/nfctestserver.pro21
-rw-r--r--tests/nfctestserver/servercontroller.cpp151
-rw-r--r--tests/nfctestserver/servercontroller.h70
-rw-r--r--tests/nfctestserver/servicenames.h44
-rw-r--r--tests/nfctestserver/socketcontroller.cpp187
-rw-r--r--tests/nfctestserver/socketcontroller.h80
-rw-r--r--tests/tests.pro2
8 files changed, 0 insertions, 609 deletions
diff --git a/tests/nfctestserver/main.cpp b/tests/nfctestserver/main.cpp
deleted file mode 100644
index 19c7eed8..00000000
--- a/tests/nfctestserver/main.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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 Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 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.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/QCoreApplication>
-
-#include "socketcontroller.h"
-#include "servercontroller.h"
-
-int main(int argc, char *argv[])
-{
- QCoreApplication app(argc, argv);
-
- // Connection oriented sockets
- new ServerController(ServerController::StreamConnection, &app);
- new ServerController(ServerController::DatagramConnection, &app);
- new SocketController(SocketController::StreamConnection, &app);
- new SocketController(SocketController::DatagramConnection, &app);
-
- // Connectionless sockets
- new SocketController(SocketController::BoundSocket, &app);
- new SocketController(SocketController::ConnectionlessSocket, &app);
-
- return app.exec();
-}
diff --git a/tests/nfctestserver/nfctestserver.pro b/tests/nfctestserver/nfctestserver.pro
deleted file mode 100644
index 42dc5c62..00000000
--- a/tests/nfctestserver/nfctestserver.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-
-INCLUDEPATH += $$PWD/../../src/nfc
-
-TARGET = nfctestserver
-
-CONFIG += console strict_flags
-CONFIG -= app_bundle
-
-QT = core nfc
-
-TEMPLATE = app
-
-SOURCES += main.cpp \
- socketcontroller.cpp \
- servercontroller.cpp
-
-HEADERS += \
- socketcontroller.h \
- servercontroller.h \
- servicenames.h
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/nfctestserver/servercontroller.cpp b/tests/nfctestserver/servercontroller.cpp
deleted file mode 100644
index 32337b58..00000000
--- a/tests/nfctestserver/servercontroller.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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 Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 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.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "servercontroller.h"
-#include "servicenames.h"
-
-ServerController::ServerController(ConnectionType type, QObject *parent)
-: QObject(parent), m_server(new QLlcpServer(this)), m_socket(0), m_connectionType(type)
-{
- connect(m_server, SIGNAL(newConnection()), this, SLOT(newConnection()));
-
- switch (m_connectionType) {
- case StreamConnection:
- m_service = commandServer + streamSuffix;
- break;
- case DatagramConnection:
- m_service = commandServer + datagramSuffix;
- break;
- }
-
- m_server->listen(m_service);
-
- if (m_server->isListening())
- qDebug() << "Server listening on" << m_service;
-}
-
-ServerController::~ServerController()
-{
- delete m_socket;
- delete m_server;
-}
-
-void ServerController::newConnection()
-{
- m_socket = m_server->nextPendingConnection();
-
- qDebug() << "Server got new connection";
-
- connect(m_socket, SIGNAL(readyRead()), this, SLOT(socketReadyRead()));
- connect(m_socket, SIGNAL(bytesWritten(qint64)), this, SLOT(socketBytesWritten(qint64)));
- connect(m_socket, SIGNAL(disconnected()), this, SLOT(socketDisconnected()));
-}
-
-void ServerController::socketReadyRead()
-{
- switch (m_connectionType) {
- case StreamConnection:
- while (m_socket->canReadLine()) {
- const QByteArray line = m_socket->readLine().trimmed();
-
- qDebug() << "Server read line:" << line;
-
- QByteArray command;
- QByteArray parameter;
-
- int index = line.indexOf(' ');
- if (index >= 0) {
- command = line.left(index);
- parameter = line.mid(index + 1);
- } else {
- command = line;
- }
-
- if (command == "ECHO") {
- m_socket->write(parameter + '\n');
- } else if (command == "DISCONNECT") {
- m_socket->disconnectFromService();
- break;
- } else if (command == "CLOSE") {
- m_socket->close();
- break;
- } else if (command == "URI") {
- m_socket->write(m_service.toLatin1());
- m_socket->write("\n");
- }
- }
- break;
- case DatagramConnection:
- while (m_socket->hasPendingDatagrams()) {
- qint64 size = m_socket->pendingDatagramSize();
- QByteArray data;
- data.resize(size);
- m_socket->readDatagram(data.data(), data.size());
-
- QByteArray command;
- QByteArray parameter;
-
- int index = data.indexOf(' ');
- if (index >= 0) {
- command = data.left(index);
- parameter = data.mid(index + 1);
- } else {
- command = data;
- }
-
- if (command == "ECHO") {
- m_socket->writeDatagram(parameter);
- } else if (command == "DISCONNECT") {
- m_socket->disconnectFromService();
- break;
- } else if (command == "CLOSE") {
- m_socket->close();
- break;
- } else if (command == "URI") {
- m_socket->writeDatagram(m_service.toLatin1());
- }
- }
- break;
- }
-}
-
-void ServerController::socketBytesWritten(qint64 bytes)
-{
- Q_UNUSED(bytes);
-}
-
-void ServerController::socketDisconnected()
-{
- m_socket->deleteLater();
- m_socket = 0;
-}
diff --git a/tests/nfctestserver/servercontroller.h b/tests/nfctestserver/servercontroller.h
deleted file mode 100644
index 7f18dd47..00000000
--- a/tests/nfctestserver/servercontroller.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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 Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 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.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SERVERCONTROLLER_H
-#define SERVERCONTROLLER_H
-
-#include <QtCore/QObject>
-
-#include <qllcpserver_p.h>
-
-QT_USE_NAMESPACE
-
-class ServerController : public QObject
-{
- Q_OBJECT
-
-public:
- enum ConnectionType {
- StreamConnection,
- DatagramConnection
- };
-
- ServerController(ConnectionType type, QObject *parent = 0);
- ~ServerController();
-
-private slots:
- void newConnection();
-
- void socketReadyRead();
- void socketBytesWritten(qint64 bytes);
- void socketDisconnected();
-
-private:
- QLlcpServer *m_server;
- QLlcpSocket *m_socket;
- ConnectionType m_connectionType;
- QString m_service;
-};
-
-#endif // SERVERCONTROLLER_H
diff --git a/tests/nfctestserver/servicenames.h b/tests/nfctestserver/servicenames.h
deleted file mode 100644
index d8ad5088..00000000
--- a/tests/nfctestserver/servicenames.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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 Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 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.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SERVICENAMES_H
-#define SERVICENAMES_H
-
-static const QLatin1String commandServer("urn:nfc:sn:com.nokia.qt.commandserver");
-static const QLatin1String helloServer("urn:nfc:sn:com.nokia.qt.helloserver");
-static const QLatin1String streamSuffix(".stream");
-static const QLatin1String datagramSuffix(".datagram");
-
-static const quint8 boundSocketPort = 63;
-
-#endif // SERVICENAMES_H
diff --git a/tests/nfctestserver/socketcontroller.cpp b/tests/nfctestserver/socketcontroller.cpp
deleted file mode 100644
index 3b9567c2..00000000
--- a/tests/nfctestserver/socketcontroller.cpp
+++ /dev/null
@@ -1,187 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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 Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 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.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "socketcontroller.h"
-#include "servicenames.h"
-
-SocketController::SocketController(ConnectionType type, QObject *parent)
-: QObject(parent), m_manager(0), m_socket(new QLlcpSocket(this)), m_connectionType(type),
- m_timerId(-1)
-{
- connect(m_socket, SIGNAL(connected()), this, SLOT(connected()));
- connect(m_socket, SIGNAL(disconnected()), this, SLOT(disconnected()));
- connect(m_socket, SIGNAL(error(QLlcpSocket::SocketError)),
- this, SLOT(error(QLlcpSocket::SocketError)));
- connect(m_socket, SIGNAL(stateChanged(QLlcpSocket::SocketState)),
- this, SLOT(stateChanged(QLlcpSocket::SocketState)));
- connect(m_socket, SIGNAL(readyRead()), this, SLOT(readyRead()));
-
- switch (m_connectionType) {
- case StreamConnection:
- m_service = helloServer + streamSuffix;
- qDebug() << "Client connecting to" << m_service;
- m_socket->connectToService(0, m_service);
- break;
- case DatagramConnection:
- m_service = helloServer + datagramSuffix;
- qDebug() << "Client connecting to" << m_service;
- m_socket->connectToService(0, m_service);
- break;
- case BoundSocket:
- m_port = boundSocketPort;
- qDebug() << "Client binding to" << m_port;
- if (!m_socket->bind(m_port))
- qDebug() << "Failed to bind to port" << m_port;
- break;
- case ConnectionlessSocket:
- qDebug() << "Client binding to arbitrary port";
- if (!m_socket->bind(0)) {
- qDebug() << "Failed to bind to arbitrary port";
- } else {
- m_manager = new QNearFieldManager(this);
- connect(m_manager, SIGNAL(targetDetected(QNearFieldTarget*)),
- this, SLOT(targetDetected(QNearFieldTarget*)));
- connect(m_manager, SIGNAL(targetLost(QNearFieldTarget*)),
- this, SLOT(targetLost(QNearFieldTarget*)));
- m_manager->startTargetDetection();
- }
- break;
- default:
- qFatal("Unknown connection type");
- }
-}
-
-SocketController::~SocketController()
-{
- delete m_socket;
-}
-
-void SocketController::connected()
-{
- qDebug() << "Client connected";
- const QString data = QStringLiteral("HELLO ") + m_service;
- switch (m_connectionType) {
- case StreamConnection:
- m_socket->write(data.toUtf8() + '\n');
- break;
- case DatagramConnection:
- m_socket->writeDatagram(data.toUtf8());
- break;
- default:
- ;
- }
-}
-
-void SocketController::disconnected()
-{
- qDebug() << "Client disconnected, reconnecting";
-
- m_socket->connectToService(0, m_service);
-}
-
-void SocketController::error(QLlcpSocket::SocketError socketError)
-{
- qDebug() << "Client got error:" << socketError;
-}
-
-void SocketController::stateChanged(QLlcpSocket::SocketState socketState)
-{
- qDebug() << "Client state changed to" << socketState;
-}
-
-void SocketController::readyRead()
-{
- switch (m_connectionType) {
- case StreamConnection:
- while (m_socket->canReadLine()) {
- const QByteArray line = m_socket->readLine().trimmed();
-
- qDebug() << "Client read line:" << line;
-
- if (line == "DISCONNECT") {
- m_socket->disconnectFromService();
- break;
- } else if (line == "CLOSE") {
- m_socket->close();
- break;
- }
- }
- break;
- case DatagramConnection:
- while (m_socket->hasPendingDatagrams()) {
- qint64 size = m_socket->pendingDatagramSize();
- QByteArray data;
- data.resize(size);
- m_socket->readDatagram(data.data(), data.size());
-
- if (data == "DISCONNECT") {
- m_socket->disconnectFromService();
- break;
- } else if (data == "CLOSE") {
- m_socket->close();
- break;
- }
- }
- case BoundSocket:
- case ConnectionlessSocket:
- while (m_socket->hasPendingDatagrams()) {
- qint64 size = m_socket->pendingDatagramSize();
- QByteArray data;
- data.resize(size);
- m_socket->readDatagram(data.data(), data.size());
-
- qDebug() << data;
- }
- }
-}
-
-void SocketController::targetDetected(QNearFieldTarget *target)
-{
- Q_UNUSED(target);
-
- m_timerId = startTimer(500);
-}
-
-void SocketController::targetLost(QNearFieldTarget *target)
-{
- Q_UNUSED(target);
-
- killTimer(m_timerId);
-}
-
-void SocketController::timerEvent(QTimerEvent *event)
-{
- Q_UNUSED(event);
-
- m_socket->writeDatagram("Test message", 12, 0, boundSocketPort);
-}
diff --git a/tests/nfctestserver/socketcontroller.h b/tests/nfctestserver/socketcontroller.h
deleted file mode 100644
index 02fc3e4f..00000000
--- a/tests/nfctestserver/socketcontroller.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** 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 Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 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.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SOCKETCONTROLLER_H
-#define SOCKETCONTROLLER_H
-
-#include <QtCore/QObject>
-
-#include <qnearfieldmanager.h>
-#include <qllcpsocket_p.h>
-
-QT_USE_NAMESPACE
-
-class SocketController : public QObject
-{
- Q_OBJECT
-
-public:
- enum ConnectionType {
- StreamConnection,
- DatagramConnection,
- BoundSocket,
- ConnectionlessSocket
- };
-
- SocketController(ConnectionType type, QObject *parent = 0);
- ~SocketController();
-
-public slots:
- void connected();
- void disconnected();
- void error(QLlcpSocket::SocketError socketError);
- void stateChanged(QLlcpSocket::SocketState socketState);
- void readyRead();
- void targetDetected(QNearFieldTarget *target);
- void targetLost(QNearFieldTarget *target);
-
-protected:
- void timerEvent(QTimerEvent *event);
-
-private:
- QNearFieldManager *m_manager;
- QLlcpSocket *m_socket;
- ConnectionType m_connectionType;
- QString m_service;
- quint8 m_port;
- int m_timerId;
-};
-
-#endif // SOCKETCONTROLLER_H
diff --git a/tests/tests.pro b/tests/tests.pro
index 96db8fd3..e96b928c 100644
--- a/tests/tests.pro
+++ b/tests/tests.pro
@@ -2,5 +2,3 @@ TEMPLATE = subdirs
SUBDIRS += auto
qtHaveModule(bluetooth):qtHaveModule(quick): SUBDIRS += bttestui
-
-qtHaveModule(nfc): SUBDIRS += nfctestserver