GUI standby v1.0

This commit is contained in:
Krad
2021-10-20 15:55:15 +08:00
parent 7867ca7bcc
commit ac8d913b55
12 changed files with 105 additions and 33 deletions

View File

@@ -33,7 +33,7 @@ void DeviceManager::initDevice() {
connect(EventCenter::Default(),&EventCenter::RequestEmptyScan,[=](QObject* sender, QObject* detail){
std::string json= getJsonFromPatInf(detail);
printf("%s\r\n",json.c_str());
processScan(json.c_str());
processScan(json.c_str(), true);
});
// Patient scan
connect(EventCenter::Default(),&EventCenter::RequestPatientScan,[=](QObject* sender, QObject* detail){
@@ -48,7 +48,7 @@ void DeviceManager::initDevice() {
connect(EventCenter::Default(),&EventCenter::RequestStop,[=]() {
TRIGGER_EVENT(GUIEvents::InvokeOperationStart, nullptr, nullptr);
StatusInfo inf = GetStatus();
if (inf.status == SCANING) {
if (inf.status == SCANNING) {
//ScanControl fail
if (ScanControl(STOP)) {
QString msg("Stop operation fail!");
@@ -72,7 +72,7 @@ void DeviceManager::initDevice() {
//ScanControl
if(!ScanControl(PREVIEW_SCAN))
{
lastStatus = SCANING;
lastStatus = SCANNING;
previewing = true;
timerID = startTimer(500);
TRIGGER_EVENT(GUIEvents::ResponsePreview, nullptr, nullptr);
@@ -89,9 +89,9 @@ void DeviceManager::timerEvent(QTimerEvent *event) {
if (event->timerId() !=deviceInfTimerID)
{
StatusInfo inf = GetStatus();
if (inf.status==SCANING)
if (inf.status==SCANNING)
{
lastStatus = SCANING;
lastStatus = SCANNING;
//normal scan
if(!previewing)
{
@@ -107,7 +107,7 @@ void DeviceManager::timerEvent(QTimerEvent *event) {
}
} else{
if (lastStatus == SCANING && !errorOccured)
if (lastStatus == SCANNING && !errorOccured)
{
QVariant var(true);
TRIGGER_EVENT(GUIEvents::InvokeOperationEnd, nullptr, (QObject*)&var);
@@ -115,7 +115,7 @@ void DeviceManager::timerEvent(QTimerEvent *event) {
previewing = false;
}
//内部错误导致Scan停止
else if (lastStatus == SCANING && errorOccured)
else if (lastStatus == SCANNING && errorOccured)
{
//正常情况下设备应该已经调用的错误callback然后会回归Ready状态清理lastStatus即可
lastStatus = -1;
@@ -124,15 +124,15 @@ void DeviceManager::timerEvent(QTimerEvent *event) {
killTimer(timerID);
}
} else{
QString temp = QString(GetDeviceInf(MEAN_TEMPERATURE));
QString temp = QString(GetDeviceInfo(MEAN_TEMPERATURE));
TRIGGER_EVENT(GUIEvents::ResponseDeviceTemperature, nullptr, (QObject*)&temp);
}
}
void DeviceManager::processScan(const char *json) {
void DeviceManager::processScan(const char *json, bool empty) {
static QString msg = "Start scan...";
TRIGGER_EVENT(GUIEvents::InvokeOperationStart, nullptr, (QObject*)&msg);
int ret = SetScanInf(json);
int ret = SetScanInfo(json,empty?1:0);
if (ret){
QString errmsg("Transfer patient information fail!");
THROW_ERROR(errmsg);
@@ -143,7 +143,7 @@ void DeviceManager::processScan(const char *json) {
{
//ScanControl fail
if(!ScanControl(SCAN)) {
lastStatus = SCANING;
lastStatus = SCANNING;
timerID = startTimer(300);
return;
}