diff --git a/ZBD_IIIDL_S_Project/DependFile/QML/Ssvep.qml b/ZBD_IIIDL_S_Project/DependFile/QML/Ssvep.qml index 5f4b65a..7d21d2b 100644 --- a/ZBD_IIIDL_S_Project/DependFile/QML/Ssvep.qml +++ b/ZBD_IIIDL_S_Project/DependFile/QML/Ssvep.qml @@ -1,10 +1,12 @@ import QtQuick 2.0 +import TcpSocket 2.0 Item { property int hitIndex: -1 property bool bStimulate: false property int responseTime: 10*1000 property bool bTest: true + property bool bConnect: false; property int currentIndexTenHz: 0 property var imageFilesTenHz: @@ -65,6 +67,14 @@ Item { animationTenHz.start(); animationTwelveHz.start(); animationFifteenHz.start(); + if(!bConnect) + { + clientSocket.connectToHost(); + bConnect = true; + }else + { + clientSocket.writeBytes(getIntArr("1")); + } } function stopStimulate() @@ -128,15 +138,15 @@ Item { { return; } - if(index === 0) + if(index === "0") { ssvepTenHzTimer.start(); hitTimer.start(); - }else if(index === 1) + }else if(index === "1") { ssvepTwelveHzTimer.start(); hitTimer.start(); - }else if(index === 2) + }else if(index === "2") { ssvepFifteenHzTimer.start(); hitTimer.start(); @@ -147,6 +157,60 @@ Item { hitIndex = index; } + function getStr(intArr){ + var str = ""; + for(var i=0;i #include "fescontroldialog.h" #include +#include "BCIManager.h" void outputMessage(QtMsgType type, const QMessageLogContext &context, const QString &msg) { @@ -22,17 +23,17 @@ void outputMessage(QtMsgType type, const QMessageLogContext &context, const QStr QString text; switch(type) { - case QtDebugMsg: - text = QString("Debug:"); - break; - case QtWarningMsg: - text = QString("Warning:"); - break; - case QtCriticalMsg: - text = QString("Critical:"); - break; - case QtFatalMsg: - text = QString("Fatal:"); + case QtDebugMsg: + text = QString("Debug:"); + break; + case QtWarningMsg: + text = QString("Warning:"); + break; + case QtCriticalMsg: + text = QString("Critical:"); + break; + case QtFatalMsg: + text = QString("Fatal:"); } QString context_info = QString("File:(%1) Line:(%2)").arg(QString(context.file)).arg(context.line); QString current_date_time = QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss ddd"); @@ -56,7 +57,7 @@ void SetProcessAutoRunSelf(const QString &appPath) //注册表路径需要使用双反斜杠,如果是32位系统,要使用QSettings::Registry32Format QSettings settings("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", QSettings::Registry64Format); - //以程序名称作为注册表中的键 + //以程序名称作为注册表中的键 //根据键获取对应的值(程序路径) QFileInfo fInfo(appPath); QString name = fInfo.baseName(); @@ -70,7 +71,7 @@ void SetProcessAutoRunSelf(const QString &appPath) { settings.setValue(name, newPath); - qDebug() <<"添加快捷启动注册表:HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run,"; + qDebug() << "添加快捷启动注册表:HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run,"; } } @@ -86,16 +87,19 @@ int main(int argc, char *argv[]) //SetProcessAutoRunSelf(qApp->applicationFilePath()); #ifdef DEBUGON - qInstallMessageHandler(outputMessage); + qInstallMessageHandler(outputMessage); #endif + BCIManager::registerQMLType(); //数据库读取 - if(!CDatabaseInterface::getInstance()->openDB("./DependFile/DBFile/UpLow.db","QSQLITE")) - qDebug()<<"UpLow.db open failed!"; + if(!CDatabaseInterface::getInstance()->openDB("./DependFile/DBFile/UpLow.db", "QSQLITE")) + { + qDebug() << "UpLow.db open failed!"; + } //配置文件读取 if(!ReadConfig::getInstance()->readConfigFile()) { - qDebug()<<"配置文件读取失败"; + qDebug() << "配置文件读取失败"; return -1; } @@ -129,15 +133,16 @@ int main(int argc, char *argv[]) CMainWindow w; if(sharedMemory.create(1)) { - QObject::connect(&w,SIGNAL(signalShowCompleted()),&login,SLOT(slotShowCompleted())); + QObject::connect(&w, SIGNAL(signalShowCompleted()), &login, SLOT(slotShowCompleted())); login.setWindowModality(Qt::WindowModal);// login.exec(); // w.show(); } - QObject::connect(&a,&QApplication::aboutToQuit,[](){ - FesControlDialog::getInstance()->turnoffDevice(1,1); + QObject::connect(&a, &QApplication::aboutToQuit, []() + { + FesControlDialog::getInstance()->turnoffDevice(1, 1); }); diff --git a/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/QIntPtr.cpp b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/QIntPtr.cpp new file mode 100644 index 0000000..6e3fb15 --- /dev/null +++ b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/QIntPtr.cpp @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2016 EPFL + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ + +/** + * @file QIntPtr.cpp + * @brief QObject wrapper for qintptr + * @author Ayberk Özgür + * @date 2016-11-15 + */ + +#include"QIntPtr.h" + +namespace QMLTcpSockets{ + +QIntPtr::QIntPtr(QObject* parent) : QObject(parent){ + ptr = 0; +} + +QIntPtr::~QIntPtr(){ } + +} diff --git a/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/QIntPtr.h b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/QIntPtr.h new file mode 100644 index 0000000..b84700c --- /dev/null +++ b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/QIntPtr.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2016 EPFL + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ + +/** + * @file QIntPtr.h + * @brief QObject wrapper for qintptr + * @author Ayberk Özgür + * @date 2016-11-15 + */ + +#ifndef QINTPTR_H +#define QINTPTR_H + +#include + +namespace QMLTcpSockets{ + +/** + * @brief QObject wrapper for qintptr. Can be passed around in QML but doesn't have any API. + */ +class QIntPtr : public QObject { + /* *INDENT-OFF* */ + Q_OBJECT + /* *INDENT-ON* */ + +public: + + /** @cond DO_NOT_DOCUMENT */ + + /** + * @brief Creates a new QIntPtr with the given Qt parent + * + * @param parent The Qt parent + */ + QIntPtr(QObject* parent = 0); + + /** + * @brief Destroys this QIntPtr + */ + ~QIntPtr(); + + qintptr ptr; ///< Wrapped low level pointer + + /** @endcond */ + +}; + +} + +Q_DECLARE_METATYPE(QMLTcpSockets::QIntPtr*) + +#endif /* QINTPTR_H */ diff --git a/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/QMLTcpSocketsPlugin.cpp b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/QMLTcpSocketsPlugin.cpp new file mode 100644 index 0000000..026a55a --- /dev/null +++ b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/QMLTcpSocketsPlugin.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2016 EPFL + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ + +/** + * @file QMLTcpSocketsPlugin.h + * @brief Object that exposes the QMLTcpSockets plugin components as QML objects + * @author Ayberk Özgür + * @date 2016-11-10 + */ + +#include "QMLTcpSocketsPlugin.h" + +#include "TcpServer.h" +#include "TcpSocket.h" +#include "QIntPtr.h" +#include "TcpSocketFactory.h" +#include "TcpSocketEnums.h" + +namespace QMLTcpSockets{ + +void QMLTcpSocketsPlugin::registerTypes(const char* uri){ + qmlRegisterType(uri, 1, 0, "TcpServer"); + qmlRegisterType(uri, 1, 0, "TcpSocket"); + qmlRegisterType(uri, 1, 0, "QIntPtr"); + qmlRegisterSingletonType(uri, 1, 0, "TcpSocketFactory", + [] (QQmlEngine* qmlEngine, QJSEngine* jsEngine)->QObject* { + Q_UNUSED(qmlEngine) + Q_UNUSED(jsEngine) + return new TcpSocketFactory(); + }); + qmlRegisterType(uri, 1, 0, "TcpSocketEnums"); +} + +} diff --git a/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/QMLTcpSocketsPlugin.h b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/QMLTcpSocketsPlugin.h new file mode 100644 index 0000000..e3cb8ee --- /dev/null +++ b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/QMLTcpSocketsPlugin.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2016 EPFL + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ + +/** + * @mainpage qml-tcpsockets + * + * qml-tcpsockets contains QML wrappers for QTcpServer and QTcpSocket. More Qt Networking wrappers might come soon. See README.md for more information. + */ + +/** + * @file QMLTcpSocketsPlugin.h + * @brief Object that exposes the QMLTcpSockets plugin components as QML objects + * @author Ayberk Özgür + * @date 2016-11-10 + */ + +#ifndef QMLTCPSOCKETSPLUGIN_H +#define QMLTCPSOCKETSPLUGIN_H + +#include +#include + +namespace QMLTcpSockets{ + +/** @cond DO_NOT_DOCUMENT */ + +class QMLTcpSocketsPlugin : public QQmlExtensionPlugin { + /* *INDENT-OFF* */ + Q_OBJECT + /* *INDENT-ON* */ + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + +public: + void registerTypes(const char* uri); +}; + +/** @endcond */ + +} + +#endif /* QMLTCPSOCKETSPLUGIN_H */ diff --git a/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/QTcpServerPub.cpp b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/QTcpServerPub.cpp new file mode 100644 index 0000000..4ce776d --- /dev/null +++ b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/QTcpServerPub.cpp @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2016 EPFL + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ + +/** + * @file QTcpServerPub.cpp + * @brief A QTcpServer that emits incomingConnection() as signal (duh) + * @author Ayberk Özgür + * @date 2016-11-15 + */ + +#include"QTcpServerPub.h" + +namespace QMLTcpSockets{ + +QTcpServerPub::QTcpServerPub(QObject* parent) : QTcpServer(parent){ } + +void QTcpServerPub::incomingConnection(qintptr socketDescriptor){ + emit incomingConnectionSignal(socketDescriptor); +} + +} diff --git a/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/QTcpServerPub.h b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/QTcpServerPub.h new file mode 100644 index 0000000..2e07c2e --- /dev/null +++ b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/QTcpServerPub.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2016 EPFL + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ + +/** + * @file QTcpServerPub.h + * @brief A QTcpServer that emits incomingConnection() as signal (duh) + * @author Ayberk Özgür + * @date 2016-11-15 + */ + +#ifndef QTCPSERVERPUB_H +#define QTCPSERVERPUB_H + +#include + +namespace QMLTcpSockets{ + +/** @cond DO_NOT_DOCUMENT */ + +/** + * @brief A QTcpServer that emits incomingConnection() as signal (duh) + */ +class QTcpServerPub : public QTcpServer { + /* *INDENT-OFF* */ + Q_OBJECT + /* *INDENT-ON* */ + +public: + + /** + * @brief Creates a new QTcpServerPub with the given Qt parent + * + * @param parent The Qt parent + */ + QTcpServerPub(QObject* parent = 0); + +signals: + + /** + * @brief Emitted when there's a new incoming connection + * + * @param socketDescriptor Descriptor of the incoming connection that can be used to create a QTcpSocket + */ + void incomingConnectionSignal(qintptr socketDescriptor); + +protected: + + /** + * @brief Called by the super class when there's a new incoming connection + * + * @param socketDescriptor Descriptor of the incoming connection that can be used to create a QTcpSocket + */ + void incomingConnection(qintptr socketDescriptor) override; + +}; + +/** @endcond */ + +} + +#endif /* QTCPSERVERPUB_H */ diff --git a/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/TcpServer.cpp b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/TcpServer.cpp new file mode 100644 index 0000000..81ed63a --- /dev/null +++ b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/TcpServer.cpp @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2016 EPFL + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ + +/** + * @file TcpServer.cpp + * @brief QML wrapper source for QTcpServer + * @author Ayberk Özgür + * @date 2016-11-10 + */ + +#include "TcpServer.h" + +namespace QMLTcpSockets{ + +TcpServer::TcpServer(QQuickItem* parent): + QQuickItem(parent), + server(this) +{ + host = "0.0.0.0"; + port = 0; + connect(&server, SIGNAL(incomingConnectionSignal(qintptr)), this, SLOT(publishIncomingConnection(qintptr))); +} + +TcpServer::~TcpServer(){} + +bool TcpServer::isListening() const{ + return server.isListening(); +} + +void TcpServer::setListening(bool enable){ + bool wasListening = server.isListening(); + + if(enable){ + if(!server.listen(QHostAddress(host), port)) + qWarning() << "TcpServer::setListening(): Couldn't start listening: " << server.errorString(); + } + else + server.close(); + + if(wasListening != server.isListening()) + emit listeningChanged(); +} + +void TcpServer::setHost(QString host){ + if(host != this->host){ + bool wasListening = isListening(); + setListening(false); + this->host = host; + if(wasListening) + setListening(true); + emit hostChanged(); + } +} + +void TcpServer::setPort(int port){ + if(port < 0){ + qWarning() << "TcpServer::setPort(): port given was negative, setting to 0."; + port = 0; + } + else if(port > 0xFFFF){ + qWarning() << "TcpServer::setPort(): port given was larger than 65535, setting to 65535."; + port = 0xFFFF; + } + + if(port != this->port){ + bool wasListening = isListening(); + setListening(false); + this->port = port; + if(wasListening) + setListening(true); + emit portChanged(); + } +} + +void TcpServer::publishIncomingConnection(qintptr socketDescriptor){ + QIntPtr* wrappedSocketDesc = new QIntPtr(); + wrappedSocketDesc->ptr = socketDescriptor; + emit newConnection(wrappedSocketDesc); +} + +} diff --git a/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/TcpServer.h b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/TcpServer.h new file mode 100644 index 0000000..4117eb8 --- /dev/null +++ b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/TcpServer.h @@ -0,0 +1,160 @@ +/* + * Copyright (C) 2016 EPFL + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ + +/** + * @file TcpServer.h + * @brief QML wrapper header for QTcpServer + * @author Ayberk Özgür + * @date 2016-11-10 + */ + +#ifndef TCPSERVER_H +#define TCPSERVER_H + +#include + +#include "QTcpServerPub.h" +#include "TcpSocket.h" +#include "QIntPtr.h" + +namespace QMLTcpSockets{ + +/** + * @brief QML wrapper for QTcpServer + * + * Due to the sandboxing of WinRT, cannot listen on nor connect to localhost sockets on this platform. + */ +class TcpServer : public QQuickItem { + /* *INDENT-OFF* */ + Q_OBJECT + /* *INDENT-ON* */ + + /** @brief Whether to listen for incoming connections, default false */ + Q_PROPERTY(bool listen READ isListening WRITE setListening NOTIFY listeningChanged) + + /** @brief Address to listen on, default "0.0.0.0" i.e any address */ + Q_PROPERTY(QString host READ getHost WRITE setHost NOTIFY hostChanged) + + /** @brief Port to listen on, must be in [0,65535], default 0 */ + Q_PROPERTY(int port READ getPort WRITE setPort NOTIFY portChanged) + +public: + + /** @cond DO_NOT_DOCUMENT */ + + /** + * @brief Creates a new TcpServer with the given QML parent + * + * @param parent The QML parent + */ + TcpServer(QQuickItem* parent = 0); + + /** + * @brief Destroys this TcpServer + */ + ~TcpServer(); + + /** + * @brief Gets whether the socket is listening + * + * @return Whether the socket is listening + */ + bool isListening() const; + + /** + * @brief Enables/disables listening + * + * @param enable Whether to listen or close the socket and stop listening + */ + void setListening(bool enable); + + /** + * @brief Gets the current host name + * + * @return Current host name, e.g "127.0.0.1" + */ + QString getHost() const { return host; } + + /** + * @brief Sets the host name + * + * @param host The new host name, e.g "127.0.0.1" + */ + void setHost(QString host); + + /** + * @brief Gets the current port + * + * @return Current port + */ + int getPort() const { return port; } + + /** + * @brief Sets the port + * + * @param port The new port, must be in [0,65535] + */ + void setPort(int port); + + /** @endcond */ + +signals: + + /** @cond DO_NOT_DOCUMENT */ + + /** + * @brief Emitted when listening changes + */ + void listeningChanged(); + + /** + * @brief Emitted when the host name changes + */ + void hostChanged(); + + /** + * @brief Emitted whe the port changes + */ + void portChanged(); + + /** @endcond */ + + /** + * @brief Emitted when a new connection is made to the server, socketDescriptor must be passed to a TcpSocket or a TcpSocketFactory to create the socket + * + * @param socketDescriptor Native descriptor to the socket that has just connected + */ + void newConnection(QMLTcpSockets::QIntPtr* socketDescriptor); + +private slots: + + /** + * @brief Gets the incoming connection descriptor, wraps it in a QIntPtr and publishes it + */ + void publishIncomingConnection(qintptr socketDescriptor); + +private: + + QString host; ///< Host address, e.g "127.0.0.1" + quint16 port; ///< Port to listen to + QTcpServerPub server; ///< The QTcpServer object to wrap + +}; + +} + +#endif /* TCPSERVER_H */ diff --git a/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/TcpSocket.cpp b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/TcpSocket.cpp new file mode 100644 index 0000000..76cf97d --- /dev/null +++ b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/TcpSocket.cpp @@ -0,0 +1,160 @@ +/* + * Copyright (C) 2016 EPFL + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ + +/** + * @file TcpSocket.cpp + * @brief QML wrapper source for QTcpSocket + * @author Ayberk Özgür + * @date 2016-11-10 + */ + +#include "TcpSocket.h" + +#include + +namespace QMLTcpSockets{ + +TcpSocket::TcpSocket(QQuickItem* parent): + QQuickItem(parent), + socket(this) +{ + connect(&socket, SIGNAL(connected()), this, SIGNAL(connected())); + connect(&socket, SIGNAL(disconnected()), this, SIGNAL(disconnected())); + connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(emitErrorAsInt(QAbstractSocket::SocketError))); + connect(&socket, SIGNAL(readyRead()), this, SLOT(publish())); + peer = ""; + port = 0; +} + +TcpSocket::TcpSocket(QIntPtr* socketDescriptor, QQuickItem* parent): + TcpSocket(parent) +{ + socket.setSocketDescriptor(socketDescriptor->ptr); + socketDescriptor->deleteLater(); + peer = socket.peerAddress().toString(); + port = socket.peerPort(); +} + +TcpSocket::~TcpSocket(){ + socket.flush(); +} + +void TcpSocket::setSocketDescriptor(QIntPtr* socketDescriptor){ + socket.flush(); + socket.disconnectFromHost(); + + socket.setSocketDescriptor(socketDescriptor->ptr); + socketDescriptor->deleteLater(); + + QString peer = socket.peerAddress().toString(); + if(this->peer != peer){ + this->peer = peer; + emit peerChanged(); + } + + quint16 port = socket.peerPort(); + if(this->port != port){ + this->port = port; + emit portChanged(); + } + + emit connected(); +} + +void TcpSocket::setSocketOption(int option, QVariant value){ + socket.setSocketOption((QAbstractSocket::SocketOption)option, value); +} + +void TcpSocket::setPeer(QString peer){ + if(peer != this->peer){ + if(socket.state() != TcpSocketEnums::UnconnectedState) + qWarning() << "TcpSocket::setPeer(): Can only set peer while disconnected."; + else{ + this->peer = peer; + emit peerChanged(); + } + } +} + +void TcpSocket::setPort(int port){ + if(port < 0){ + qWarning() << "TcpSocket::setPort(): port given was negative, setting to 0."; + port = 0; + } + else if(port > 0xFFFF){ + qWarning() << "TcpSocket::setPort(): port given was larger than 65535, setting to 65535."; + port = 0xFFFF; + } + + if(port != this->port){ + if(socket.state() != TcpSocketEnums::UnconnectedState) + qWarning() << "TcpSocket::setPort(): Can only set port while disconnected."; + else{ + this->port = port; + emit portChanged(); + } + } +} + +void TcpSocket::connectToHost(){ + socket.connectToHost(peer, port); +} + +void TcpSocket::disconnectFromHost(){ + socket.disconnectFromHost(); +} + +void TcpSocket::emitErrorAsInt(QAbstractSocket::SocketError socketError){ + emit error(socketError); +} + +void TcpSocket::publish(){ + QList list; + QByteArray receivedBytes = socket.readAll(); + for(char c : receivedBytes) + list << (int)(*((unsigned char*)(&c))); + emit bytesReceived(list); +} + +bool TcpSocket::writeBytes(QList bytes){ + QByteArray container; + for(int b : bytes){ + if(b < 0 || b > 0xFF){ + qWarning() << "TcpSocket::writeBytes(): bytes contain integer not in [0x00,0xFF], not writing"; + return false; + } + else + container.append((char)b); + } + + int numBytesToWrite = container.size(); + const char* bytesRaw = container.constData(); + while(numBytesToWrite > 0){ + int bytesWritten = socket.write(bytesRaw, numBytesToWrite); + if(bytesWritten < 0){ + qWarning() << "TcpSocket::writeBytes(): Bytes were not written: " << socket.errorString(); + return false; + } + numBytesToWrite -= bytesWritten; + bytesRaw += bytesWritten; + } + socket.flush(); + + return true; +} + +} diff --git a/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/TcpSocket.h b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/TcpSocket.h new file mode 100644 index 0000000..32723fc --- /dev/null +++ b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/TcpSocket.h @@ -0,0 +1,209 @@ +/* + * Copyright (C) 2016 EPFL + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ + +/** + * @file TcpSocket.h + * @brief QML wrapper header for QTcpSocket + * @author Ayberk Özgür + * @date 2016-11-10 + */ + +#ifndef TCPSOCKET_H +#define TCPSOCKET_H + +#include +#include +#include + +#include "QIntPtr.h" +#include "TcpSocketEnums.h" + +namespace QMLTcpSockets{ + +/** + * @brief QML wrapper for QTcpSocket + * + * Can be created from a native socket descriptor returned from a TcpServer incoming connection, or can connect to a peer on its own. + * Due to the sandboxing of WinRT, cannot listen on nor connect to localhost sockets on this platform. + */ +class TcpSocket : public QQuickItem { + /* *INDENT-OFF* */ + Q_OBJECT + /* *INDENT-ON* */ + + /** @brief Address to connect to, or address of the already open remote connection, default "" */ + Q_PROPERTY(QString peer READ getPeer WRITE setPeer NOTIFY peerChanged) + + /** @brief Port to connect to, or port of the already open remote connection , must be in [0,65535], default 0 */ + Q_PROPERTY(int port READ getPort WRITE setPort NOTIFY portChanged) + +public: + + /** @cond DO_NOT_DOCUMENT */ + + /** + * @brief Creates a new TcpSocket with the given QML parent + * + * @param parent The QML parent + */ + TcpSocket(QQuickItem* parent = 0); + + /** + * @brief Creates a new TcpSocket with the given QML parent, calls socketDescriptor->deleteLater() + * + * @param socketDescriptor Descriptor to the external native socket that was opened outside this wrapper, calls deleteLater() on it in the end + * @param parent The QML parent + */ + TcpSocket(QMLTcpSockets::QIntPtr* socketDescriptor, QQuickItem* parent = 0); + + /** + * @brief Destroys this TcpSocket + */ + ~TcpSocket(); + + /** + * @brief Gets the current peer name + * + * @return Current peer name, e.g "127.0.0.1" + */ + QString getPeer() const { return peer; } + + /** + * @brief Sets the peer name + * + * @param peer The new peer name, e.g "127.0.0.1" + */ + void setPeer(QString peer); + + /** + * @brief Gets the current port + * + * @return Current port + */ + int getPort() const { return port; } + + /** + * @brief Sets the port + * + * @param port The new port, must be in [0,65535] + */ + void setPort(int port); + + /** @endcond */ + +public slots: + + /** + * @brief Initializes the socket with the given native descriptor (returned from TcpServer), calls socketDescriptor->deleteLater() in the end + * + * @param socketDescriptor Native socket descriptor, calls deleterLater() on it in the end + */ + void setSocketDescriptor(QMLTcpSockets::QIntPtr* socketDescriptor); + + /** + * Sets the given low level option to the value described by value. + * + * @param option The option of TcpSocketEnums::SocketOption type (see http://doc.qt.io/qt-5/qabstractsocket.html#SocketOption-enum) + * @param value The value + */ + void setSocketOption(int option, QVariant value); + + /** + * @brief Initiates a connection to the peer on port + */ + void connectToHost(); + + /** + * @brief Starts closing the socket + */ + void disconnectFromHost(); + + /** + * @brief Writes bytes over the socket + * + * @param bytes Bytes to write, all must be within [0x00,0xFF] + * @return Whether all bytes were successfully written + */ + bool writeBytes(QList bytes); + +signals: + + /** @cond DO_NOT_DOCUMENT */ + + /** + * @brief Emitted when the peer name changes + */ + void peerChanged(); + + /** + * @brief Emitted whe the port changes + */ + void portChanged(); + + /** @endcond */ + + /** + * @brief Emitted when the socket is connected + */ + void connected(); + + /** + * @brief Emitted when the socket is disconected + */ + void disconnected(); + + /** + * @brief Emitted when there is an error + * + * @param socketError The error of TcpSocketEnums::SocketError type (see http://doc.qt.io/qt-5/qabstractsocket.html#SocketError-enum) + */ + void error(int socketError); + + /** + * @brief Emitted when some bytes are received + * + * @param bytes Byte array that was received, all elements are guaranteed to be in [0x00, 0xFF] + */ + void bytesReceived(QList bytes); + +private slots: + + /** + * @brief Publishes all available received bytes via bytesReceived(QVariant) + */ + void publish(); + + /** + * @brief Emits error(int socketError) + * + * @param socketError The socket error to emit + */ + void emitErrorAsInt(QAbstractSocket::SocketError socketError); + +private: + + QTcpSocket socket; ///< The low level socket + QString peer; ///< Peer address + quint16 port; ///< Connection port + +}; + +} + +Q_DECLARE_METATYPE(QMLTcpSockets::TcpSocket*) + +#endif /* TCPSOCKET_H */ diff --git a/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/TcpSocketEnums.cpp b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/TcpSocketEnums.cpp new file mode 100644 index 0000000..cba08bb --- /dev/null +++ b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/TcpSocketEnums.cpp @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2016 EPFL + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ + +/** + * @file TcpSocketEnums.cpp + * @brief Wrapper to expose QAbstractSocket enums + * @author Ayberk Özgür + * @date 2016-11-16 + */ + +#include "TcpSocketEnums.h" + +namespace QMLTcpSockets{ + +TcpSocketEnums::TcpSocketEnums(QObject* parent) : QAbstractSocket(QAbstractSocket::TcpSocket, parent){ } + +TcpSocketEnums::~TcpSocketEnums(){ } + +} diff --git a/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/TcpSocketEnums.h b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/TcpSocketEnums.h new file mode 100644 index 0000000..379f09a --- /dev/null +++ b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/TcpSocketEnums.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2016 EPFL + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ + +/** + * @file TcpSocketEnums.h + * @brief Wrapper to expose QAbstractSocket enums + * @author Ayberk Özgür + * @date 2016-11-16 + */ + +#ifndef TCPSOCKETENUMS_H +#define TCPSOCKETENUMS_H + +#include + +namespace QMLTcpSockets{ + +/** + * @brief Wrapper to expose QAbstractSocket enums, see http://doc.qt.io/qt-5/qabstractsocket.html + */ +class TcpSocketEnums : public QAbstractSocket { + /* *INDENT-OFF* */ + Q_OBJECT + /* *INDENT-ON* */ + +public: + + /** @cond DO_NOT_DOCUMENT */ + + /** + * @brief Creates a new TcpSocketEnums with the given Qt parent + * + * @param parent The Qt parent + */ + TcpSocketEnums(QObject* parent = 0); + + /** + * @brief Destroys this TcpSocketEnums + */ + ~TcpSocketEnums(); + + /** @endcod */ + +}; + +} + +#endif /* TCPSOCKETENUMS_H */ diff --git a/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/TcpSocketFactory.cpp b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/TcpSocketFactory.cpp new file mode 100644 index 0000000..8336e86 --- /dev/null +++ b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/TcpSocketFactory.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2016 EPFL + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ + +/** + * @file TcpSocketFactory.cpp + * @brief Singleton TcpSocket factory for QML + * @author Ayberk Özgür + * @date 2016-11-15 + */ + +#include"TcpSocketFactory.h" + +namespace QMLTcpSockets{ + +TcpSocketFactory::TcpSocketFactory(QQuickItem* parent) : QQuickItem(parent){ } + +TcpSocketFactory::~TcpSocketFactory(){ } + +TcpSocket* TcpSocketFactory::fromDescriptor(QIntPtr* socketDescriptor, QQuickItem* parent){ + return new TcpSocket(socketDescriptor, parent); +} + +} diff --git a/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/TcpSocketFactory.h b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/TcpSocketFactory.h new file mode 100644 index 0000000..4c39742 --- /dev/null +++ b/ZBD_IIIDL_S_Project/Src/TrainManager/QmlTcpSocket/TcpSocketFactory.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2016 EPFL + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ + +/** + * @file TcpSocketFactory.h + * @brief Singleton TcpSocket factory for QML + * @author Ayberk Özgür + * @date 2016-11-15 + */ + +#ifndef TCPSOCKETFACTORY_H +#define TCPSOCKETFACTORY_H + +#include + +#include "TcpSocket.h" +#include "QIntPtr.h" + +namespace QMLTcpSockets{ + +/** + * @brief Creates new TcpSocket from native socket descriptor (returned from a TcpServer incoming connection). + * @singleton + */ +class TcpSocketFactory : public QQuickItem { + /* *INDENT-OFF* */ + Q_OBJECT + /* *INDENT-ON* */ + +public: + + /** @cond DO_NOT_DOCUMENT */ + + /** + * @brief Creates a new TcpSocketFactory with the given QML parent + * + * @param parent The QML parent + */ + TcpSocketFactory(QQuickItem* parent = 0); + + /** + * @brief Destroys this TcpSocketFactory + */ + ~TcpSocketFactory(); + + /** @endcond */ + +public slots: + + /** + * @brief Creates and returns a new open socket that wraps the native socket descriptor, with the given QML parent (optional) + * + * @param socketDescriptor Native socket descriptor + * @param parent QML parent of the newly created TcpSocket + * @return New socket, open if the descriptor is valid + */ + static QMLTcpSockets::TcpSocket* fromDescriptor(QMLTcpSockets::QIntPtr* socketDescriptor, QQuickItem* parent = 0); + +}; + +} + +#endif /* TCPSOCKETFACTORY_H */ diff --git a/ZBD_IIIDL_S_Project/Src/TrainManager/eyetrainwidget.cpp b/ZBD_IIIDL_S_Project/Src/TrainManager/eyetrainwidget.cpp index dc13abb..ef4575e 100644 --- a/ZBD_IIIDL_S_Project/Src/TrainManager/eyetrainwidget.cpp +++ b/ZBD_IIIDL_S_Project/Src/TrainManager/eyetrainwidget.cpp @@ -1,5 +1,6 @@ #include "eyetrainwidget.h" #include "ui_eyetrainwidget.h" +#include "BCIManager.h" eyeTrainWidget::eyeTrainWidget(QWidget *parent) : QWidget(parent), @@ -22,6 +23,8 @@ eyeTrainWidget::eyeTrainWidget(QWidget *parent) : m_st_bicycleParam.resistance = 10; //阻力 Nm 0~20挡 m_st_bicycleParam.spasmType = 0; //默认逆向 + BCIManager::getInstance().startLinkerPrograme(); + // int8_t controlState;//状态控制 0-停止 1启动 2-暂停 3-继续 // int8_t bodyPart; //训练部位 0-上肢 1-下肢 2-四肢 3-垂直上肢 @@ -37,6 +40,7 @@ eyeTrainWidget::eyeTrainWidget(QWidget *parent) : // int8_t spasmType; //痉挛后方向 1-正向 0-逆向,默认逆向,没有了 // uint8_t trainTime; //训练时间 0~120min + } eyeTrainWidget::~eyeTrainWidget() diff --git a/ZBD_IIIDL_S_Project/UpLowLimp.pro b/ZBD_IIIDL_S_Project/UpLowLimp.pro index 694292b..08f6bad 100644 --- a/ZBD_IIIDL_S_Project/UpLowLimp.pro +++ b/ZBD_IIIDL_S_Project/UpLowLimp.pro @@ -116,6 +116,14 @@ SOURCES += \ Src/Report/trainreporttwothree.cpp \ Src/Report/trainreporttwotwo.cpp \ Src/Setting/settingwidget.cpp \ + Src/TrainManager/BCIManager.cpp \ + Src/TrainManager/QmlTcpSocket/QIntPtr.cpp \ + Src/TrainManager/QmlTcpSocket/QMLTcpSocketsPlugin.cpp \ + Src/TrainManager/QmlTcpSocket/QTcpServerPub.cpp \ + Src/TrainManager/QmlTcpSocket/TcpServer.cpp \ + Src/TrainManager/QmlTcpSocket/TcpSocket.cpp \ + Src/TrainManager/QmlTcpSocket/TcpSocketEnums.cpp \ + Src/TrainManager/QmlTcpSocket/TcpSocketFactory.cpp \ Src/TrainManager/armorleg.cpp \ # Src/TrainManager/fesparamset.cpp \ Src/TrainManager/braintrain.cpp \ @@ -186,6 +194,14 @@ HEADERS += \ Src/Report/trainreporttwothree.h \ Src/Report/trainreporttwotwo.h \ Src/Setting/settingwidget.h \ + Src/TrainManager/BCIManager.h \ + Src/TrainManager/QmlTcpSocket/QIntPtr.h \ + Src/TrainManager/QmlTcpSocket/QMLTcpSocketsPlugin.h \ + Src/TrainManager/QmlTcpSocket/QTcpServerPub.h \ + Src/TrainManager/QmlTcpSocket/TcpServer.h \ + Src/TrainManager/QmlTcpSocket/TcpSocket.h \ + Src/TrainManager/QmlTcpSocket/TcpSocketEnums.h \ + Src/TrainManager/QmlTcpSocket/TcpSocketFactory.h \ Src/TrainManager/armorleg.h \ # Src/TrainManager/fesparamset.h \ Src/TrainManager/braintrain.h \ diff --git a/ZBD_IIIDL_S_Project/UpLowLimp.pro.user b/ZBD_IIIDL_S_Project/UpLowLimp.pro.user index 05fc5b4..42ddfe9 100644 --- a/ZBD_IIIDL_S_Project/UpLowLimp.pro.user +++ b/ZBD_IIIDL_S_Project/UpLowLimp.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -241,14 +241,14 @@ 2 false - - Qt4ProjectManager.Qt4RunConfiguration:F:/updown/ZBD_IIIDL_S_Project/UpLowLimp.pro - F:/updown/ZBD_IIIDL_S_Project/UpLowLimp.pro - false + UpLowLimp2 + Qt4ProjectManager.Qt4RunConfiguration:F:/updown/UpLowLimp/ZBD_IIIDL_S_Project/UpLowLimp.pro + F:/updown/UpLowLimp/ZBD_IIIDL_S_Project/UpLowLimp.pro + true true true true - F:/updown/ZBD_IIIDL_S_Project/release + F:/updown/UpLowLimp/ZBD_IIIDL_S_Project/release 1 diff --git a/ZBD_IIIDL_S_Project/image.qrc b/ZBD_IIIDL_S_Project/image.qrc index 3cdd199..cbef918 100644 --- a/ZBD_IIIDL_S_Project/image.qrc +++ b/ZBD_IIIDL_S_Project/image.qrc @@ -232,5 +232,60 @@ DependFile/Source/brainTrain/brain_icon_vision.png DependFile/QML/Ssvep.qml DependFile/Source/signal/icon_brain_on.png + DependFile/Source/brainTrain/vision_btn_start.png + DependFile/Source/brainTrain/vision_img_board.png + DependFile/Source/brainTrain/upTest/upper_stretch_R01.png + DependFile/Source/brainTrain/upTest/upper_stretch_R02.png + DependFile/Source/brainTrain/upTest/upper_stretch_R03.png + DependFile/Source/brainTrain/upTest/upper_stretch_R04.png + DependFile/Source/brainTrain/upTest/upper_stretch_R05.png + DependFile/Source/brainTrain/upTest/upper_stretch_R06.png + DependFile/Source/brainTrain/upTest/upper_stretch_R07.png + DependFile/Source/brainTrain/upTest/upper_stretch_R08.png + DependFile/Source/brainTrain/upTest/upper_stretch_R09.png + DependFile/Source/brainTrain/upTest/upper_stretch_R10.png + DependFile/Source/brainTrain/upTest/upper_stretch_R11.png + DependFile/Source/brainTrain/upTest/upper_stretch_R12.png + DependFile/Source/brainTrain/upTest/upper_stretch_R13.png + DependFile/Source/brainTrain/upTest/upper_stretch_R14.png + DependFile/Source/brainTrain/upTest/upper_stretch_R15.png + DependFile/Source/brainTrain/upTest1/upper_stretch_R01.png + DependFile/Source/brainTrain/upTest1/upper_stretch_R02.png + DependFile/Source/brainTrain/upTest1/upper_stretch_R03.png + DependFile/Source/brainTrain/upTest1/upper_stretch_R04.png + DependFile/Source/brainTrain/upTest1/upper_stretch_R05.png + DependFile/Source/brainTrain/upTest1/upper_stretch_R06.png + DependFile/Source/brainTrain/upTest1/upper_stretch_R07.png + DependFile/Source/brainTrain/upTest1/upper_stretch_R08.png + DependFile/Source/brainTrain/upTest1/upper_stretch_R09.png + DependFile/Source/brainTrain/upTest1/upper_stretch_R10.png + DependFile/Source/brainTrain/upTest1/upper_stretch_R11.png + DependFile/Source/brainTrain/upTest1/upper_stretch_R12.png + DependFile/Source/brainTrain/upTest1/upper_stretch_R13.png + DependFile/Source/brainTrain/upTest1/upper_stretch_R14.png + DependFile/Source/brainTrain/upTest1/upper_stretch_R15.png + DependFile/Source/brainTrain/upTest2D/upper_stretch_R01.png + DependFile/Source/brainTrain/upTest2D/upper_stretch_R02.png + DependFile/Source/brainTrain/upTest2D/upper_stretch_R03.png + DependFile/Source/brainTrain/upTest2D/upper_stretch_R04.png + DependFile/Source/brainTrain/upTest2D/upper_stretch_R05.png + DependFile/Source/brainTrain/upTest2D/upper_stretch_R06.png + DependFile/Source/brainTrain/upTest2D/upper_stretch_R07.png + DependFile/Source/brainTrain/upTest3/upper_stretch_R01.png + DependFile/Source/brainTrain/upTest3/upper_stretch_R02.png + DependFile/Source/brainTrain/upTest3/upper_stretch_R03.png + DependFile/Source/brainTrain/upTest3/upper_stretch_R04.png + DependFile/Source/brainTrain/upTest3/upper_stretch_R05.png + DependFile/Source/brainTrain/upTest3/upper_stretch_R06.png + DependFile/Source/brainTrain/upTest3/upper_stretch_R07.png + DependFile/Source/brainTrain/upTest3/upper_stretch_R08.png + DependFile/Source/brainTrain/upTest3/upper_stretch_R09.png + DependFile/Source/brainTrain/upTest3/upper_stretch_R10.png + DependFile/Source/brainTrain/upTest3/upper_stretch_R11.png + DependFile/Source/brainTrain/upTest3/upper_stretch_R12.png + DependFile/Source/brainTrain/upTest3/upper_stretch_R13.png + DependFile/Source/brainTrain/upTest3/upper_stretch_R14.png + DependFile/Source/brainTrain/upTest3/upper_stretch_R15.png + DependFile/Source/brainTrain/upTest3/upper_stretch_R16.png diff --git a/ZBD_IIIDL_S_Project/release/BCILinker/SunnyLinkTool/SunnyLinkTool.exe b/ZBD_IIIDL_S_Project/release/SunnyLinkTool.exe similarity index 100% rename from ZBD_IIIDL_S_Project/release/BCILinker/SunnyLinkTool/SunnyLinkTool.exe rename to ZBD_IIIDL_S_Project/release/SunnyLinkTool.exe diff --git a/ZBD_IIIDL_S_Project/release/BCILinker/SunnyLinkTool/UI/figures/food.jpg b/ZBD_IIIDL_S_Project/release/UI/figures/food.jpg similarity index 100% rename from ZBD_IIIDL_S_Project/release/BCILinker/SunnyLinkTool/UI/figures/food.jpg rename to ZBD_IIIDL_S_Project/release/UI/figures/food.jpg diff --git a/ZBD_IIIDL_S_Project/release/BCILinker/SunnyLinkTool/UI/figures/lamp.png b/ZBD_IIIDL_S_Project/release/UI/figures/lamp.png similarity index 100% rename from ZBD_IIIDL_S_Project/release/BCILinker/SunnyLinkTool/UI/figures/lamp.png rename to ZBD_IIIDL_S_Project/release/UI/figures/lamp.png diff --git a/ZBD_IIIDL_S_Project/release/BCILinker/SunnyLinkTool/UI/figures/phone.jpg b/ZBD_IIIDL_S_Project/release/UI/figures/phone.jpg similarity index 100% rename from ZBD_IIIDL_S_Project/release/BCILinker/SunnyLinkTool/UI/figures/phone.jpg rename to ZBD_IIIDL_S_Project/release/UI/figures/phone.jpg diff --git a/ZBD_IIIDL_S_Project/release/BCILinker/SunnyLinkTool/UI/figures/phone.png b/ZBD_IIIDL_S_Project/release/UI/figures/phone.png similarity index 100% rename from ZBD_IIIDL_S_Project/release/BCILinker/SunnyLinkTool/UI/figures/phone.png rename to ZBD_IIIDL_S_Project/release/UI/figures/phone.png diff --git a/ZBD_IIIDL_S_Project/release/BCILinker/SunnyLinkTool/UI/figures/radio.png b/ZBD_IIIDL_S_Project/release/UI/figures/radio.png similarity index 100% rename from ZBD_IIIDL_S_Project/release/BCILinker/SunnyLinkTool/UI/figures/radio.png rename to ZBD_IIIDL_S_Project/release/UI/figures/radio.png diff --git a/ZBD_IIIDL_S_Project/release/BCILinker/SunnyLinkTool/UI/figures/toilet.jpg b/ZBD_IIIDL_S_Project/release/UI/figures/toilet.jpg similarity index 100% rename from ZBD_IIIDL_S_Project/release/BCILinker/SunnyLinkTool/UI/figures/toilet.jpg rename to ZBD_IIIDL_S_Project/release/UI/figures/toilet.jpg diff --git a/ZBD_IIIDL_S_Project/release/BCILinker/SunnyLinkTool/UI/figures/unknown.jpg b/ZBD_IIIDL_S_Project/release/UI/figures/unknown.jpg similarity index 100% rename from ZBD_IIIDL_S_Project/release/BCILinker/SunnyLinkTool/UI/figures/unknown.jpg rename to ZBD_IIIDL_S_Project/release/UI/figures/unknown.jpg diff --git a/ZBD_IIIDL_S_Project/release/BCILinker/SunnyLinkTool/UI/figures/xy.jpg b/ZBD_IIIDL_S_Project/release/UI/figures/xy.jpg similarity index 100% rename from ZBD_IIIDL_S_Project/release/BCILinker/SunnyLinkTool/UI/figures/xy.jpg rename to ZBD_IIIDL_S_Project/release/UI/figures/xy.jpg diff --git a/ZBD_IIIDL_S_Project/release/UpLowLimp.exe b/ZBD_IIIDL_S_Project/release/UpLowLimp.exe index ae4ff68..a1aa19c 100644 Binary files a/ZBD_IIIDL_S_Project/release/UpLowLimp.exe and b/ZBD_IIIDL_S_Project/release/UpLowLimp.exe differ diff --git a/ZBD_IIIDL_S_Project/release/cmd.txt b/ZBD_IIIDL_S_Project/release/cmd.txt new file mode 100644 index 0000000..6fd8406 --- /dev/null +++ b/ZBD_IIIDL_S_Project/release/cmd.txt @@ -0,0 +1 @@ +decoder_main.exe -t 0 -c com1 -p 115200 \ No newline at end of file diff --git a/ZBD_IIIDL_S_Project/release/BCILinker/SunnyLinkTool/config.ini b/ZBD_IIIDL_S_Project/release/config.ini similarity index 100% rename from ZBD_IIIDL_S_Project/release/BCILinker/SunnyLinkTool/config.ini rename to ZBD_IIIDL_S_Project/release/config.ini diff --git a/ZBD_IIIDL_S_Project/release/BCILinker/SunnyLinkTool/decoder_main.exe b/ZBD_IIIDL_S_Project/release/decoder_main.exe similarity index 100% rename from ZBD_IIIDL_S_Project/release/BCILinker/SunnyLinkTool/decoder_main.exe rename to ZBD_IIIDL_S_Project/release/decoder_main.exe diff --git a/ZBD_IIIDL_S_Project/release/BCILinker/SunnyLinkTool/imgs/brain128.png b/ZBD_IIIDL_S_Project/release/imgs/brain128.png similarity index 100% rename from ZBD_IIIDL_S_Project/release/BCILinker/SunnyLinkTool/imgs/brain128.png rename to ZBD_IIIDL_S_Project/release/imgs/brain128.png diff --git a/ZBD_IIIDL_S_Project/release/BCILinker/SunnyLinkTool/ssvep_main.exe b/ZBD_IIIDL_S_Project/release/ssvep_main.exe similarity index 100% rename from ZBD_IIIDL_S_Project/release/BCILinker/SunnyLinkTool/ssvep_main.exe rename to ZBD_IIIDL_S_Project/release/ssvep_main.exe