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