12/3
This commit is contained in:
parent
f4e520d795
commit
02c2b7d8ea
@ -6,7 +6,7 @@ Item {
|
||||
property int hitIndex: -1
|
||||
property bool bStimulate: false
|
||||
property int responseTime: 10
|
||||
property bool bTest: true
|
||||
property bool bTest: false
|
||||
property bool bConnect: false;
|
||||
property var brainTrainForm: null
|
||||
property string red: "#EE6352"
|
||||
@ -78,7 +78,7 @@ Item {
|
||||
"qrc:/DependFile/Source/brainTrain/upTest3/upper_stretch_R14.png",
|
||||
"qrc:/DependFile/Source/brainTrain/upTest3/upper_stretch_R15.png",
|
||||
"qrc:/DependFile/Source/brainTrain/upTest3/upper_stretch_R16.png",
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
function startStimulate()
|
||||
@ -89,11 +89,8 @@ Item {
|
||||
if(!bConnect)
|
||||
{
|
||||
clientSocket.connectToHost();
|
||||
bConnect = true;
|
||||
}else
|
||||
{
|
||||
clientSocket.writeBytes(getIntArr("1"));
|
||||
}
|
||||
clientSocket.writeBytes(getIntArr("1"));
|
||||
}
|
||||
|
||||
|
||||
@ -149,6 +146,15 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Timer {
|
||||
id: connectTimer
|
||||
interval: 3*1000;
|
||||
onTriggered: {
|
||||
clientSocket.connected();
|
||||
}
|
||||
}
|
||||
|
||||
function ssvepHit(index)
|
||||
{
|
||||
if(!bStimulate)
|
||||
@ -211,8 +217,10 @@ Item {
|
||||
Component.onCompleted:
|
||||
{
|
||||
bci.initTrain();
|
||||
clientSocket.connectToHost();
|
||||
}
|
||||
|
||||
|
||||
TcpSocket{
|
||||
id: clientSocket
|
||||
peer: "127.0.0.1"
|
||||
@ -232,12 +240,18 @@ Item {
|
||||
onConnected:
|
||||
{
|
||||
console.info("Client socket connected");
|
||||
writeBytes(getIntArr("1"));
|
||||
bConnect = true;
|
||||
bci.deviceStatus(true);
|
||||
if(connectTimer.running)
|
||||
{
|
||||
connectTimer.stop();
|
||||
}
|
||||
}
|
||||
onDisconnected:
|
||||
{
|
||||
console.info("Client socket disconnected");
|
||||
bConnect = false;
|
||||
bci.deviceStatus(false);
|
||||
}
|
||||
onPeerChanged:
|
||||
{
|
||||
@ -249,7 +263,11 @@ Item {
|
||||
}
|
||||
onError:
|
||||
{
|
||||
console.info("Client socket disconnected")
|
||||
console.info("Client socket error",socketError);
|
||||
if(socketError === 0 || socketError === 1)
|
||||
{
|
||||
connectTimer.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
BCIManager
|
||||
@ -881,10 +899,8 @@ Item {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
popimpedance.show()
|
||||
popimpedance.colorChange(5,green)
|
||||
|
||||
|
||||
|
||||
popimpedance.colorChange(2,green)
|
||||
popimpedance.colorChange(3,green)
|
||||
}
|
||||
|
||||
}
|
||||
@ -892,12 +908,5 @@ Item {
|
||||
PopImpedance{
|
||||
id:popimpedance
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
ZBD_IIIDL_S_Project/DependFile/Source/signal/icon_brain_off.png
Normal file
BIN
ZBD_IIIDL_S_Project/DependFile/Source/signal/icon_brain_off.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
@ -10,6 +10,7 @@
|
||||
#include "ccommunicateapi.h"
|
||||
#include "currentuserdata.h"
|
||||
#include "loginwidget.h"
|
||||
#include "BCIManager.h"
|
||||
|
||||
TitleWidget::TitleWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
@ -47,6 +48,9 @@ TitleWidget::TitleWidget(QWidget *parent) :
|
||||
ui->back2_Btn->setVisible(true);
|
||||
|
||||
m_soundDialog = new SoundDialog();
|
||||
|
||||
|
||||
connect(&BCIManager::getInstance(), &BCIManager::signalDeviceStatus, this, &TitleWidget::slotBciDeviceStatus);
|
||||
}
|
||||
|
||||
TitleWidget::~TitleWidget()
|
||||
@ -65,7 +69,9 @@ void TitleWidget::slotBackClicked()
|
||||
|
||||
int currentPage = MainWindowPageControl::getInstance()->getCurrentPageIndex();
|
||||
if(!(currentPage >= MainPage_E && currentPage <= visionTrain))
|
||||
{
|
||||
currentPage = MainPage_E; //初始化异常值276795792,设置当前页索引为0
|
||||
}
|
||||
qDebug() << "当前页" << currentPage;
|
||||
switch(currentPage)
|
||||
{
|
||||
@ -106,9 +112,13 @@ void TitleWidget::slotBackClicked()
|
||||
case TrainingParamSetting_E:
|
||||
{
|
||||
if(m_trainType == 0)
|
||||
{
|
||||
MainWindowPageControl::getInstance()->setCurrentPage(BicycleParamSet_E);
|
||||
}
|
||||
else if(m_trainType == 1)
|
||||
{
|
||||
MainWindowPageControl::getInstance()->setCurrentPage(FesBicycleParamSet_E);
|
||||
}
|
||||
|
||||
//qDebug() <<"Hello";
|
||||
}
|
||||
@ -289,7 +299,9 @@ void TitleWidget::showWIFI()
|
||||
pixmap.load(":/DependFile/Source/signal/deviceConnected.png");
|
||||
}
|
||||
else
|
||||
{
|
||||
pixmap.load(":/DependFile/Source/signal/deviceDisconnected.png");
|
||||
}
|
||||
|
||||
ui->wifiSignal_Label->setPixmap(pixmap);
|
||||
#endif
|
||||
@ -325,10 +337,14 @@ void TitleWidget::slotSaveUpPicture()
|
||||
QString dirPath = QApplication::applicationDirPath() + "/DependFile/Source/trainDisplayPage";
|
||||
QDir resultDir(dirPath);
|
||||
if(!resultDir.exists())
|
||||
{
|
||||
qDebug() << "保存图片失败";
|
||||
}
|
||||
if(upPicture.save(dirPath + "/upPicture.png"))
|
||||
{
|
||||
qDebug() << dirPath + "/upPicture.png";
|
||||
}
|
||||
}
|
||||
|
||||
void TitleWidget::changeEvent(QEvent *event)
|
||||
{
|
||||
@ -353,6 +369,18 @@ void TitleWidget::on_sound_Button_clicked()
|
||||
m_soundDialog->show();
|
||||
}
|
||||
|
||||
void TitleWidget::slotBciDeviceStatus(bool bConnected)
|
||||
{
|
||||
if(bConnected)
|
||||
{
|
||||
ui->brainSignal_Labe->setStyleSheet("QLabel#brainSignal_Labe{border-image:url(:/DependFile/Source/signal/icon_brain_on.png);}");
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->brainSignal_Labe->setStyleSheet("QLabel#brainSignal_Labe{border-image:url(:/DependFile/Source/signal/icon_brain_off.png);}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -8,7 +8,8 @@
|
||||
#include <QTimer>
|
||||
#include "sounddialog.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace Ui
|
||||
{
|
||||
class TitleWidget;
|
||||
}
|
||||
|
||||
@ -62,6 +63,8 @@ private slots:
|
||||
|
||||
//void on_back1_Btn_clicked();
|
||||
|
||||
void slotBciDeviceStatus(bool bConnected);
|
||||
|
||||
private:
|
||||
void showWIFI();
|
||||
private:
|
||||
|
@ -29,7 +29,6 @@
|
||||
<font>
|
||||
<family>黑体</family>
|
||||
<pointsize>28</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
@ -224,7 +223,7 @@ border:2px;</string>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">border-image: url(:/DependFile/Source/signal/icon_brain_on.png);</string>
|
||||
<string notr="true">border-image: url(:/DependFile/Source/signal/icon_brain_off.png);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
|
@ -76,6 +76,8 @@ void BCIManager::initTrain()
|
||||
m_st_bicycleParam.resistance = 0; //阻力 Nm 0~20挡
|
||||
m_st_bicycleParam.spasmType = 0; //默认逆向
|
||||
}
|
||||
|
||||
connect(this, &BCIManager::signalDeviceStatus, &getInstance(), &BCIManager::signalDeviceStatus);
|
||||
}
|
||||
|
||||
void BCIManager::slotLinkerProgrameReadyReadStandardOutput()
|
||||
@ -181,3 +183,8 @@ void BCIManager::continueTrain()
|
||||
CCommunicateAPI::getInstance()->sendBicycleParam(m_st_bicycleParam);
|
||||
}
|
||||
}
|
||||
|
||||
void BCIManager::deviceStatus(bool bConnected)
|
||||
{
|
||||
emit signalDeviceStatus(bConnected);
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ public:
|
||||
Q_INVOKABLE void stopTrain();
|
||||
Q_INVOKABLE void pauseTrain();
|
||||
Q_INVOKABLE void continueTrain();
|
||||
Q_INVOKABLE void deviceStatus(bool bConnected);
|
||||
|
||||
private slots:
|
||||
//Linker程序的标准输出
|
||||
@ -48,6 +49,8 @@ private slots:
|
||||
signals:
|
||||
void signalQmlStopLinkerPrograme();
|
||||
|
||||
void signalDeviceStatus(bool bConnected);
|
||||
|
||||
private:
|
||||
QProcess *m_pCmd = nullptr;
|
||||
|
||||
|
@ -290,5 +290,6 @@
|
||||
<file>DependFile/Source/brainTrain/popup_Z_bg.png</file>
|
||||
<file>DependFile/Source/brainTrain/btn_Z.png</file>
|
||||
<file>DependFile/QML/PopImpedance.qml</file>
|
||||
<file>DependFile/Source/signal/icon_brain_off.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user