11/28
This commit is contained in:
parent
9b6889d259
commit
80bbc13c78
@ -1,10 +1,11 @@
|
|||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import TcpSocket 2.0
|
import TcpSocket 2.0
|
||||||
|
import BCIManager 2.0
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
property int hitIndex: -1
|
property int hitIndex: -1
|
||||||
property bool bStimulate: false
|
property bool bStimulate: false
|
||||||
property int responseTime: 10*1000
|
property int responseTime: 10
|
||||||
property bool bTest: true
|
property bool bTest: true
|
||||||
property bool bConnect: false;
|
property bool bConnect: false;
|
||||||
|
|
||||||
@ -25,7 +26,20 @@ Item {
|
|||||||
"qrc:/DependFile/Source/brainTrain/upTest/upper_stretch_R12.png",
|
"qrc:/DependFile/Source/brainTrain/upTest/upper_stretch_R12.png",
|
||||||
"qrc:/DependFile/Source/brainTrain/upTest/upper_stretch_R13.png",
|
"qrc:/DependFile/Source/brainTrain/upTest/upper_stretch_R13.png",
|
||||||
"qrc:/DependFile/Source/brainTrain/upTest/upper_stretch_R14.png",
|
"qrc:/DependFile/Source/brainTrain/upTest/upper_stretch_R14.png",
|
||||||
"qrc:/DependFile/Source/brainTrain/upTest/upper_stretch_R15.png"
|
"qrc:/DependFile/Source/brainTrain/upTest/upper_stretch_R15.png",
|
||||||
|
"qrc:/DependFile/Source/brainTrain/upTest/upper_stretch_R14.png",
|
||||||
|
"qrc:/DependFile/Source/brainTrain/upTest/upper_stretch_R13.png",
|
||||||
|
"qrc:/DependFile/Source/brainTrain/upTest/upper_stretch_R12.png",
|
||||||
|
"qrc:/DependFile/Source/brainTrain/upTest/upper_stretch_R11.png",
|
||||||
|
"qrc:/DependFile/Source/brainTrain/upTest/upper_stretch_R10.png",
|
||||||
|
"qrc:/DependFile/Source/brainTrain/upTest/upper_stretch_R09.png",
|
||||||
|
"qrc:/DependFile/Source/brainTrain/upTest/upper_stretch_R08.png",
|
||||||
|
"qrc:/DependFile/Source/brainTrain/upTest/upper_stretch_R07.png",
|
||||||
|
"qrc:/DependFile/Source/brainTrain/upTest/upper_stretch_R06.png",
|
||||||
|
"qrc:/DependFile/Source/brainTrain/upTest/upper_stretch_R05.png",
|
||||||
|
"qrc:/DependFile/Source/brainTrain/upTest/upper_stretch_R04.png",
|
||||||
|
"qrc:/DependFile/Source/brainTrain/upTest/upper_stretch_R03.png",
|
||||||
|
"qrc:/DependFile/Source/brainTrain/upTest/upper_stretch_R02.png"
|
||||||
]
|
]
|
||||||
|
|
||||||
property int currentIndexTwelevHz: 0
|
property int currentIndexTwelevHz: 0
|
||||||
@ -120,7 +134,7 @@ Item {
|
|||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: hitTimer
|
id: hitTimer
|
||||||
interval: responseTime;
|
interval: responseTime*1000;
|
||||||
repeat: false
|
repeat: false
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
clearHit();
|
clearHit();
|
||||||
@ -142,14 +156,17 @@ Item {
|
|||||||
{
|
{
|
||||||
ssvepTenHzTimer.start();
|
ssvepTenHzTimer.start();
|
||||||
hitTimer.start();
|
hitTimer.start();
|
||||||
|
bci.startTrain(0,responseTime);
|
||||||
}else if(index === "1")
|
}else if(index === "1")
|
||||||
{
|
{
|
||||||
ssvepTwelveHzTimer.start();
|
ssvepTwelveHzTimer.start();
|
||||||
hitTimer.start();
|
hitTimer.start();
|
||||||
|
bci.startTrain(1,responseTime);
|
||||||
}else if(index === "2")
|
}else if(index === "2")
|
||||||
{
|
{
|
||||||
ssvepFifteenHzTimer.start();
|
ssvepFifteenHzTimer.start();
|
||||||
hitTimer.start();
|
hitTimer.start();
|
||||||
|
bci.startTrain(2,responseTime);
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -172,7 +189,6 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function onExit(){
|
function onExit(){
|
||||||
console.log("1222222222222222");
|
|
||||||
if(bConnect)
|
if(bConnect)
|
||||||
{
|
{
|
||||||
clientSocket.writeBytes(getIntArr("2"));
|
clientSocket.writeBytes(getIntArr("2"));
|
||||||
@ -187,7 +203,7 @@ Item {
|
|||||||
|
|
||||||
Component.onCompleted:
|
Component.onCompleted:
|
||||||
{
|
{
|
||||||
//BCIManager.signalQmlStopLinkerPrograme.connect(onExit);
|
bci.initTrain();
|
||||||
}
|
}
|
||||||
TcpSocket{
|
TcpSocket{
|
||||||
id: clientSocket
|
id: clientSocket
|
||||||
@ -228,6 +244,10 @@ Item {
|
|||||||
console.info("Client socket disconnected")
|
console.info("Client socket disconnected")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BCIManager
|
||||||
|
{
|
||||||
|
id:bci;
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle{
|
Rectangle{
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
@ -356,7 +376,7 @@ Item {
|
|||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
Timer {
|
Timer {
|
||||||
id: ssvepTenHzTimer
|
id: ssvepTenHzTimer
|
||||||
interval: 300;
|
interval: 70;
|
||||||
repeat: true
|
repeat: true
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
currentIndexTenHz = (currentIndexTenHz + 1) % imageFilesTenHz.length;
|
currentIndexTenHz = (currentIndexTenHz + 1) % imageFilesTenHz.length;
|
||||||
@ -726,7 +746,7 @@ Item {
|
|||||||
{
|
{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: {
|
onClicked: {
|
||||||
ssvepHit(0);
|
ssvepHit("0");
|
||||||
stopStimulate();
|
stopStimulate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -764,7 +784,7 @@ Item {
|
|||||||
{
|
{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: {
|
onClicked: {
|
||||||
ssvepHit(1);
|
ssvepHit("1");
|
||||||
stopStimulate();
|
stopStimulate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -802,7 +822,7 @@ Item {
|
|||||||
{
|
{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: {
|
onClicked: {
|
||||||
ssvepHit(2);
|
ssvepHit("2");
|
||||||
stopStimulate();
|
stopStimulate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,23 @@
|
|||||||
BCIManager::BCIManager(QObject *parent)
|
BCIManager::BCIManager(QObject *parent)
|
||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
{
|
{
|
||||||
|
heartTimer = new QTimer();
|
||||||
|
heartTimer->setInterval(1000);
|
||||||
|
heartTimer->start();
|
||||||
|
trainTimer = new QTimer();
|
||||||
|
connect(heartTimer, SIGNAL(timeout()), this, SLOT(slotHeartTimer()));
|
||||||
|
connect(trainTimer, SIGNAL(timeout()), this, SLOT(slotTrainTimer()));
|
||||||
|
|
||||||
|
m_st_bicycleParam.trainMode = 0; //被动
|
||||||
|
m_st_bicycleParam.spasmSwitch = 1; //开启
|
||||||
|
m_st_bicycleParam.spasmLevel = 1; //默认一级
|
||||||
|
m_st_bicycleParam.configPower = 0; //默认低
|
||||||
|
m_st_bicycleParam.switchDirectonTime = 10; //换向时间默认10
|
||||||
|
m_st_bicycleParam.phaseValue = 0; //协同相位值
|
||||||
|
m_st_bicycleParam.direction = 1; //方向正向
|
||||||
|
m_st_bicycleParam.speed = 10; //速度 10
|
||||||
|
m_st_bicycleParam.resistance = 10; //阻力 Nm 0~20挡
|
||||||
|
m_st_bicycleParam.spasmType = 0; //默认逆向
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,6 +67,34 @@ bool BCIManager::startLinkerPrograme()
|
|||||||
m_pCmd->start(strCmd);
|
m_pCmd->start(strCmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BCIManager::initTrain()
|
||||||
|
{
|
||||||
|
if(nullptr == heartTimer)
|
||||||
|
{
|
||||||
|
heartTimer = new QTimer();
|
||||||
|
heartTimer->setInterval(1000);
|
||||||
|
heartTimer->start();
|
||||||
|
connect(heartTimer, SIGNAL(timeout()), this, SLOT(slotHeartTimer()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(nullptr == trainTimer)
|
||||||
|
{
|
||||||
|
trainTimer = new QTimer();
|
||||||
|
connect(trainTimer, SIGNAL(timeout()), this, SLOT(slotTrainTimer()));
|
||||||
|
|
||||||
|
m_st_bicycleParam.trainMode = 0; //被动
|
||||||
|
m_st_bicycleParam.spasmSwitch = 1; //开启
|
||||||
|
m_st_bicycleParam.spasmLevel = 1; //默认一级
|
||||||
|
m_st_bicycleParam.configPower = 0; //默认低
|
||||||
|
m_st_bicycleParam.switchDirectonTime = 10; //换向时间默认10
|
||||||
|
m_st_bicycleParam.phaseValue = 0; //协同相位值
|
||||||
|
m_st_bicycleParam.direction = 1; //方向正向
|
||||||
|
m_st_bicycleParam.speed = 10; //速度 10
|
||||||
|
m_st_bicycleParam.resistance = 10; //阻力 Nm 0~20挡
|
||||||
|
m_st_bicycleParam.spasmType = 0; //默认逆向
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void BCIManager::slotLinkerProgrameReadyReadStandardOutput()
|
void BCIManager::slotLinkerProgrameReadyReadStandardOutput()
|
||||||
{
|
{
|
||||||
if(m_pCmd)
|
if(m_pCmd)
|
||||||
@ -66,3 +110,82 @@ void BCIManager::slotLinkerProgrameReadyReadStandardError()
|
|||||||
qDebug() << m_pCmd->readAllStandardError();
|
qDebug() << m_pCmd->readAllStandardError();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BCIManager::slotHeartTimer()
|
||||||
|
{
|
||||||
|
//qDebug()<<"上位机发送心跳";
|
||||||
|
CCommunicateAPI::getInstance()->sendHeartBeat();
|
||||||
|
static int num = 0;
|
||||||
|
++num;
|
||||||
|
if(num > 3)
|
||||||
|
{
|
||||||
|
num = 0;
|
||||||
|
QPixmap pixmap;
|
||||||
|
if(heartCount < 1)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
if(heartCount >= 3)
|
||||||
|
{
|
||||||
|
heartCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BCIManager::slotTrainTimer()
|
||||||
|
{
|
||||||
|
stopTrain();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BCIManager::startTrain(int Part, int Time)
|
||||||
|
{
|
||||||
|
initTrain();
|
||||||
|
if(trainTimer->isActive())
|
||||||
|
{
|
||||||
|
stopTrain();
|
||||||
|
}
|
||||||
|
trainTimer->setInterval(Time * 1000);
|
||||||
|
trainTimer->start();
|
||||||
|
//状态控制 0-停止 1启动 2-暂停 3-继续
|
||||||
|
m_st_bicycleParam.controlState = 1;
|
||||||
|
m_st_bicycleParam.bodyPart = Part; //训练部位 0-上肢 1-下肢 2-四肢 3-垂直上肢
|
||||||
|
m_st_bicycleParam.trainTime = 120;
|
||||||
|
CCommunicateAPI::getInstance()->sendBicycleParam(m_st_bicycleParam);
|
||||||
|
|
||||||
|
}
|
||||||
|
void BCIManager::stopTrain()
|
||||||
|
{
|
||||||
|
if(trainTimer)
|
||||||
|
{
|
||||||
|
if(trainTimer->isActive())
|
||||||
|
{
|
||||||
|
trainTimer->stop();
|
||||||
|
}
|
||||||
|
m_st_bicycleParam.controlState = 0;
|
||||||
|
CCommunicateAPI::getInstance()->sendBicycleParam(m_st_bicycleParam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void BCIManager::pauseTrain()
|
||||||
|
{
|
||||||
|
if(trainTimer)
|
||||||
|
{
|
||||||
|
trainTimer->stop();
|
||||||
|
m_st_bicycleParam.controlState = 2;
|
||||||
|
CCommunicateAPI::getInstance()->sendBicycleParam(m_st_bicycleParam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void BCIManager::continueTrain()
|
||||||
|
{
|
||||||
|
if(trainTimer)
|
||||||
|
{
|
||||||
|
trainTimer->start();
|
||||||
|
m_st_bicycleParam.controlState = 3;
|
||||||
|
CCommunicateAPI::getInstance()->sendBicycleParam(m_st_bicycleParam);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include "QmlTcpSocket/TcpSocket.h"
|
#include "QmlTcpSocket/TcpSocket.h"
|
||||||
|
#include "ccommunicateapi.h"
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
class BCIManager : public QObject
|
class BCIManager : public QObject
|
||||||
{
|
{
|
||||||
@ -20,21 +22,40 @@ public:
|
|||||||
static void registerQMLType()
|
static void registerQMLType()
|
||||||
{
|
{
|
||||||
qmlRegisterType<QMLTcpSockets::TcpSocket>("TcpSocket", 2, 0, "TcpSocket");
|
qmlRegisterType<QMLTcpSockets::TcpSocket>("TcpSocket", 2, 0, "TcpSocket");
|
||||||
|
qmlRegisterType<BCIManager>("BCIManager", 2, 0, "BCIManager");
|
||||||
}
|
}
|
||||||
//启动Linker工具
|
//启动Linker工具
|
||||||
bool startLinkerPrograme();
|
bool startLinkerPrograme();
|
||||||
|
|
||||||
|
|
||||||
|
Q_INVOKABLE void initTrain();
|
||||||
|
Q_INVOKABLE void startTrain(int Part, int Time);
|
||||||
|
Q_INVOKABLE void stopTrain();
|
||||||
|
Q_INVOKABLE void pauseTrain();
|
||||||
|
Q_INVOKABLE void continueTrain();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
//Linker程序的标准输出
|
//Linker程序的标准输出
|
||||||
void slotLinkerProgrameReadyReadStandardOutput();
|
void slotLinkerProgrameReadyReadStandardOutput();
|
||||||
//Linker程序的错误输出
|
//Linker程序的错误输出
|
||||||
void slotLinkerProgrameReadyReadStandardError();
|
void slotLinkerProgrameReadyReadStandardError();
|
||||||
|
|
||||||
|
//下位机心跳包
|
||||||
|
void slotHeartTimer();
|
||||||
|
//下位机心训练计时停止
|
||||||
|
void slotTrainTimer();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void signalQmlStopLinkerPrograme();
|
void signalQmlStopLinkerPrograme();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QProcess *m_pCmd = nullptr;
|
QProcess *m_pCmd = nullptr;
|
||||||
|
|
||||||
|
QTimer *heartTimer = nullptr;
|
||||||
|
QTimer *trainTimer = nullptr;
|
||||||
|
|
||||||
|
int heartCount = 0; //心跳次数,用于检测通信
|
||||||
|
ST_BicycleParam m_st_bicycleParam; //启动参数
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BCIMANAGER_H
|
#endif // BCIMANAGER_H
|
||||||
|
@ -8,58 +8,15 @@ eyeTrainWidget::eyeTrainWidget(QWidget *parent) :
|
|||||||
ui(new Ui::eyeTrainWidget)
|
ui(new Ui::eyeTrainWidget)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
heartTimer = new QTimer();
|
|
||||||
heartTimer->setInterval(1000);
|
|
||||||
heartTimer->start();
|
|
||||||
trainTimer = new QTimer();
|
|
||||||
connect(heartTimer, SIGNAL(timeout()), this, SLOT(slotHeartTimer()));
|
|
||||||
connect(trainTimer, SIGNAL(timeout()), this, SLOT(slotTrainTimer()));
|
|
||||||
|
|
||||||
m_st_bicycleParam.trainMode = 0; //被动
|
|
||||||
m_st_bicycleParam.spasmSwitch = 1; //开启
|
|
||||||
m_st_bicycleParam.spasmLevel = 1; //默认一级
|
|
||||||
m_st_bicycleParam.configPower = 0; //默认低
|
|
||||||
m_st_bicycleParam.switchDirectonTime = 10; //换向时间默认10
|
|
||||||
m_st_bicycleParam.phaseValue = 0; //协同相位值
|
|
||||||
m_st_bicycleParam.direction = 1; //方向正向
|
|
||||||
m_st_bicycleParam.speed = 10; //速度 10
|
|
||||||
m_st_bicycleParam.resistance = 10; //阻力 Nm 0~20挡
|
|
||||||
m_st_bicycleParam.spasmType = 0; //默认逆向
|
|
||||||
|
|
||||||
BCIManager::getInstance().startLinkerPrograme();
|
BCIManager::getInstance().startLinkerPrograme();
|
||||||
ui->quickWidget->setSource(QUrl("qrc:/DependFile/QML/Ssvep.qml"));
|
ui->quickWidget->setSource(QUrl("qrc:/DependFile/QML/Ssvep.qml"));
|
||||||
|
|
||||||
// int8_t controlState;//状态控制 0-停止 1启动 2-暂停 3-继续
|
|
||||||
// int8_t bodyPart; //训练部位 0-上肢 1-下肢 2-四肢 3-垂直上肢
|
|
||||||
// int8_t trainMode; //训练模式 0-被动 1-主动 2-助力 3-等速 4-上下肢协同被动 7-四肢主被动 9-单独主动 10-被动可切主动(主被动)
|
|
||||||
// int8_t spasmSwitch; //痉挛开关 0-关 1-开
|
|
||||||
// int8_t spasmLevel; //痉挛等级1~3挡
|
|
||||||
// int8_t configPower; //配置功率0~2 低中高
|
|
||||||
// int8_t switchDirectonTime;//换向时间
|
|
||||||
// int8_t phaseValue; //协同相位值
|
|
||||||
// int8_t direction; //方向 0-逆向 1-正向
|
|
||||||
// int8_t speed; //速度 2~60r/min
|
|
||||||
// int8_t resistance; //阻力 Nm 0~20挡
|
|
||||||
// int8_t spasmType; //痉挛后方向 1-正向 0-逆向,默认逆向,没有了
|
|
||||||
// uint8_t trainTime; //训练时间 0~120min
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
eyeTrainWidget::~eyeTrainWidget()
|
eyeTrainWidget::~eyeTrainWidget()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
if(heartTimer)
|
|
||||||
{
|
|
||||||
heartTimer->stop();
|
|
||||||
delete heartTimer;
|
|
||||||
}
|
|
||||||
if(trainTimer)
|
|
||||||
{
|
|
||||||
trainTimer->stop();
|
|
||||||
delete trainTimer;
|
|
||||||
}
|
|
||||||
delete ui;
|
delete ui;
|
||||||
QVariant retVal;
|
QVariant retVal;
|
||||||
QMetaObject::invokeMethod(ui->quickWidget->rootObject(),
|
QMetaObject::invokeMethod(ui->quickWidget->rootObject(),
|
||||||
@ -74,83 +31,10 @@ eyeTrainWidget::~eyeTrainWidget()
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
void eyeTrainWidget::startTrain(int8_t Part, int Time)
|
|
||||||
{
|
|
||||||
// heartTimer->start();
|
|
||||||
trainTimer->setInterval(Time*1000);
|
|
||||||
trainTimer->start();
|
|
||||||
//状态控制 0-停止 1启动 2-暂停 3-继续
|
|
||||||
m_st_bicycleParam.controlState = 1;
|
|
||||||
m_st_bicycleParam.bodyPart = Part; //训练部位 0-上肢 1-下肢 2-四肢 3-垂直上肢
|
|
||||||
m_st_bicycleParam.trainTime = 120;
|
|
||||||
CCommunicateAPI::getInstance()->sendBicycleParam(m_st_bicycleParam);
|
|
||||||
|
|
||||||
}
|
|
||||||
void eyeTrainWidget::stopTrain()
|
|
||||||
{
|
|
||||||
|
|
||||||
heartTimer->stop();
|
|
||||||
trainTimer->stop();
|
|
||||||
|
|
||||||
m_st_bicycleParam.controlState = 0;
|
|
||||||
CCommunicateAPI::getInstance()->sendBicycleParam(m_st_bicycleParam);
|
|
||||||
|
|
||||||
}
|
|
||||||
void eyeTrainWidget::pauseTrain()
|
|
||||||
{
|
|
||||||
trainTimer->stop();
|
|
||||||
m_st_bicycleParam.controlState = 2;
|
|
||||||
CCommunicateAPI::getInstance()->sendBicycleParam(m_st_bicycleParam);
|
|
||||||
}
|
|
||||||
void eyeTrainWidget::continueTrain()
|
|
||||||
{
|
|
||||||
trainTimer->start();
|
|
||||||
m_st_bicycleParam.controlState = 3;
|
|
||||||
CCommunicateAPI::getInstance()->sendBicycleParam(m_st_bicycleParam);
|
|
||||||
}
|
|
||||||
|
|
||||||
void eyeTrainWidget::slotQmlStatusChanged(QQuickWidget::Status emStatus)
|
void eyeTrainWidget::slotQmlStatusChanged(QQuickWidget::Status emStatus)
|
||||||
{
|
{
|
||||||
qDebug() << "3342" << emStatus;
|
qDebug() << "slotQmlStatusChanged" << emStatus;
|
||||||
}
|
}
|
||||||
void eyeTrainWidget::slotHeartTimer()
|
|
||||||
{
|
|
||||||
//qDebug()<<"上位机发送心跳";
|
|
||||||
CCommunicateAPI::getInstance()->sendHeartBeat();
|
|
||||||
static int num = 0;
|
|
||||||
++num;
|
|
||||||
if(num > 3)
|
|
||||||
{
|
|
||||||
num = 0;
|
|
||||||
QPixmap pixmap;
|
|
||||||
if(heartCount < 1)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
if(heartCount >= 3)
|
|
||||||
{
|
|
||||||
heartCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void eyeTrainWidget::slotTrainTimer()
|
|
||||||
{
|
|
||||||
|
|
||||||
trainTimer->stop();
|
|
||||||
m_st_bicycleParam.controlState = 0;
|
|
||||||
CCommunicateAPI::getInstance()->sendBicycleParam(m_st_bicycleParam);
|
|
||||||
}
|
|
||||||
/*void eyeTrainWidget::on_startButton_clicked()
|
|
||||||
{
|
|
||||||
startTrain(0, 10);
|
|
||||||
}
|
|
||||||
void eyeTrainWidget::on_closeButton_clicked()
|
|
||||||
{
|
|
||||||
stopTrain();
|
|
||||||
}*/
|
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include "ccommunicateapi.h"
|
|
||||||
#include <QQuickWidget>
|
#include <QQuickWidget>
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
@ -19,26 +18,13 @@ class eyeTrainWidget : public QWidget
|
|||||||
public:
|
public:
|
||||||
explicit eyeTrainWidget(QWidget *parent = nullptr);
|
explicit eyeTrainWidget(QWidget *parent = nullptr);
|
||||||
~eyeTrainWidget();
|
~eyeTrainWidget();
|
||||||
ST_BicycleParam m_st_bicycleParam; //启动参数
|
|
||||||
void startTrain(int8_t Part, int Time);
|
|
||||||
void stopTrain();
|
|
||||||
void pauseTrain();
|
|
||||||
void continueTrain();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void slotQmlStatusChanged(QQuickWidget::Status emStatus);
|
void slotQmlStatusChanged(QQuickWidget::Status emStatus);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::eyeTrainWidget *ui;
|
Ui::eyeTrainWidget *ui;
|
||||||
QTimer *heartTimer;
|
|
||||||
QTimer *trainTimer;
|
|
||||||
|
|
||||||
int heartCount; //心跳次数,用于检测通信
|
|
||||||
private slots:
|
|
||||||
void slotHeartTimer();
|
|
||||||
void slotTrainTimer();
|
|
||||||
//void on_startButton_clicked();
|
|
||||||
//void on_closeButton_clicked();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // EYETRAINWIDGET_H
|
#endif // EYETRAINWIDGET_H
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user