parent
b5b6f773dc
commit
0f21325c8d
46
GDevice.cpp
46
GDevice.cpp
|
@ -83,17 +83,22 @@ void GDevice::close()
|
|||
if (m_threadInt && m_threadInt->joinable()) {
|
||||
m_bListen = false;
|
||||
this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
XdPrint("closing m_threadInt\n");
|
||||
m_threadInt->join();
|
||||
m_threadInt = NULL;
|
||||
XdPrint("close m_threadInt\n");
|
||||
}
|
||||
|
||||
if (m_threadrecv && m_threadrecv->joinable()) {
|
||||
m_bScan = false;
|
||||
image_indexs.ShutDown();
|
||||
XdPrint("closing m_threadrecv\n");
|
||||
m_threadrecv->join();
|
||||
m_threadrecv = NULL;
|
||||
XdPrint("close m_threadrecv\n");
|
||||
}
|
||||
m_usb->close();
|
||||
XdPrint("close m_usb\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,7 +134,6 @@ void GDevice::set_event_call(event_callback callfunc, void* userdata)
|
|||
|
||||
void GDevice::stop()
|
||||
{
|
||||
|
||||
set_option(Cam_Options::scanner_stop_motor, 0);
|
||||
}
|
||||
|
||||
|
@ -328,21 +332,45 @@ void GDevice::Int_main()
|
|||
image_indexs.Put(int_buffer[1]);
|
||||
}
|
||||
MotorStatus* ms = (MotorStatus*)int_buffer;
|
||||
if (ms->value && 0x7fe) {
|
||||
if(m_eventcall_userdata){
|
||||
((GScan200*)m_eventcall_userdata)->set_scan_status(false);//停止或异常停止时,通知图像处理线程扫描仪已停止
|
||||
}
|
||||
m_run = false;
|
||||
}
|
||||
|
||||
//int ret = get_option(Cam_Options::scanner_scan_status);
|
||||
//XdPrint("scanner_scan_status %d \n",ret);
|
||||
//if (!ret)//电机板工作中
|
||||
//{
|
||||
// XdPrint("scanner stoped 1\n");
|
||||
// ((GScan200*)m_eventcall_userdata)->set_scan_status(false);//停止或异常停止时,通知图像处理线程扫描仪已停止
|
||||
// m_run = false;
|
||||
// XdPrint("scanner stoped 2\n");
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// XdPrint("scanner is scanning \n");
|
||||
//}
|
||||
//if (ms->value && 0x7fe) {
|
||||
// if(m_eventcall_userdata){
|
||||
//
|
||||
// }
|
||||
|
||||
//}
|
||||
if (event_call)
|
||||
{
|
||||
//0x3fe ==>b 1111 1111 10 Ò쳣λ¸ßÓÐЧʱ
|
||||
if (ms->value & 0x3fe) {
|
||||
((GScan200*)m_eventcall_userdata)->set_scan_status(false);
|
||||
event_call(ms->value, m_eventcall_userdata);
|
||||
m_run = false;
|
||||
XdPrint("scanner have error stoped \n");
|
||||
}
|
||||
}
|
||||
}
|
||||
int ret = get_option(Cam_Options::scanner_scan_status);
|
||||
if (m_run&&!ret)//电机板工作中
|
||||
{
|
||||
XdPrint("scanner stoped 1\n");
|
||||
((GScan200*)m_eventcall_userdata)->set_scan_status(false);//停止或异常停止时,通知图像处理线程扫描仪已停止
|
||||
m_run = false;
|
||||
XdPrint("scanner stoped 2\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -480,6 +508,10 @@ int GDevice::get_option(Cam_Options option)
|
|||
value = read_reg(MOTOR_BOARD, 0x02);
|
||||
value = ((Motor_Mode*)& value)->feeding_paper_ready;
|
||||
break;
|
||||
case scanner_scan_status:
|
||||
value = read_reg(MOTOR_BOARD, 0x02);
|
||||
value = ((Motor_Mode*)& value)->scan_status;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
14
GScan200.cpp
14
GScan200.cpp
|
@ -4,6 +4,7 @@
|
|||
#include "IGDevice.h"
|
||||
#include "opencv2/opencv.hpp"
|
||||
#include "twain.h"
|
||||
#include "config_new.h"
|
||||
#include "device_common.h"
|
||||
#include "GDevice.h";
|
||||
|
||||
|
@ -15,6 +16,7 @@ GScan200::~GScan200()
|
|||
{
|
||||
if (!error_msg.IsShutDown())
|
||||
error_msg.ShutDown();
|
||||
XdPrint("closed GScan200\n");
|
||||
}
|
||||
|
||||
void GScan200::open(int vid, int pid)
|
||||
|
@ -89,6 +91,9 @@ BOOL GScan200::Get_Scanner_PaperOn()
|
|||
|
||||
void GScan200::config_params(SFreeImage& params)
|
||||
{
|
||||
config_new cfn(params);
|
||||
unsigned int cfg_value=cfn.GetData();
|
||||
m_dev->set_option(Cam_Options::scanner_config, cfg_value);
|
||||
m_pImages.setparam(params);
|
||||
}
|
||||
|
||||
|
@ -116,9 +121,12 @@ bool GScan200::Get_IsImageQueueEmpty()
|
|||
|
||||
void GScan200::reset()
|
||||
{
|
||||
m_dev->stop();
|
||||
this_thread::sleep_for(chrono::milliseconds(200));
|
||||
m_pImages.clear();
|
||||
if (m_dev)
|
||||
{
|
||||
m_dev->stop();
|
||||
this_thread::sleep_for(chrono::milliseconds(200));
|
||||
m_pImages.clear();
|
||||
}
|
||||
}
|
||||
|
||||
void GScan200::setdecodepixtype(int twpixtype)
|
||||
|
|
Loading…
Reference in New Issue