New Stop operation logic
This commit is contained in:
@@ -75,45 +75,44 @@ void DeviceManager::initDevice() {
|
|||||||
});
|
});
|
||||||
// stop
|
// stop
|
||||||
connect(EventCenter::Default(),&EventCenter::RequestStop,[=]() {
|
connect(EventCenter::Default(),&EventCenter::RequestStop,[=]() {
|
||||||
qDebug()<<"GetStatus";
|
qDebug() << "GetStatus";
|
||||||
StatusInfo inf = GetStatus();
|
StatusInfo inf = GetStatus();
|
||||||
qDebug()<<"Stop request status, status:%s"<<getStatusString(inf.status);
|
qDebug() << "Stop request status, status:%s" << getStatusString(inf.status);
|
||||||
|
|
||||||
// check device status=========================================
|
// check device status=========================================
|
||||||
//device is ready return
|
//device is ready return
|
||||||
if (inf.status == READY) return;
|
if (inf.status != SCANNING) {
|
||||||
if (inf.status == BUSY) {
|
TRIGGER_EVENT(GUIEvents::ResponseStop, nullptr, nullptr);
|
||||||
QString msg("Device is busy, Stop operation fail!");
|
|
||||||
THROW_ERROR(msg);
|
|
||||||
return;
|
return;
|
||||||
};
|
}
|
||||||
if (inf.status == SCANNING) {
|
// if (inf.status == BUSY) {
|
||||||
|
// QString msg("Device is busy, Stop operation fail!");
|
||||||
|
// THROW_ERROR(msg);
|
||||||
|
// return;
|
||||||
|
// };
|
||||||
TRIGGER_EVENT(GUIEvents::InvokeOperationStart, nullptr, nullptr);
|
TRIGGER_EVENT(GUIEvents::InvokeOperationStart, nullptr, nullptr);
|
||||||
//ScanControl fail
|
//ScanControl fail
|
||||||
qDebug()<<"Request stop!";
|
qDebug() << "Request stop!";
|
||||||
if (timerID!=-1)killTimer(timerID);
|
if (timerID != -1)killTimer(timerID);
|
||||||
if (ScanControl(STOP)) {
|
if (ScanControl(STOP)) {
|
||||||
qDebug()<<"Stop fail!";
|
qDebug() << "Stop fail!";
|
||||||
QString msg("Stop operation fail!");
|
QString msg("Stop operation fail!");
|
||||||
THROW_ERROR(msg);
|
THROW_ERROR(msg);
|
||||||
qDebug()<<"Error thrown!";
|
qDebug() << "Error thrown!";
|
||||||
lastStatus = -1;
|
lastStatus = -1;
|
||||||
previewing = false;
|
previewing = false;
|
||||||
QString s("%1 %2");
|
QString s("%1 %2");
|
||||||
s = s.arg(QDateTime::currentDateTime().toString("yyyy/MM/dd HH:mm:ss"), msg);
|
s = s.arg(QDateTime::currentDateTime().toString("yyyy/MM/dd HH:mm:ss"), msg);
|
||||||
TRIGGER_EVENT(GUIEvents::GlobalBannerMessage, nullptr,(QObject*)&msg);
|
TRIGGER_EVENT(GUIEvents::GlobalBannerMessage, nullptr, (QObject *) &msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
lastStatus = -1;
|
lastStatus = -1;
|
||||||
previewing = false;
|
previewing = false;
|
||||||
QString s("%1 %2");
|
QString s("%1 %2");
|
||||||
s = s.arg(QDateTime::currentDateTime().toString("yyyy/MM/dd HH:mm:ss"),("Scan Stopped!"));
|
s = s.arg(QDateTime::currentDateTime().toString("yyyy/MM/dd HH:mm:ss"), ("Scan Stopped!"));
|
||||||
TRIGGER_EVENT(GUIEvents::GlobalBannerMessage, nullptr,(QObject*)&s);
|
TRIGGER_EVENT(GUIEvents::GlobalBannerMessage, nullptr, (QObject *) &s);
|
||||||
TRIGGER_EVENT(GUIEvents::InvokeOperationEnd, nullptr, nullptr);
|
TRIGGER_EVENT(GUIEvents::InvokeOperationEnd, nullptr, nullptr);
|
||||||
TRIGGER_EVENT(GUIEvents::ResponseStop, nullptr, nullptr);
|
TRIGGER_EVENT(GUIEvents::ResponseStop, nullptr, nullptr);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// preview
|
// preview
|
||||||
|
|||||||
Reference in New Issue
Block a user