New progress logic and error process logic
This commit is contained in:
@@ -184,25 +184,27 @@ void DeviceManager::timerEvent(QTimerEvent *event) {
|
|||||||
//scanning progress timer
|
//scanning progress timer
|
||||||
if (event->timerId() !=deviceInfTimerID)
|
if (event->timerId() !=deviceInfTimerID)
|
||||||
{
|
{
|
||||||
//error exit
|
//error exit, callback error
|
||||||
if (errorOccurred)
|
if (errorOccurred)
|
||||||
{
|
{
|
||||||
qDebug() << "Error occurred, exit progress timer";
|
// qDebug() << "Error occurred, exit progress timer";
|
||||||
|
// QString msg("Error occurred, exit current operation!");
|
||||||
|
// THROW_ERROR(msg);
|
||||||
goto exitTimer;
|
goto exitTimer;
|
||||||
}
|
}
|
||||||
// previewing exit
|
// previewing exit
|
||||||
if (previewing)
|
if (previewing)
|
||||||
{
|
{
|
||||||
//错误timer
|
QString msg("Device is previewing, exit current operation!");
|
||||||
|
THROW_ERROR(msg);
|
||||||
goto exitTimer;
|
goto exitTimer;
|
||||||
}
|
} else {
|
||||||
// check device status=========================================
|
// check device status=========================================
|
||||||
qDebug() << "GetStatus";
|
qDebug() << "GetStatus";
|
||||||
StatusInfo inf = GetStatus();
|
StatusInfo inf = GetStatus();
|
||||||
qDebug() << "Scanning request status, status:" << getStatusString(inf.status);
|
qDebug() << "Scanning request status, status:" << getStatusString(inf.status);
|
||||||
//设备正常扫描中
|
//设备正常扫描中
|
||||||
if (inf.status==SCANNING)
|
if (inf.status == SCANNING) {
|
||||||
{
|
|
||||||
lastStatus = SCANNING;
|
lastStatus = SCANNING;
|
||||||
//normal scan
|
//normal scan
|
||||||
QVariant var(inf.progress);
|
QVariant var(inf.progress);
|
||||||
@@ -211,8 +213,7 @@ void DeviceManager::timerEvent(QTimerEvent *event) {
|
|||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
//未发生错误并且,之前状态是扫描,代表正常扫描完成
|
//未发生错误并且,之前状态是扫描,代表正常扫描完成
|
||||||
if (lastStatus == SCANNING)
|
if (lastStatus == SCANNING) {
|
||||||
{
|
|
||||||
qDebug() << "Scan finished";
|
qDebug() << "Scan finished";
|
||||||
QVariant var(true);
|
QVariant var(true);
|
||||||
qDebug() << "InvokeOperationEnd";
|
qDebug() << "InvokeOperationEnd";
|
||||||
@@ -229,6 +230,7 @@ void DeviceManager::timerEvent(QTimerEvent *event) {
|
|||||||
THROW_ERROR(msg);
|
THROW_ERROR(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
exitTimer:
|
exitTimer:
|
||||||
qDebug() << "Scanning progress Timer exit";
|
qDebug() << "Scanning progress Timer exit";
|
||||||
killTimer(timerID);
|
killTimer(timerID);
|
||||||
@@ -243,6 +245,8 @@ void DeviceManager::timerEvent(QTimerEvent *event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DeviceManager::processScan(const char *json, bool empty) {
|
void DeviceManager::processScan(const char *json, bool empty) {
|
||||||
|
//clear last error state first
|
||||||
|
errorOccurred = false;
|
||||||
// check device status=========================================
|
// check device status=========================================
|
||||||
qDebug() << "GetStatus";
|
qDebug() << "GetStatus";
|
||||||
StatusInfo inf = GetStatus();
|
StatusInfo inf = GetStatus();
|
||||||
@@ -269,7 +273,9 @@ void DeviceManager::processScan(const char *json, bool empty) {
|
|||||||
qDebug() << "ScanControl start>>>>>>>>>>>>>>>>>>>>>";
|
qDebug() << "ScanControl start>>>>>>>>>>>>>>>>>>>>>";
|
||||||
if (!ScanControl(SCAN)) {
|
if (!ScanControl(SCAN)) {
|
||||||
qDebug() << ">>>>>>>>>>>>>>>>>>>>>ScanControl success";
|
qDebug() << ">>>>>>>>>>>>>>>>>>>>>ScanControl success";
|
||||||
|
//set current state
|
||||||
lastStatus = SCANNING;
|
lastStatus = SCANNING;
|
||||||
|
previewing = false;
|
||||||
qDebug() << "Start progress timer";
|
qDebug() << "Start progress timer";
|
||||||
timerID = startTimer(300);
|
timerID = startTimer(300);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user