Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
884071e586 | ||
|
|
74064d1fdf | ||
|
|
2a891ac1de | ||
|
|
b9b10b144c | ||
|
|
a64178876b | ||
|
|
5bd9d589e9 | ||
|
|
9fb047a5db | ||
|
|
244b43d146 | ||
|
|
c25f31bc5c |
@@ -27,20 +27,26 @@ volatile int running = 1;
|
||||
volatile int progress = 0;
|
||||
volatile int status = READY;
|
||||
volatile int stop_flag = 0;
|
||||
volatile int empty = 0;
|
||||
char output_path[256] = {0};
|
||||
|
||||
void ThreadFunc(void* args){
|
||||
while (running){
|
||||
WaitForSingleObject(e1, INFINITE);
|
||||
status = SCANNING;
|
||||
stop_flag = 0;
|
||||
progress = 0;
|
||||
for (int i = 0; i <= 50; ++i) {
|
||||
if (stop_flag > 0){
|
||||
stop_flag = 0;
|
||||
break;
|
||||
}
|
||||
progress = 0;
|
||||
WaitForSingleObject(e1, INFINITE);
|
||||
|
||||
status = SCANNING;
|
||||
Sleep(300);
|
||||
if (empty)
|
||||
{
|
||||
GetPreviewData();
|
||||
}
|
||||
for (int i = 0; i <= 50; ++i) {
|
||||
if (stop_flag > 0 || status != SCANNING){
|
||||
stop_flag = 0;
|
||||
break;
|
||||
}
|
||||
if (i == 20){
|
||||
progress = 139;
|
||||
WaitForSingleObject(e2, INFINITE);
|
||||
@@ -53,6 +59,10 @@ void ThreadFunc(void* args){
|
||||
}
|
||||
else{
|
||||
progress = i *2;
|
||||
}
|
||||
if (stop_flag > 0 || status != SCANNING){
|
||||
stop_flag = 0;
|
||||
break;
|
||||
}
|
||||
Sleep(300);
|
||||
}
|
||||
@@ -107,7 +117,8 @@ StatusInfo GetStatus() {
|
||||
}
|
||||
|
||||
//result, 0 success, other false
|
||||
int SetScanInfo(const char* jsonString, int empty) {
|
||||
int SetScanInfo(const char* jsonString, int e) {
|
||||
empty = e;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -120,7 +131,15 @@ const size_t Col = 140;
|
||||
|
||||
const char* FRAME_FILE_PATH_1 = "./img1_v2.bin";
|
||||
const char* FRAME_FILE_PATH_2 = "./pre_image.bin";
|
||||
|
||||
int previewCount = 0;
|
||||
const char* GetPreviewData() {
|
||||
previewCount++;
|
||||
if (previewCount>3){
|
||||
status = READY;
|
||||
innerCallback("22222");
|
||||
return NULL;
|
||||
}
|
||||
FILE* file;
|
||||
preivew_change_flag++;
|
||||
preivew_change_flag = preivew_change_flag % 2;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QDate>
|
||||
DateSlidePickerBox::DateSlidePickerBox(QWidget *parent) {
|
||||
DateSlidePickerBox::DateSlidePickerBox(QWidget *parent):QWidget(parent) {
|
||||
layout = new QHBoxLayout(this);
|
||||
myear = new SlidePickerBox(this);
|
||||
QStringList centry;
|
||||
|
||||
@@ -43,7 +43,7 @@ void ErrorCallback(const char* msg)
|
||||
}
|
||||
|
||||
void DeviceManager::emitErrorCallback(const char *msg) {
|
||||
this->setErrorOccurred(true);
|
||||
errorOccurred=true;
|
||||
printf("Error Callback , message:%s\r\n", msg);
|
||||
QString m(msg);
|
||||
emit raiseGlobalError( m);
|
||||
@@ -53,7 +53,7 @@ void DeviceManager::emitErrorCallback(const char *msg) {
|
||||
void DeviceManager::initDevice() {
|
||||
InitLib(ErrorCallback);
|
||||
|
||||
deviceInfTimerID = startTimer(1000);
|
||||
deviceInfTimerID = startTimer(10000);
|
||||
|
||||
// empty scan
|
||||
connect(EventCenter::Default(), &EventCenter::RequestEmptyScan, [=](QObject* sender, QObject* detail) {
|
||||
@@ -132,7 +132,7 @@ void DeviceManager::initDevice() {
|
||||
if (!ScanControl(PREVIEW_SCAN))
|
||||
{
|
||||
qDebug() << "Preview success!";
|
||||
lastStatus = SCANNING;
|
||||
// lastStatus = SCANNING;
|
||||
previewing = true;
|
||||
// timerID = startTimer(500);
|
||||
TRIGGER_EVENT(GUIEvents::ResponsePreview, nullptr, nullptr);
|
||||
@@ -164,7 +164,9 @@ void DeviceManager::initDevice() {
|
||||
if (inf.status == SCANNING) {
|
||||
qDebug() << "Preview data reader read start!";
|
||||
const char* data = GetPreviewData();
|
||||
if (!data)continue;
|
||||
if (!data){
|
||||
continue;
|
||||
}
|
||||
qDebug() << "Preview data reader read end!";
|
||||
QByteArray bytes = QByteArray::fromRawData(data, 140 * 140);
|
||||
//double check
|
||||
@@ -177,6 +179,12 @@ void DeviceManager::initDevice() {
|
||||
TRIGGER_EVENT(GUIEvents::ResponsePreviewData, nullptr, (QObject*)(&bytes));
|
||||
qDebug() << "Preview data response event end!";
|
||||
}
|
||||
else{
|
||||
// lastStatus = READY;
|
||||
previewing = false;
|
||||
AppGlobalValues::setInProcessing(false);
|
||||
QThread::sleep(3);
|
||||
}
|
||||
QThread::msleep(100);
|
||||
}
|
||||
});
|
||||
@@ -199,6 +207,7 @@ void DeviceManager::timerEvent(QTimerEvent* event) {
|
||||
//scanning progress timer
|
||||
//error exit, callback error
|
||||
if (errorOccurred) {
|
||||
timerID = event->timerId();
|
||||
exitScanTimer();
|
||||
return;
|
||||
}
|
||||
@@ -217,14 +226,14 @@ void DeviceManager::timerEvent(QTimerEvent* event) {
|
||||
return;
|
||||
} else {
|
||||
//未发生错误并且,之前状态是扫描,代表正常扫描完成
|
||||
if (lastStatus == SCANNING) {
|
||||
if (lastStatus == SCANNING && ! errorOccurred) {
|
||||
prepareFinishScan();
|
||||
}
|
||||
//一般不会出现其他情况
|
||||
else {
|
||||
QString msg("Unknown error in scanning progress timer");
|
||||
THROW_ERROR(msg);
|
||||
}
|
||||
// else {
|
||||
// QString msg("Unknown error in scanning progress timer");
|
||||
// THROW_ERROR(msg);
|
||||
// }
|
||||
}
|
||||
}
|
||||
exitScanTimer();
|
||||
@@ -272,7 +281,7 @@ void DeviceManager::scanProcess(int sProgress) {
|
||||
|
||||
void DeviceManager::exitScanTimer() {
|
||||
qDebug() << "Scanning progress Timer exit";
|
||||
killTimer(timerID);
|
||||
if (timerID>0)killTimer(timerID);
|
||||
timerID = -1;
|
||||
lastStatus = -1;
|
||||
previewing = false;
|
||||
|
||||
@@ -92,12 +92,12 @@ private:
|
||||
void scanProcess(int progress);
|
||||
|
||||
int scanPhase = 1;
|
||||
int timerID = -1;
|
||||
volatile int timerID = -1;
|
||||
int deviceInfTimerID = -1;
|
||||
int lastStatus = -1;
|
||||
bool previewing = false;
|
||||
volatile bool endLoop = false;
|
||||
bool errorOccurred = false;
|
||||
volatile bool errorOccurred = false;
|
||||
QThread* previewDataCaller = nullptr;
|
||||
};
|
||||
|
||||
|
||||
@@ -258,9 +258,11 @@ ScanFormWidget::ScanFormWidget(QWidget* parent) : TabFormWidget(parent) {
|
||||
lbl_e2->setText(tr("some settings\n\nparameters\n"));
|
||||
});
|
||||
|
||||
connect(EventCenter::Default(), &EventCenter::DeviceErrorRaise, [=](QObject* parent, QObject* msg){
|
||||
setPreviewing(false);
|
||||
});
|
||||
|
||||
|
||||
previewfunc = [=](bool val)->void {
|
||||
previewfunc = [=](bool val)->void {
|
||||
viewer->setVisible(val);
|
||||
btnPreview->setCheckable(val);
|
||||
btnPreview->setChecked(val);
|
||||
|
||||
@@ -167,13 +167,14 @@ void AboutWidget::initUi()
|
||||
|
||||
void AboutWidget::openHelpFile()
|
||||
{
|
||||
QString userManulFile = QCoreApplication::applicationDirPath() + "/userManual.pdf";
|
||||
|
||||
QFileInfo file(userManulFile);
|
||||
if (file.exists())
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(userManulFile));
|
||||
}
|
||||
qApp->exit();
|
||||
// QString userManulFile = QCoreApplication::applicationDirPath() + "/userManual.pdf";
|
||||
//
|
||||
// QFileInfo file(userManulFile);
|
||||
// if (file.exists())
|
||||
// {
|
||||
// QDesktopServices::openUrl(QUrl::fromLocalFile(userManulFile));
|
||||
// }
|
||||
//else
|
||||
//{
|
||||
// EQ9MessageBox box;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <QTranslator>
|
||||
#include <QDebug>
|
||||
#include <QApplication>
|
||||
#include <iostream>
|
||||
#include "json/cJSON.h"
|
||||
const char* strProductFileName = "./cfgs/usct-product.json";
|
||||
const char* strProductFileNameDefault = "./cfgs/usct-product";
|
||||
@@ -338,11 +339,19 @@ bool JsonObject::savecfg()
|
||||
}
|
||||
|
||||
char* strJsonData = cJSON_Print((cJSON*)json_root);
|
||||
std::stringstream ss;
|
||||
ss << strJsonData;
|
||||
outFile << ss.rdbuf();
|
||||
outFile.close();
|
||||
m_bLoaded = false;
|
||||
if (strlen(strJsonData)>1){
|
||||
std::stringstream ss;
|
||||
ss << strJsonData;
|
||||
outFile << ss.rdbuf();
|
||||
outFile.flush();
|
||||
outFile.close();
|
||||
m_bLoaded = false;
|
||||
}
|
||||
else{
|
||||
std::cout<<"===========================================app want write empty content to cfg json============================================="<<std::endl;
|
||||
|
||||
}
|
||||
delete strJsonData;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -128,8 +128,8 @@ void LoginWindow::doLogin()
|
||||
QString strUserCode = m_pUserCodeEdit->text();
|
||||
QString strPassWord = m_pPassWordEdit->text();
|
||||
|
||||
QString encryptedPassword = strPassWord;
|
||||
strPassWord = "123456";
|
||||
// QString encryptedPassword = strPassWord;
|
||||
// strPassWord = "123456";
|
||||
|
||||
QString encryptPwd = User::getEncryptedPassword(strPassWord);
|
||||
QString sql = QString("select UserCode from Account where UserCode='%1' and Password='%2'")
|
||||
|
||||
Reference in New Issue
Block a user