diff --git a/PhaseCompAcq/PhaseDevice.cpp b/PhaseCompAcq/PhaseDevice.cpp index a13ba95..493f1f4 100644 --- a/PhaseCompAcq/PhaseDevice.cpp +++ b/PhaseCompAcq/PhaseDevice.cpp @@ -51,13 +51,14 @@ void PhaseDevice::startWork() { - QString startCommand = PhaseProtocolBM::startMessure(); - this->serialUtil.sendData(startCommand.toLocal8Bit()); + QString startCmd = PhaseProtocolBM::startMessure(); + this->serialUtil.sendData(startCmd.toLocal8Bit()); } void PhaseDevice::stopWork() { - + QString stopCmd = PhaseProtocolBM::stopMessure(); + this->serialUtil.sendData(stopCmd.toLocal8Bit()); } void PhaseDevice::dataReceivedHandler(QByteArray data) diff --git a/PhaseCompAcq/PhaseDevice.cpp b/PhaseCompAcq/PhaseDevice.cpp index a13ba95..493f1f4 100644 --- a/PhaseCompAcq/PhaseDevice.cpp +++ b/PhaseCompAcq/PhaseDevice.cpp @@ -51,13 +51,14 @@ void PhaseDevice::startWork() { - QString startCommand = PhaseProtocolBM::startMessure(); - this->serialUtil.sendData(startCommand.toLocal8Bit()); + QString startCmd = PhaseProtocolBM::startMessure(); + this->serialUtil.sendData(startCmd.toLocal8Bit()); } void PhaseDevice::stopWork() { - + QString stopCmd = PhaseProtocolBM::stopMessure(); + this->serialUtil.sendData(stopCmd.toLocal8Bit()); } void PhaseDevice::dataReceivedHandler(QByteArray data) diff --git a/PhaseCompAcq/PhaseWindow.cpp b/PhaseCompAcq/PhaseWindow.cpp index d2dd196..98422c1 100644 --- a/PhaseCompAcq/PhaseWindow.cpp +++ b/PhaseCompAcq/PhaseWindow.cpp @@ -29,6 +29,8 @@ move(0, 0); ui->exitButt->move(screenRect.width() - 80, 10); ui->minButt->move(screenRect.width() - 140, 10); + ui->endButt->move(screenRect.width() - 200, 10); + ui->startButt->move(screenRect.width() - 260, 10); ui->line->setGeometry(0, 59, screenRect.width(), 1); // 设置主体区域的大小和位置 @@ -212,3 +214,33 @@ { QApplication::exit(0); } + +void PhaseWindow::on_startButt_clicked() +{ + int devSelected = ui->devSelect->currentIndex(); + PhaseDevice * device = deviceList.at(devSelected); + device->startWork(); +} + +void PhaseWindow::on_endButt_clicked() +{ + int devSelected = ui->devSelect->currentIndex(); + PhaseDevice * device = deviceList.at(devSelected); + device->stopWork(); +} + +void PhaseWindow::on_devSelect_currentIndexChanged(int index) +{ + // 清空显示的数据 + for (int i = 0; i < 16; i++) + { + // 获取对应的通道BOX + QGroupBox * channelBox = (QGroupBox *)ui->scrollContents->children().at(i + 1); + + // 赋值,对应的lineEdit/label + ((QLineEdit *)channelBox->children().at(2))->setText(""); + ((QLineEdit *)channelBox->children().at(4))->setText(""); + ((QLineEdit *)channelBox->children().at(6))->setText(""); + ((QLabel *)channelBox->children().at(7))->setText("-"); + } +} diff --git a/PhaseCompAcq/PhaseDevice.cpp b/PhaseCompAcq/PhaseDevice.cpp index a13ba95..493f1f4 100644 --- a/PhaseCompAcq/PhaseDevice.cpp +++ b/PhaseCompAcq/PhaseDevice.cpp @@ -51,13 +51,14 @@ void PhaseDevice::startWork() { - QString startCommand = PhaseProtocolBM::startMessure(); - this->serialUtil.sendData(startCommand.toLocal8Bit()); + QString startCmd = PhaseProtocolBM::startMessure(); + this->serialUtil.sendData(startCmd.toLocal8Bit()); } void PhaseDevice::stopWork() { - + QString stopCmd = PhaseProtocolBM::stopMessure(); + this->serialUtil.sendData(stopCmd.toLocal8Bit()); } void PhaseDevice::dataReceivedHandler(QByteArray data) diff --git a/PhaseCompAcq/PhaseWindow.cpp b/PhaseCompAcq/PhaseWindow.cpp index d2dd196..98422c1 100644 --- a/PhaseCompAcq/PhaseWindow.cpp +++ b/PhaseCompAcq/PhaseWindow.cpp @@ -29,6 +29,8 @@ move(0, 0); ui->exitButt->move(screenRect.width() - 80, 10); ui->minButt->move(screenRect.width() - 140, 10); + ui->endButt->move(screenRect.width() - 200, 10); + ui->startButt->move(screenRect.width() - 260, 10); ui->line->setGeometry(0, 59, screenRect.width(), 1); // 设置主体区域的大小和位置 @@ -212,3 +214,33 @@ { QApplication::exit(0); } + +void PhaseWindow::on_startButt_clicked() +{ + int devSelected = ui->devSelect->currentIndex(); + PhaseDevice * device = deviceList.at(devSelected); + device->startWork(); +} + +void PhaseWindow::on_endButt_clicked() +{ + int devSelected = ui->devSelect->currentIndex(); + PhaseDevice * device = deviceList.at(devSelected); + device->stopWork(); +} + +void PhaseWindow::on_devSelect_currentIndexChanged(int index) +{ + // 清空显示的数据 + for (int i = 0; i < 16; i++) + { + // 获取对应的通道BOX + QGroupBox * channelBox = (QGroupBox *)ui->scrollContents->children().at(i + 1); + + // 赋值,对应的lineEdit/label + ((QLineEdit *)channelBox->children().at(2))->setText(""); + ((QLineEdit *)channelBox->children().at(4))->setText(""); + ((QLineEdit *)channelBox->children().at(6))->setText(""); + ((QLabel *)channelBox->children().at(7))->setText("-"); + } +} diff --git a/PhaseCompAcq/PhaseWindow.h b/PhaseCompAcq/PhaseWindow.h index 02a7908..52a8d88 100644 --- a/PhaseCompAcq/PhaseWindow.h +++ b/PhaseCompAcq/PhaseWindow.h @@ -30,6 +30,12 @@ void on_exitButt_clicked(); + void on_startButt_clicked(); + + void on_endButt_clicked(); + + void on_devSelect_currentIndexChanged(int index); + private: int initHttpToken(); int initDictDeviceTypes(); diff --git a/PhaseCompAcq/PhaseDevice.cpp b/PhaseCompAcq/PhaseDevice.cpp index a13ba95..493f1f4 100644 --- a/PhaseCompAcq/PhaseDevice.cpp +++ b/PhaseCompAcq/PhaseDevice.cpp @@ -51,13 +51,14 @@ void PhaseDevice::startWork() { - QString startCommand = PhaseProtocolBM::startMessure(); - this->serialUtil.sendData(startCommand.toLocal8Bit()); + QString startCmd = PhaseProtocolBM::startMessure(); + this->serialUtil.sendData(startCmd.toLocal8Bit()); } void PhaseDevice::stopWork() { - + QString stopCmd = PhaseProtocolBM::stopMessure(); + this->serialUtil.sendData(stopCmd.toLocal8Bit()); } void PhaseDevice::dataReceivedHandler(QByteArray data) diff --git a/PhaseCompAcq/PhaseWindow.cpp b/PhaseCompAcq/PhaseWindow.cpp index d2dd196..98422c1 100644 --- a/PhaseCompAcq/PhaseWindow.cpp +++ b/PhaseCompAcq/PhaseWindow.cpp @@ -29,6 +29,8 @@ move(0, 0); ui->exitButt->move(screenRect.width() - 80, 10); ui->minButt->move(screenRect.width() - 140, 10); + ui->endButt->move(screenRect.width() - 200, 10); + ui->startButt->move(screenRect.width() - 260, 10); ui->line->setGeometry(0, 59, screenRect.width(), 1); // 设置主体区域的大小和位置 @@ -212,3 +214,33 @@ { QApplication::exit(0); } + +void PhaseWindow::on_startButt_clicked() +{ + int devSelected = ui->devSelect->currentIndex(); + PhaseDevice * device = deviceList.at(devSelected); + device->startWork(); +} + +void PhaseWindow::on_endButt_clicked() +{ + int devSelected = ui->devSelect->currentIndex(); + PhaseDevice * device = deviceList.at(devSelected); + device->stopWork(); +} + +void PhaseWindow::on_devSelect_currentIndexChanged(int index) +{ + // 清空显示的数据 + for (int i = 0; i < 16; i++) + { + // 获取对应的通道BOX + QGroupBox * channelBox = (QGroupBox *)ui->scrollContents->children().at(i + 1); + + // 赋值,对应的lineEdit/label + ((QLineEdit *)channelBox->children().at(2))->setText(""); + ((QLineEdit *)channelBox->children().at(4))->setText(""); + ((QLineEdit *)channelBox->children().at(6))->setText(""); + ((QLabel *)channelBox->children().at(7))->setText("-"); + } +} diff --git a/PhaseCompAcq/PhaseWindow.h b/PhaseCompAcq/PhaseWindow.h index 02a7908..52a8d88 100644 --- a/PhaseCompAcq/PhaseWindow.h +++ b/PhaseCompAcq/PhaseWindow.h @@ -30,6 +30,12 @@ void on_exitButt_clicked(); + void on_startButt_clicked(); + + void on_endButt_clicked(); + + void on_devSelect_currentIndexChanged(int index); + private: int initHttpToken(); int initDictDeviceTypes(); diff --git a/PhaseCompAcq/PhaseWindow.ui b/PhaseCompAcq/PhaseWindow.ui index 01a7759..85c26c2 100644 --- a/PhaseCompAcq/PhaseWindow.ui +++ b/PhaseCompAcq/PhaseWindow.ui @@ -150,6 +150,38 @@ 最小化 + + + + 780 + 10 + 40 + 40 + + + + + + + 结束 + + + + + + 730 + 10 + 40 + 40 + + + + + + + 开始 + +