mirror of http://192.168.1.51:8099/lmh188/twain3.0
添加分纸模式设置功能 --23.05.05
This commit is contained in:
parent
64bacd48e2
commit
1cadb78e21
|
@ -87,4 +87,5 @@
|
|||
8.添加安卓设备锁定协议支持 --23.03.13
|
||||
9.适配卓育云ODM厂商 --23.04.24
|
||||
10.对接爱云校做协议适配 --23.04.24
|
||||
11.调整文件编码格式修复指示器乱码问题 --23.04.27
|
||||
11.调整文件编码格式修复指示器乱码问题 --23.04.27
|
||||
12.添加分纸模式设置功能 --23.05.05
|
|
@ -0,0 +1,83 @@
|
|||
// CFeedMode.cpp: 实现文件
|
||||
//
|
||||
#include "stdafx.h"
|
||||
#include "afxdialogex.h"
|
||||
#include "CFeedMode.h"
|
||||
#include "resource.h"
|
||||
|
||||
// CFeedMode 对话框
|
||||
|
||||
IMPLEMENT_DYNAMIC(CFeedMode, CDialogEx)
|
||||
|
||||
CFeedMode::CFeedMode(TwGlue glue, CWnd* pParent /*=nullptr*/)
|
||||
: CDialogEx(IDD_FEEDPAPERMODE, pParent), m_glue(glue)
|
||||
, feedmode(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CFeedMode::~CFeedMode()
|
||||
{
|
||||
}
|
||||
|
||||
void CFeedMode::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialogEx::DoDataExchange(pDX);
|
||||
DDX_Radio(pDX, IDC_RDFEEDMODEMID, feedmode);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CFeedMode, CDialogEx)
|
||||
ON_BN_CLICKED(IDC_BTNFEEDMODEGET, &CFeedMode::OnBnClickedBtnfeedmodeget)
|
||||
ON_BN_CLICKED(IDC_BTNFEEDMODESET, &CFeedMode::OnBnClickedBtnfeedmodeset)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CFeedMode 消息处理程序
|
||||
|
||||
|
||||
void CFeedMode::OnBnClickedBtnfeedmodeget()
|
||||
{
|
||||
int fm = 0;
|
||||
GetDlgItem(IDC_BTNFEEDMODEGET)->EnableWindow(false);
|
||||
if (m_glue.m_feedmode)
|
||||
fm = m_glue.m_feedmode(0, true);
|
||||
switch (fm)
|
||||
{
|
||||
case 0 :
|
||||
((CButton*)GetDlgItem(IDC_RDFEEDMODELOW))->SetCheck(true);
|
||||
((CButton*)GetDlgItem(IDC_RDFEEDMODEMID))->SetCheck(false);
|
||||
((CButton*)GetDlgItem(IDC_RDFEEDMODEHIGH))->SetCheck(false);
|
||||
break;
|
||||
case 1:
|
||||
((CButton*)GetDlgItem(IDC_RDFEEDMODELOW))->SetCheck(false);
|
||||
((CButton*)GetDlgItem(IDC_RDFEEDMODEMID))->SetCheck(true);
|
||||
((CButton*)GetDlgItem(IDC_RDFEEDMODEHIGH))->SetCheck(false);
|
||||
break;
|
||||
case 2:
|
||||
((CButton*)GetDlgItem(IDC_RDFEEDMODELOW))->SetCheck(false);
|
||||
((CButton*)GetDlgItem(IDC_RDFEEDMODEMID))->SetCheck(false);
|
||||
((CButton*)GetDlgItem(IDC_RDFEEDMODEHIGH))->SetCheck(true);
|
||||
break;
|
||||
default:
|
||||
((CButton*)GetDlgItem(IDC_RDFEEDMODELOW))->SetCheck(false);
|
||||
((CButton*)GetDlgItem(IDC_RDFEEDMODEMID))->SetCheck(true);
|
||||
((CButton*)GetDlgItem(IDC_RDFEEDMODEHIGH))->SetCheck(false);
|
||||
break;
|
||||
}
|
||||
Sleep(100);
|
||||
GetDlgItem(IDC_BTNFEEDMODEGET)->EnableWindow(true);
|
||||
// TODO: 在此添加控件通知处理程序代码
|
||||
}
|
||||
|
||||
|
||||
void CFeedMode::OnBnClickedBtnfeedmodeset()
|
||||
{
|
||||
UpdateData(TRUE);
|
||||
GetDlgItem(IDC_BTNFEEDMODESET)->EnableWindow(false);
|
||||
if (m_glue.m_feedmode)
|
||||
m_glue.m_feedmode(feedmode+1, false);
|
||||
Sleep(100);
|
||||
GetDlgItem(IDC_BTNFEEDMODESET)->EnableWindow(true);
|
||||
// TODO: 在此添加控件通知处理程序代码
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
#pragma once
|
||||
#include "afxdialogex.h"
|
||||
#include "twglue.hpp"
|
||||
|
||||
// CFeedMode 对话框
|
||||
|
||||
class CFeedMode : public CDialogEx
|
||||
{
|
||||
DECLARE_DYNAMIC(CFeedMode)
|
||||
|
||||
public:
|
||||
CFeedMode(TwGlue glue, CWnd* pParent = nullptr); // 标准构造函数
|
||||
virtual ~CFeedMode();
|
||||
|
||||
// 对话框数据
|
||||
#ifdef AFX_DESIGN_TIME
|
||||
enum { IDD = IDD_FEEDPAPERMODE };
|
||||
#endif
|
||||
|
||||
private:
|
||||
TwGlue m_glue;
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
int feedmode;
|
||||
afx_msg void OnBnClickedBtnfeedmodeget();
|
||||
afx_msg void OnBnClickedBtnfeedmodeset();
|
||||
};
|
|
@ -2,6 +2,7 @@
|
|||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "CFeedMode.h"
|
||||
#include "CFeedPaperPage.h"
|
||||
#include "afxdialogex.h"
|
||||
#include "resource.h"
|
||||
|
@ -41,13 +42,14 @@ static std::vector<CString> autopapertimeout
|
|||
|
||||
IMPLEMENT_DYNAMIC(CFeedPaperPage, CTabPageSSL)
|
||||
|
||||
CFeedPaperPage::CFeedPaperPage(/*std::function<void()> datachange,*/CWnd* pParent /*=nullptr*/)
|
||||
CFeedPaperPage::CFeedPaperPage(TwGlue glue,CWnd* pParent /*=nullptr*/)
|
||||
: CTabPageSSL(IDD_PAGEFEEDPAPER, pParent)
|
||||
, m_radioGroupScanMode(0)
|
||||
, m_cbDoublePaper(FALSE)
|
||||
, m_cbStaple(FALSE)
|
||||
, m_cbRotation(FALSE)
|
||||
, m_cbSkew(FALSE)
|
||||
, m_glue(glue)
|
||||
//, m_datachange(datachange)
|
||||
{
|
||||
|
||||
|
@ -114,6 +116,7 @@ BEGIN_MESSAGE_MAP(CFeedPaperPage, CTabPageSSL)
|
|||
ON_CBN_SELCHANGE(IDC_CMBORENTATION, &CFeedPaperPage::OnCbnSelchangeCmborentation)
|
||||
ON_BN_CLICKED(IDC_DogEarDetection, &CFeedPaperPage::OnBnClickedDogeardetection)
|
||||
ON_BN_CLICKED(IDC_CKAUTOPAPER, &CFeedPaperPage::OnBnClickedCkautopaper)
|
||||
ON_BN_CLICKED(IDC_BTNFEEDMODE, &CFeedPaperPage::OnBnClickedBtnfeedmode)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
BOOL CFeedPaperPage::PreTranslateMessage(MSG* pMsg)
|
||||
|
@ -235,3 +238,11 @@ void CFeedPaperPage::OnBnClickedCkautopaper()
|
|||
GetDlgItem(IDC_STATICAUTOPAPER)->EnableWindow(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CFeedPaperPage::OnBnClickedBtnfeedmode()
|
||||
{
|
||||
// TODO: 在此添加控件通知处理程序代码
|
||||
CFeedMode cf(m_glue,this);
|
||||
cf.DoModal();
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
#include "TabPageSSL.h"
|
||||
#include "Sliders.h"
|
||||
#include "twglue.hpp"
|
||||
#include "SmartEdit.h"
|
||||
#include <functional>
|
||||
// CFeedPaperPage 对话框
|
||||
|
@ -10,7 +11,7 @@ class CFeedPaperPage : public CTabPageSSL
|
|||
DECLARE_DYNAMIC(CFeedPaperPage)
|
||||
|
||||
public:
|
||||
CFeedPaperPage(/*std::function<void()> datachange,*/CWnd* pParent = nullptr); // 标准构造函数
|
||||
CFeedPaperPage(TwGlue glue,CWnd* pParent = nullptr); // 标准构造函数
|
||||
virtual ~CFeedPaperPage();
|
||||
|
||||
void FeedPaperPageUpdate(int val);
|
||||
|
@ -26,7 +27,7 @@ public:
|
|||
CLinkSlider m_slider_dogear;
|
||||
int m_radioGroupScanMode;
|
||||
CSmartEdit m_editNum;
|
||||
|
||||
TwGlue m_glue;
|
||||
afx_msg void OnBnClickedCkskewdetect();
|
||||
afx_msg void OnBnClickedScanMode();
|
||||
|
||||
|
@ -51,4 +52,5 @@ public:
|
|||
|
||||
afx_msg void OnBnClickedDogeardetection();
|
||||
afx_msg void OnBnClickedCkautopaper();
|
||||
afx_msg void OnBnClickedBtnfeedmode();
|
||||
};
|
||||
|
|
|
@ -21,7 +21,7 @@ CTwainUI::CTwainUI(TwGlue glue, GScanCap caps, std::string confirmtitle, std::st
|
|||
: CDialogEx(IDD_TWAINUI, pParent)
|
||||
, m_tabCtrl(new CTabCtrlSSL())
|
||||
, m_pageBrightness(new CBrightnessPage)
|
||||
, m_pageFeedPaper(new CFeedPaperPage)
|
||||
, m_pageFeedPaper(new CFeedPaperPage(glue))
|
||||
, m_pageImageProc(new CImageProcPage)
|
||||
, m_glue(glue)
|
||||
, settings(new GScanCap(caps))
|
||||
|
@ -97,6 +97,8 @@ BOOL CTwainUI::OnInitDialog()
|
|||
setvisable_fixedpaper(false);
|
||||
setvisable_dogear(true);
|
||||
setvisable_size(true);
|
||||
if ((m_hardwareVersion[5] == 'B' && atoi(m_hardwareVersion.substr(6, 4).c_str()) >= 505) || (m_hardwareVersion[5] > 'B'))
|
||||
m_pageFeedPaper->GetDlgItem(IDC_BTNFEEDMODE)->ShowWindow(SW_SHOW);
|
||||
if ((m_hardwareVersion[5] == 'B' && atoi(m_hardwareVersion.substr(6, 4).c_str()) >= 430) || (m_hardwareVersion[5] > 'B'))
|
||||
m_pageBasic->m_Edit_Dpi.SetParams(100, 600, 10);
|
||||
if ((m_hardwareVersion[5] == 'C' && atoi(m_hardwareVersion.substr(6, 4).c_str()) >= 103) || (m_hardwareVersion[5] > 'C'))
|
||||
|
|
|
@ -252,6 +252,11 @@ public:
|
|||
m_token = str;
|
||||
}
|
||||
|
||||
std::shared_ptr<IUsb> GetUsb()
|
||||
{
|
||||
return m_usb;
|
||||
}
|
||||
|
||||
virtual void open(int vid, int pid) = 0;
|
||||
virtual void regist_deviceevent_callback(deviceevent_callback callback, void* usrdata = 0) = 0;
|
||||
virtual void DogEar_callback(std::function<void(int)> fun)=0;
|
||||
|
@ -291,6 +296,7 @@ protected:
|
|||
atomic_uint32_t Error_Code;
|
||||
atomic_int devState;
|
||||
std::shared_ptr<ImageMatQueue> m_pImages;
|
||||
std::shared_ptr<IUsb> m_usb;
|
||||
std::mutex m_Locker;
|
||||
std::mutex m_imgLocker;
|
||||
std::string fwVersion;
|
||||
|
|
|
@ -61,7 +61,6 @@ private:
|
|||
int aquirenum = 0;
|
||||
int getimgnum = 0;
|
||||
GScanCap m_param;
|
||||
std::shared_ptr<IUsb> m_usb;
|
||||
volatile bool b_imgprothread;
|
||||
volatile bool b_usbthread;
|
||||
volatile int m_status;
|
||||
|
|
|
@ -107,7 +107,6 @@ private:
|
|||
volatile bool m_autopaper_timeout;
|
||||
std::future<void> m_autopaper_ft;
|
||||
GScanCap m_param;
|
||||
std::shared_ptr<IUsb> m_usb;
|
||||
volatile bool b_imgprothread;
|
||||
volatile bool b_usbthread;
|
||||
BlockingQueue<std::shared_ptr<std::vector<char>>> imgs;
|
||||
|
|
|
@ -49,7 +49,6 @@ private:
|
|||
private:
|
||||
bool m_bread_fixed_ratio_fromDSP;
|
||||
bool is_orginimgcount;
|
||||
std::shared_ptr<IUsb> m_usb;
|
||||
std::unique_ptr<thread> m_threadUsb;
|
||||
GScanCap gcap;
|
||||
volatile int image_num;
|
||||
|
|
|
@ -48,7 +48,6 @@ private:
|
|||
void Pop_Image();
|
||||
private:
|
||||
bool m_bread_fixed_ratio_fromDSP;
|
||||
std::shared_ptr<IUsb> m_usb;
|
||||
std::unique_ptr<thread> m_threadUsb;
|
||||
std::atomic_bool autopaper_stop;
|
||||
GScanCap gcap;
|
||||
|
|
|
@ -48,7 +48,6 @@ private:
|
|||
void Pop_Image();
|
||||
private:
|
||||
bool m_bread_fixed_ratio_fromDSP;
|
||||
std::shared_ptr<IUsb> m_usb;
|
||||
std::unique_ptr<thread> m_threadUsb;
|
||||
GScanCap gcap;
|
||||
volatile int image_num;
|
||||
|
|
|
@ -31,7 +31,6 @@ public:
|
|||
private:
|
||||
DWORD usbmain();
|
||||
void Pop_Image();
|
||||
std::shared_ptr<IUsb> m_usb;
|
||||
std::unique_ptr<thread> m_threadUsb;
|
||||
};
|
||||
|
||||
|
|
|
@ -2938,11 +2938,33 @@ Twpp::Result HuagaoDs::showTwainUI(Twpp::UserInterface& ui, bool bUiOnly)
|
|||
//}
|
||||
notifyCloseCancel();
|
||||
};
|
||||
auto feedmodeFunction = [this](int mode, bool isget)->int {
|
||||
#ifdef G200
|
||||
auto usb = scanner->GetUsb();
|
||||
if (isget)
|
||||
{
|
||||
if (usb.get() && usb->is_connected()) {
|
||||
int val = 0;
|
||||
usb->control_msg(0xc0, USB_REQ_GET_DEV_REGS, SR_GET_FEEDMODE, 0, 4, &val);
|
||||
return val;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return usb->control_msg(0x40, USB_REQ_SET_DEV_REGS, SR_SET_FEEDMODE, 0, 4, &mode);
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
return 0;
|
||||
#endif // G200
|
||||
|
||||
};
|
||||
|
||||
|
||||
CWnd* parent = guiBridge.get();
|
||||
|
||||
TwGlue glue = { scanFunction, cancelFunction };
|
||||
TwGlue glueUiOnly = { confirmFunction, cancelFunction };
|
||||
TwGlue glue = { scanFunction, cancelFunction,feedmodeFunction };
|
||||
TwGlue glueUiOnly = { confirmFunction, cancelFunction,feedmodeFunction };
|
||||
std::string serialnum = scanner->GetSerialNum();
|
||||
std::string hardwareversion = scanner->GetFWVersion();
|
||||
std::string macadder = scanner->GetMacAdder();
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -6,12 +6,12 @@
|
|||
|
||||
struct TwGlue {
|
||||
|
||||
TwGlue(const std::function<void(const GScanCap&)>& scan, const std::function<void()>& cancel) :
|
||||
m_scan(scan), m_cancel(cancel){}
|
||||
TwGlue(const std::function<void(const GScanCap&)>& scan, const std::function<void()>& cancel, std::function<int(int feedmode, bool isget)> feedmode) :
|
||||
m_scan(scan), m_cancel(cancel),m_feedmode(feedmode){}
|
||||
|
||||
std::function<void(const GScanCap&)> m_scan;
|
||||
std::function<void()> m_cancel;
|
||||
|
||||
std::function<int(int feedmode,bool isget)> m_feedmode;
|
||||
};
|
||||
|
||||
#endif // TWGLUE_HPP
|
||||
|
|
Loading…
Reference in New Issue