diff --git a/HaoGaoCOrrect修改记录.txt b/HaoGaoCOrrect修改记录.txt index 280e538..86a8915 100644 --- a/HaoGaoCOrrect修改记录.txt +++ b/HaoGaoCOrrect修改记录.txt @@ -13,3 +13,8 @@ 2. 增加明场暗场校正最大明场值配置; 3. 界面UI按钮顺序调整对齐等操作; V4.2版本 + +2021年10月18日16 +1. 针对3288 g300g400 增加校正信息实时显示; +2.增加usb vid pid 配置; +3.增加速度模式配置功能; diff --git a/HuaGoCorrect/A3.cpp b/HuaGoCorrect/A3.cpp index 6df90bd..08eb882 100644 --- a/HuaGoCorrect/A3.cpp +++ b/HuaGoCorrect/A3.cpp @@ -143,6 +143,8 @@ void CA3::OnGetOrSetSp(bool get, int type) } + + void CA3::OnGetOrSetSleepTime(bool get, int type) { int sp; @@ -289,18 +291,28 @@ void CA3::updatespeedmode(bool get) if (parent != NULL) { if (parent->m_drv.get() && parent->m_drv->IsConnected()) { - int speedmode; + int speedmode=0; if (get) { parent->m_drv->GetSpeedMode(speedmode, true); bool bfound = false; for (size_t i = 0; i < speedmodeMap.size(); i++) { - if (speedmodeMap[i].Speedmode == speedmode) + if (parent->m_drv->PID == 0x0139 || parent->m_drv->PID == 0x0239) { - m_cmbSpeedmode.SetCurSel(i); - OnGetOrSetSp(true, 0);//»Ҷsp - OnGetOrSetSp(true, 1);//²ɫsp + if (speedmodeMap[i].Speedmode == speedmode) + { + m_cmbSpeedmode.SetCurSel(i); + OnGetOrSetSp(true, 0);//»Ҷsp + OnGetOrSetSp(true, 1);//²ɫsp + bfound = true; + break; + } + } + else if (parent->m_drv->PID == 0x0300 || parent->m_drv->PID == 0x0400) + { + int startindex = parent->m_drv->PID == 0x0300 ? 6 : 10; + m_cmbSpeedmode.SetCurSel(startindex+ speedmode); bfound = true; break; } @@ -314,9 +326,16 @@ void CA3::updatespeedmode(bool get) if (cmbindex != -1) { auto t_speedmode = speedmodeMap[cmbindex]; - parent->m_drv->GetSpeedMode(t_speedmode.Speedmode, false); - parent->m_drv->SetSptime(0, t_speedmode.GraySp); - parent->m_drv->SetSptime(1, t_speedmode.ColorSp); + if (parent->m_drv->PID == 0x0139 || parent->m_drv->PID == 0x0239) + { + parent->m_drv->GetSpeedMode(t_speedmode.Speedmode, false); + parent->m_drv->SetSptime(0, t_speedmode.GraySp); + parent->m_drv->SetSptime(1, t_speedmode.ColorSp); + } + else if (parent->m_drv->PID == 0x0300 || parent->m_drv->PID == 0x0400) + { + parent->m_drv->GetSpeedMode(t_speedmode.Speedmode, false); + } } } } diff --git a/HuaGoCorrect/A3.h b/HuaGoCorrect/A3.h index b9fe86d..7c65ca4 100644 --- a/HuaGoCorrect/A3.h +++ b/HuaGoCorrect/A3.h @@ -51,6 +51,7 @@ private: unsigned int ColorSp; unsigned int GraySp; }; + std::map speedmodeMap = { {0,{70,0x42d,0xc88}}, {1,{80,0x37f,0xa7f}}, @@ -58,17 +59,35 @@ private: {3,{100,0x27c,0x775}}, {4,{110,0x27c,0x775}}, {5,{120,0x27c,0x775}}, - {6,{130,0x27c,0x775}} + {6,{130,0x27c,0x775}}, + {7,{1,0,0}}, + {8,{2,0,0}}, + {9,{3,0,0}}, + {10,{4,0,0}}, + {11,{1,0,0}}, + {12,{2,0,0}}, + {13,{3,0,0}}, + {14,{4,0,0}}, + {15,{5,0,0}} }; std::map speedmodeMapString = { - {0,L"G100_70PPM"}, - {1,L"G100_80PPM"}, - {2,L"G100_90PPM"}, - {3,L"G200_100PPM"}, - {4,L"G200_110PPM"}, - {5,L"G200_120PPM"}, - {6,L"G200_130PPM"} + {0,L"G139_70PPM"}, + {1,L"G139_80PPM"}, + {2,L"G139_90PPM"}, + {3,L"G239_100PPM"}, + {4,L"G239_110PPM"}, + {5,L"G239_120PPM"}, + {6,L"G239_130PPM"}, + {7,L"G300_40PPM"}, + {8,L"G300_50PPM"}, + {9,L"G300_60PPM"}, + {10,L"G300_700PPM"}, + {11,L"G400_40PPM"}, + {12,L"G400_50PPM"}, + {13,L"G400_60PPM"}, + {14,L"G400_70PPM"}, + {15,L"G400_80PPM"}, }; CComboBox m_cmbSpeedmode; }; diff --git a/HuaGoCorrect/A4.cpp b/HuaGoCorrect/A4.cpp index d36d583..e84008d 100644 --- a/HuaGoCorrect/A4.cpp +++ b/HuaGoCorrect/A4.cpp @@ -191,6 +191,15 @@ void CA4::OnBnClickedBtnReboot() /// void CA4::OnBnClickedBtnSetvidpid() { + auto ret= MessageBox(L"ǰȷУԼٶģʽ豸صɣVID PID󲿷ֹܲãȷ", L"ʾ", MB_YESNO | MB_ICONWARNING); + if (ret == IDOK || ret == IDYES) + { + auto parent = (CHuaGoCorrectDlg*)GetParent(); + if (parent->m_drv.get() && parent->m_drv->IsConnected()) { + auto vidpid = AqrVIDPID(); + parent->m_drv->GetOrSetVIDPID(vidpid, false); + } + } } /// @@ -198,7 +207,14 @@ void CA4::OnBnClickedBtnSetvidpid() /// void CA4::OnBnClickedBtnGetvidpid() { - // TODO: ڴӿؼ֪ͨ + auto parent = (CHuaGoCorrectDlg*)GetParent(); + if (parent->m_drv.get() && parent->m_drv->IsConnected()) { + int vidpid = 0; + parent->m_drv->GetOrSetVIDPID(vidpid, true); + VIDPID tvpd; + tvpd.Value = vidpid; + UpdateVidPid(tvpd); + } } /// @@ -428,3 +444,36 @@ void CA4::OnEnChangetbxfrexposure2() // TODO: ڴӿؼ֪ͨ } + + +int CA4::AqrVIDPID() +{ + VIDPID t_vidpid = { 0 }; + CString str_vid, str_pid; + GetDlgItemText(IDC_tbxVID, str_vid); + str_vid.Replace(L"0x",L""); + USES_CONVERSION; + std::string str(W2A(str_vid)); + t_vidpid.VID = strtol(str.c_str(),NULL,16);// atoi(str.c_str()); + GetDlgItemText(IDC_tbxPID, str_pid); + str_pid.Replace(L"0x", L""); + std::string cstr_pid(W2A(str_pid)); + t_vidpid.PID = strtol(cstr_pid.c_str(), NULL, 16);// atoi(cstr_pid.c_str()); + return t_vidpid.Value; +} + +void CA4::UpdateVidPid(VIDPID vidpid) +{ + if (vidpid.PID != 0 && vidpid.VID != 0) + { + CString str_vid, str_pid; + str_vid.Format(L"0x%x", vidpid.VID); + str_pid.Format(L"0x%x", vidpid.PID); + GetDlgItem(IDC_tbxVID)->SetWindowText(str_vid); + GetDlgItem(IDC_tbxPID)->SetWindowText(str_pid); + } + else + { + MessageBox(L"VID PID", L"ʾ", MB_OK); + } +} diff --git a/HuaGoCorrect/A4.h b/HuaGoCorrect/A4.h index 64b5d02..88828dc 100644 --- a/HuaGoCorrect/A4.h +++ b/HuaGoCorrect/A4.h @@ -8,6 +8,7 @@ #include "JsonConfig.h" #include + // CA4 Ի #define INI_FILE_NAME "./HuaGoScan.ini" class CA4 : public CDialog @@ -22,7 +23,15 @@ public: // Ի enum { IDD = IDD_A4_DIALOG }; - + union VIDPID + { + struct + { + unsigned short VID; + unsigned short PID; + }; + unsigned int Value; + }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧ @@ -75,4 +84,6 @@ public: afx_msg void OnBnClickedBtnbdown(); void UpdateGains(int id, bool get); afx_msg void OnEnChangetbxfrexposure2(); + int AqrVIDPID(); + void UpdateVidPid(VIDPID vidpid); }; diff --git a/HuaGoCorrect/HuaGoCorrect.aps b/HuaGoCorrect/HuaGoCorrect.aps new file mode 100644 index 0000000..4dc9984 Binary files /dev/null and b/HuaGoCorrect/HuaGoCorrect.aps differ diff --git a/HuaGoCorrect/HuaGoCorrect.rc b/HuaGoCorrect/HuaGoCorrect.rc index 272c3ec..7666cbc 100644 Binary files a/HuaGoCorrect/HuaGoCorrect.rc and b/HuaGoCorrect/HuaGoCorrect.rc differ diff --git a/HuaGoCorrect/HuaGoCorrect.vcxproj b/HuaGoCorrect/HuaGoCorrect.vcxproj index 755d544..4cd1b0b 100644 --- a/HuaGoCorrect/HuaGoCorrect.vcxproj +++ b/HuaGoCorrect/HuaGoCorrect.vcxproj @@ -240,6 +240,7 @@ opencv_imgproc2410.lib;%(AdditionalDependencies) + @@ -263,6 +264,7 @@ opencv_imgproc2410.lib;%(AdditionalDependencies) Create Create + diff --git a/HuaGoCorrect/HuaGoCorrect.vcxproj.filters b/HuaGoCorrect/HuaGoCorrect.vcxproj.filters index 8589330..dd309b4 100644 --- a/HuaGoCorrect/HuaGoCorrect.vcxproj.filters +++ b/HuaGoCorrect/HuaGoCorrect.vcxproj.filters @@ -120,6 +120,9 @@ 头文件 + + 头文件 + @@ -170,6 +173,9 @@ 源文件\USB通信 + + 源文件 + diff --git a/HuaGoCorrect/HuaGoCorrectDlg.cpp b/HuaGoCorrect/HuaGoCorrectDlg.cpp index 473355a..9935f31 100644 --- a/HuaGoCorrect/HuaGoCorrectDlg.cpp +++ b/HuaGoCorrect/HuaGoCorrectDlg.cpp @@ -340,13 +340,27 @@ void CHuaGoCorrectDlg::RefreshTabChange() void CHuaGoCorrectDlg::Scan() { HGScanConfig config = { 0 }; - config.g200params.dpi = 1;//only support 200DPI - config.g200params.paper = 0; - config.g200params.pc_correct = ((CButton*)GetDlgItem(IDC_CKBORGINIMG))->GetCheck(); - config.g200params.color = m_iColorIndex == 1 ? 1 : 0; - config.g200params.double_feed_enbale = TRUE; - config.g200params.screw_detect_enable = FALSE; - config.g200params.iscorrect_mode = 1;//Уģʽ + if (m_drv->PID == 0x0139 || m_drv->PID == 0x0239) + { + config.g200params.dpi = 1;//only support 200DPI + config.g200params.paper = 0; + config.g200params.pc_correct = ((CButton*)GetDlgItem(IDC_CKBORGINIMG))->GetCheck(); + config.g200params.color = m_iColorIndex == 1 ? 1 : 0; + config.g200params.double_feed_enbale = TRUE; + config.g200params.screw_detect_enable = FALSE; + config.g200params.iscorrect_mode = 1;//Уģʽ + } + else + { + config.g400params.dpi = 1;//only support 200DPI + config.g400params.pageSize = 0; + config.g400params.isCorrect = !((CButton*)GetDlgItem(IDC_CKBORGINIMG))->GetCheck(); + config.g400params.isColor = m_iColorIndex == 1 ? 1 : 0; + config.g400params.doubleFeeded = TRUE; + config.g400params.enableStable = FALSE; + config.g400params.reversed1 = 0;//Уģʽ + } + m_drv->Config_Scanner(config); this_thread::sleep_for(std::chrono::milliseconds(1000)); @@ -409,6 +423,7 @@ void CHuaGoCorrectDlg::OnBnClickedBtnFlat() std::string c_str = StringToUtf(info); CString pWideChar = A2T(c_str.c_str()); CString oldinfo; + UpdateData(FALSE); ((CEdit*)(m_A3dlg.GetDlgItem(IDC_LSTFLATINFO)))->GetWindowText(oldinfo); oldinfo += pWideChar; ((CEdit*)(m_A3dlg.GetDlgItem(IDC_LSTFLATINFO)))->SetWindowText(oldinfo); diff --git a/HuaGoCorrect/IScanner.h b/HuaGoCorrect/IScanner.h index a7f750f..6de7d2b 100644 --- a/HuaGoCorrect/IScanner.h +++ b/HuaGoCorrect/IScanner.h @@ -51,6 +51,7 @@ public: virtual bool Updata(std::string filename, std::function func) = 0; virtual void SetFlatCallback(std::function func) = 0; virtual void GetSpeedMode(int& speedmode,bool get) = 0 ; + virtual void GetOrSetVIDPID(int& value, bool get) = 0; void SetPath(std::string csFilePath) { csPath = csFilePath; @@ -65,4 +66,6 @@ public: ImageMatQueue m_pImages; HWND h; std::string csPath; + unsigned short VID; + unsigned short PID; }; \ No newline at end of file diff --git a/HuaGoCorrect/ImageMatQueue.cpp b/HuaGoCorrect/ImageMatQueue.cpp index 1b103c7..e74ebb1 100644 --- a/HuaGoCorrect/ImageMatQueue.cpp +++ b/HuaGoCorrect/ImageMatQueue.cpp @@ -111,10 +111,13 @@ void ImageMatQueue::proc() { if (pixType != -1) { - std::string csName; SYSTEMTIME st = { 0 }; GetLocalTime(&st); //ȡǰʱ ɾȷms - //csName.Format("%02d%02d%02d-%d.bmp", st.wHour, st.wMinute, st.wSecond,++imgindex); + time_t timp; + tm* p; + time(&timp); + p = localtime(&timp); + std::string csName = std::to_string(p->tm_hour) + "_" + std::to_string(p->tm_min) + "_" + std::to_string(p->tm_sec)+".png"; cv::Mat matPicImage; cv::Mat matFront, matBack; @@ -126,8 +129,8 @@ void ImageMatQueue::proc() { if (m_pImages.Size() >= 2) { - matFront = m_pImages.Take().getMat(pixType); - matBack = m_pImages.Take().getMat(pixType); + matFront = m_pImages.Take().getMat(pixType==1 ? 1 : 6);//bgr or gray + matBack = m_pImages.Take().getMat(pixType == 1 ? 1 : 6); //mats.push_back(matFront); //mats.push_back(matBack); } @@ -138,13 +141,9 @@ void ImageMatQueue::proc() case 4://G500 ͼһͼϣҪͼ { std::string csImage; - csImage = csPath + "\\G300" + csName; - //cv::Mat mat = m_pImages.Take().getMat(pixType); - //matPicImage = mat(cv::Rect(0, 0, mat.cols, mat.rows)); - ////mats.push_back(matPicImage); - //IplImage qqImg; - //qqImg = IplImage(matPicImage); // cv::Mat -> IplImage - //cvSaveImage(csImage, &qqImg); + csImage = csPath+"//" + csName; + cv::Mat mat = m_pImages.Take().getMat(pixType == 1 ? 1 : 6); + cv::imwrite(csImage, mat); m_images.Put(csImage); } break; diff --git a/HuaGoCorrect/JpegBuffer.cpp b/HuaGoCorrect/JpegBuffer.cpp index 7253917..fe0a126 100644 --- a/HuaGoCorrect/JpegBuffer.cpp +++ b/HuaGoCorrect/JpegBuffer.cpp @@ -48,7 +48,7 @@ cv::Mat JpegBuffer::getMat( int pixType) StopWatch sw; //XdPrint("buffer size is :%d ==========================\n",getSize()); cv::Mat image = jl.decode(m_buffer, pixType);//oixtype - + cv::imwrite("img.jpg", image); XdPrint(L"Decode Image time epleased :%lf ==========================\n",sw.elapsed_ms()); //XdPrint("==image col is :%d, image row is :%d, image size is :%d===\n",image.cols, image.rows, image.size); diff --git a/HuaGoCorrect/commondef.h b/HuaGoCorrect/commondef.h index 9861740..762edbf 100644 --- a/HuaGoCorrect/commondef.h +++ b/HuaGoCorrect/commondef.h @@ -228,6 +228,8 @@ enum tagUsbSupported V4L2_AQULRE_ERROR = 79, //ɨڲͼƬʧ V4L2_IMAGE_EMPTY = 80, + //ԶУ + AUTO_FLATTING = 198, //USB δ USB_DISCONNECTED = 200, //ûֹͣ diff --git a/HuaGoCorrect/gscan3399.cpp b/HuaGoCorrect/gscan3399.cpp index ee14292..256457a 100644 --- a/HuaGoCorrect/gscan3399.cpp +++ b/HuaGoCorrect/gscan3399.cpp @@ -60,6 +60,8 @@ void gscan3399::open(int vid, int pid, int index) if (!usbs.empty()) { m_usb = *usbs.begin(); + VID = vid; + PID = pid; m_usb->open(); if (m_usb->is_connected()) { @@ -484,6 +486,11 @@ void gscan3399::GetSpeedMode(int& speedmode, bool get) } } +void gscan3399::GetOrSetVIDPID(int& value, bool get) +{ + +} + void gscan3399::usbcallback(bool isleft, void* usrdata) { gscan3399* This = (gscan3399*)usrdata; diff --git a/HuaGoCorrect/gscan3399.h b/HuaGoCorrect/gscan3399.h index 4222473..e922617 100644 --- a/HuaGoCorrect/gscan3399.h +++ b/HuaGoCorrect/gscan3399.h @@ -69,7 +69,7 @@ public: virtual void SetFlatCallback(std::function func); virtual void GetSpeedMode(int& speedmode,bool getorset); - + virtual void GetOrSetVIDPID(int& value, bool get) override; private: static void usbcallback(bool isleft, void* usrdata); diff --git a/HuaGoCorrect/gscn_drv.cpp b/HuaGoCorrect/gscn_drv.cpp index 31bb80d..be1a4c1 100644 --- a/HuaGoCorrect/gscn_drv.cpp +++ b/HuaGoCorrect/gscn_drv.cpp @@ -80,6 +80,8 @@ void GScn_Drv::open(int vid, int pid,int index) { m_usb = *devs.begin(); m_usb->open();//ͬʱڶͬɨ豸ʱĬѡȡһvid pidƥ豸 + VID = vid; + PID = pid; selectDeviceIndex=index; m_scannerType=G300; h= ::FindWindow(NULL, L"HGScannerTool"); @@ -238,6 +240,30 @@ void GScn_Drv::SetFlatCallback(std::function func) void GScn_Drv::GetSpeedMode(int& speedmode, bool get) { + if (m_usb.get() && m_usb->is_connected()) + { + USBCB speed = { get ? GET_SPEED_MODE:SET_SPEED_MODE,speedmode,0 }; + m_usb->write_bulk(&speed, sizeof(speed)); + if (get) + { + m_usb->read_bulk(&speed, sizeof(speed)); + speedmode = speed.u32_Data; + } + } +} + +void GScn_Drv::GetOrSetVIDPID(int& value, bool get) +{ + if (m_usb.get() && m_usb->is_connected()) + { + USBCB u_cmd = { get ? GET_USB_INFOR_VIDPID : SET_USB_INFOR_VIDPID,value,0 }; + m_usb->write_bulk(&u_cmd, sizeof(u_cmd)); + if (get) + { + m_usb->read_bulk(&u_cmd, sizeof(u_cmd)); + value = u_cmd.u32_Data; + } + } } void GScn_Drv::reset() @@ -383,7 +409,7 @@ DWORD GScn_Drv::usbmain() DWORD transferCount = 0; iNum++; cv::Mat imgData = Get_Img_Data(totalNum); - switch(m_scannerType) + switch(m_scannerType) { case G100: case G200: @@ -412,7 +438,12 @@ DWORD GScn_Drv::usbmain() case G300: case G400: case G500: + { pushMat(JpegBuffer(imgData, m_config.g200params.color == 1 ? TJPF_BGR : TJPF_GRAY,0,0)); + //auto img = fopen("inmg.jpg", "wb+"); + //fwrite(imgData.data, 1, totalNum, img); + //fclose(img); + } break; default: break; @@ -431,7 +462,26 @@ DWORD GScn_Drv::usbmain() { m_isScanning = false; devState = DEV_STOP; - MessageBox(NULL,TEXT("ԶУɣ"), TEXT("ʾ"), MB_OK); + if (usbcb.u32_Count != 0) + { + std::string msg; + msg.resize(usbcb.u32_Count); + m_usb->read_bulk(&msg[0], usbcb.u32_Count); + if (m_flatcallback) + m_flatcallback(msg); + } + //MessageBox(NULL,TEXT("ԶУɣ"), TEXT("ʾ"), MB_OK); + } + case AUTO_FLATTING: + { + if (usbcb.u32_Count != 0) + { + std::string msg; + msg.resize(usbcb.u32_Count); + m_usb->read_bulk(&msg[0], usbcb.u32_Count); + if (m_flatcallback) + m_flatcallback(msg); + } } break; case COUNT_MODE: diff --git a/HuaGoCorrect/gscn_drv.h b/HuaGoCorrect/gscn_drv.h index 2ff5058..97c2e47 100644 --- a/HuaGoCorrect/gscn_drv.h +++ b/HuaGoCorrect/gscn_drv.h @@ -20,64 +20,64 @@ public: GScn_Drv(); virtual ~GScn_Drv(); - virtual void open(int vid, int pid, int index); - virtual int aquire_image(std::string& image, int num); - virtual bool IsConnected(); - virtual std::string GetFWVersion(); - virtual void SetFWVersion(); - virtual std::string GetSerialNum(); - virtual void SetSerialNum(std::string serial); - virtual std::string GetKernelVersion(); - virtual void SetRatio(int tyepe, int ration); - virtual void GetRatio(int type, int& ratio); - virtual void Reboot(); + virtual void open(int vid, int pid, int index)override; + virtual int aquire_image(std::string& image, int num)override; + virtual bool IsConnected()override; + virtual std::string GetFWVersion()override; + virtual void SetFWVersion()override; + virtual std::string GetSerialNum()override; + virtual void SetSerialNum(std::string serial)override; + virtual std::string GetKernelVersion()override; + virtual void SetRatio(int tyepe, int ration)override; + virtual void GetRatio(int type, int& ratio)override; + virtual void Reboot()override; virtual void PowerOff() {}; - virtual bool is_scan(); - virtual bool Get_Scanner_PaperOn(); + virtual bool is_scan()override; + virtual bool Get_Scanner_PaperOn()override; virtual void Config_Scanner(PUSBCB pUSBCB); - virtual void Config_Scanner(HGScanConfig config); - virtual void Scanner_StartScan(UINT16 count); - virtual void Stop_scan(); - virtual void ResetScanner(); - virtual bool Get_IsImageQueueEmpty(); - virtual void reset(); - virtual void run(); - virtual void ActiveteUSB(); - virtual bool Updata(std::string filename, std::function func); + virtual void Config_Scanner(HGScanConfig config)override; + virtual void Scanner_StartScan(UINT16 count)override; + virtual void Stop_scan()override; + virtual void ResetScanner()override; + virtual bool Get_IsImageQueueEmpty()override; + virtual void reset()override; + virtual void run()override; + virtual void ActiveteUSB()override; + virtual bool Updata(std::string filename, std::function func)override; - virtual int GetScanNum(); + virtual int GetScanNum()override; - virtual void ClrRollerNum(); + virtual void ClrRollerNum()override; - virtual void ClrScanNum(); + virtual void ClrScanNum()override; - virtual void SendFlatData(CorrectParam param, int index); + virtual void SendFlatData(CorrectParam param, int index)override; - virtual CaptureParams GetFlatData(); + virtual CaptureParams GetFlatData()override; - virtual void StartFlat(bool iscolor); + virtual void StartFlat(bool iscolor)override; - virtual void DevStateChange(); + virtual void DevStateChange()override; - virtual int getMatSum(); + virtual int getMatSum()override; - virtual void close(); + virtual void close()override; - virtual void GetExpose(int& Aside, int& Bside); - virtual void SetExpose(int aside, int bside); + virtual void GetExpose(int& Aside, int& Bside)override; + virtual void SetExpose(int aside, int bside)override; - virtual void GetSptime(int type, int& time); - virtual void SetSptime(int type, int time); + virtual void GetSptime(int type, int& time)override; + virtual void SetSptime(int type, int time)override; - virtual void GetSleepTime(int& sleeptime); - virtual void SetSleepTime(int sleeptime); + virtual void GetSleepTime(int& sleeptime)override; + virtual void SetSleepTime(int sleeptime)override; - virtual void GetFlatMaxBright(bool iscolor, unsigned int& val); - virtual void SetFlatMaxBright(bool iscolor, unsigned int val); - - virtual void SetFlatCallback(std::function func); - virtual void GetSpeedMode(int& speedmode, bool get); + virtual void GetFlatMaxBright(bool iscolor, unsigned int& val)override; + virtual void SetFlatMaxBright(bool iscolor, unsigned int val)override; + virtual void SetFlatCallback(std::function func)override; + virtual void GetSpeedMode(int& speedmode, bool get)override; + virtual void GetOrSetVIDPID(int& value, bool get) override; private: volatile int devState; volatile bool m_bRun; diff --git a/HuaGoCorrect/img.jpg b/HuaGoCorrect/img.jpg new file mode 100644 index 0000000..e435a0d Binary files /dev/null and b/HuaGoCorrect/img.jpg differ diff --git a/HuaGoCorrect/inmg.jpg b/HuaGoCorrect/inmg.jpg new file mode 100644 index 0000000..0a31a11 Binary files /dev/null and b/HuaGoCorrect/inmg.jpg differ diff --git a/HuaGoCorrect/scn_usb.cpp b/HuaGoCorrect/scn_usb.cpp index 367b5cf..4ca74a4 100644 --- a/HuaGoCorrect/scn_usb.cpp +++ b/HuaGoCorrect/scn_usb.cpp @@ -236,7 +236,7 @@ int UsbScanEx::control_msg(int rtype, int req, int value, int index, int len, vo irp.fTransferDirectionIn = (rtype >> 7); irp.bRequest = req; irp.bmRequestType = (rtype >> 5) & 0x03; - + LPOVERLAPPED lp_overlap = ov + CTRL_IN_OUT; b_ret = DeviceIoControl(m_h_dev, IOCTL_SEND_USB_REQUEST, &irp, sizeof(irp), data, len, &dw_ret, lp_overlap); diff --git a/HuaGoCorrect/vendorconfig.cpp b/HuaGoCorrect/vendorconfig.cpp new file mode 100644 index 0000000..473ab74 --- /dev/null +++ b/HuaGoCorrect/vendorconfig.cpp @@ -0,0 +1,35 @@ +#include "stdafx.h" +#include "vendorconfig.h" + +#ifdef WIN32 +#include +#endif // WIN32 + +const char* vendorfile = "./vendorjson.json"; + +VendorConfig::VendorConfig() +{ + if (access(vendorfile, 0) != 0)// not exist + { + + } +} + +VendorConfig::~VendorConfig() +{ +} + +std::vector VendorConfig::GetVendorList() +{ + return m_suprtvendor; +} + +void VendorConfig::AddVendor(ScanerVendor& vendor) +{ + +} + +void VendorConfig::createdefaultvendor() +{ + +} \ No newline at end of file diff --git a/HuaGoCorrect/vendorconfig.h b/HuaGoCorrect/vendorconfig.h new file mode 100644 index 0000000..6a0cef0 --- /dev/null +++ b/HuaGoCorrect/vendorconfig.h @@ -0,0 +1,27 @@ +#pragma once +#include "json.h" +#include +#include + +typedef struct ScanerVendor +{ + std::string Vendor; + unsigned short VID; + unsigned short PID; +}; + + +class VendorConfig +{ +public: + VendorConfig(); + ~VendorConfig(); + std::vector GetVendorList(); + void AddVendor(ScanerVendor& vendor); +private: + void createdefaultvendor(); + //void read +private: + std::vector m_suprtvendor; +}; +