diff --git a/GDevice.cpp b/GDevice.cpp index bb2e615..54448cf 100644 --- a/GDevice.cpp +++ b/GDevice.cpp @@ -11,15 +11,20 @@ #include #include "StopWatch.h" #include "device_common.h" +#include "GScan200.h" + #ifndef WIN32 #include #endif +#include #define DSP_CODE_ADDR 0 #define USER_ADDR 0x4000 using namespace std; +//class GScan200; + GDevice::GDevice(std::shared_ptr usb) { @@ -221,7 +226,6 @@ bool GDevice::read_flash(unsigned int addr, void* data, int size) const int int_buffer_size = 1024; int index_count = 0; -#include static void write_log(std::string fullname, std::string log) { std::string savepath; @@ -325,11 +329,18 @@ void GDevice::Int_main() } MotorStatus* ms = (MotorStatus*)int_buffer; if (ms->value && 0x7fe) { + if(m_eventcall_userdata){ + ((GScan200*)m_eventcall_userdata)->set_scan_status(false);//停止或异常停止时,通知图像处理线程扫描仪已停止 + } m_run = false; } if (event_call) { - //0x3fe ==>b 1111 1111 10 + //0x3fe ==>b 1111 1111 10 异常位高有效时 + if (ms->value & 0x3fe) { + ((GScan200*)m_eventcall_userdata)->set_scan_status(false); + event_call(ms->value, m_eventcall_userdata); + } } } } diff --git a/GDevice.h b/GDevice.h index b3a883b..723a004 100644 --- a/GDevice.h +++ b/GDevice.h @@ -78,7 +78,7 @@ private: void* m_imagecall_userdata; void* m_eventcall_userdata; - bool m_run; + volatile bool m_run; // 通过 IGDevice 继承