3288 400 敦南cis功能适配
This commit is contained in:
parent
21b4849332
commit
a285d89660
|
@ -46,6 +46,7 @@ BEGIN_MESSAGE_MAP(CA3, CDialog)
|
|||
ON_BN_CLICKED(IDC_BTNSETSPEED, &CA3::OnBnClickedBtnsetspeed)
|
||||
ON_BN_CLICKED(IDC_BTNGETSPEED, &CA3::OnBnClickedBtngetspeed)
|
||||
ON_BN_CLICKED(IDC_BTNGETIP, &CA3::OnBnClickedBtngetip)
|
||||
ON_BN_CLICKED(IDC_BTNGETSYSINFO, &CA3::OnBnClickedBtnGetSysInfo)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
|
@ -363,3 +364,13 @@ void CA3::OnBnClickedBtngetip()
|
|||
SetDlgItemText(IDC_LBIPADDR, vs);
|
||||
}
|
||||
}
|
||||
|
||||
void CA3::OnBnClickedBtnGetSysInfo()
|
||||
{
|
||||
auto parent = (CHuaGoCorrectDlg*)GetParent();
|
||||
if (parent->m_drv.get() && parent->m_drv->IsConnected()) {
|
||||
std::string version = parent->m_drv->GetSysInfo();
|
||||
CString vs(version.c_str());
|
||||
MessageBox(vs, TEXT("ϵͳÐÅÏ¢"),MB_OK);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
afx_msg void OnBnClickedBtnsetuvsp();
|
||||
afx_msg void OnBnClickedBtngetcolorsp();
|
||||
afx_msg void OnBnClickedBtnsetcolorsp();
|
||||
|
||||
afx_msg void OnBnClickedBtnGetSysInfo();
|
||||
private:
|
||||
void OnGetOrSetSp(bool get, int type);
|
||||
public:
|
||||
|
|
|
@ -265,7 +265,8 @@ void CA4::OnBnClickedBtnGethor()
|
|||
auto parent = (CHuaGoCorrectDlg*)GetParent();
|
||||
int ratio = 0;
|
||||
if (parent->m_drv.get() && parent->m_drv->IsConnected()) {
|
||||
parent->m_drv->GetRatio(0, ratio);
|
||||
int dpi = parent->GetSelectDPIIndex() == 0 ? 1 : (parent->GetSelectDPIIndex() == 1 ? 2 : 3);
|
||||
parent->m_drv->GetRatio(0, ratio, dpi);
|
||||
float f_ratio = *(float*)∶
|
||||
CString str;
|
||||
str.Format(L"%.4f", f_ratio);
|
||||
|
@ -279,7 +280,8 @@ void CA4::OnBnClickedBtnGetver()
|
|||
auto parent = (CHuaGoCorrectDlg*)GetParent();
|
||||
int ratio = 0;
|
||||
if (parent->m_drv.get() && parent->m_drv->IsConnected()) {
|
||||
parent->m_drv->GetRatio(1, ratio);
|
||||
int dpi = parent->GetSelectDPIIndex() == 0 ? 1 : (parent->GetSelectDPIIndex() == 1 ? 2 : 3);
|
||||
parent->m_drv->GetRatio(1, ratio, dpi);
|
||||
float f_ratio = *(float*)∶
|
||||
CString str;
|
||||
str.Format(L"%.4f", f_ratio);
|
||||
|
@ -292,13 +294,14 @@ void CA4::OnBnClickedBtnSethor()
|
|||
{
|
||||
auto parent = (CHuaGoCorrectDlg*)GetParent();
|
||||
if (parent->m_drv.get() && parent->m_drv->IsConnected()) {
|
||||
int dpi = parent->GetSelectDPIIndex() == 0 ? 1 : (parent->GetSelectDPIIndex() == 1 ? 2 : 3);
|
||||
CString str;
|
||||
GetDlgItemText(IDC_tbxHOR, str);
|
||||
USES_CONVERSION;
|
||||
std::string s_str(W2A(str));
|
||||
float f_value = atof(s_str.c_str());
|
||||
int value = *(int*)&f_value;
|
||||
parent->m_drv->SetRatio(0, value);
|
||||
parent->m_drv->SetRatio(0, value, dpi);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -307,13 +310,14 @@ void CA4::OnBnClickedBtnSetver()
|
|||
{
|
||||
auto parent = (CHuaGoCorrectDlg*)GetParent();
|
||||
if (parent->m_drv.get() && parent->m_drv->IsConnected()) {
|
||||
int dpi = parent->GetSelectDPIIndex() == 0 ? 1 : (parent->GetSelectDPIIndex() == 1 ? 2 : 3);
|
||||
CString str;
|
||||
GetDlgItemText(IDC_tbxVER, str);
|
||||
USES_CONVERSION;
|
||||
std::string s_str(W2A(str));
|
||||
float f_value = atof(s_str.c_str());
|
||||
int value = *(int*)&f_value;
|
||||
parent->m_drv->SetRatio(1, value);
|
||||
parent->m_drv->SetRatio(1, value, dpi);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -234,6 +234,7 @@ opencv_imgproc2410d.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|||
<ClInclude Include="MutexEx.h" />
|
||||
<ClInclude Include="PublicFunc.h" />
|
||||
<ClInclude Include="Resource.h" />
|
||||
<ClInclude Include="ScannerTypeConfig.h" />
|
||||
<ClInclude Include="scn_config.h" />
|
||||
<ClInclude Include="scn_usb.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
|
@ -255,6 +256,7 @@ opencv_imgproc2410d.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|||
<ClCompile Include="jpeglib.cpp" />
|
||||
<ClCompile Include="JsonConfig.cpp" />
|
||||
<ClCompile Include="PublicFunc.cpp" />
|
||||
<ClCompile Include="ScannerTypeConfig.cpp" />
|
||||
<ClCompile Include="scn_config.cpp" />
|
||||
<ClCompile Include="scn_usb.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
|
|
|
@ -123,6 +123,9 @@
|
|||
<ClInclude Include="vendorconfig.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ScannerTypeConfig.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="HuaGoCorrect.cpp">
|
||||
|
@ -176,6 +179,9 @@
|
|||
<ClCompile Include="vendorconfig.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ScannerTypeConfig.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="HuaGoCorrect.rc">
|
||||
|
|
|
@ -177,10 +177,10 @@ BOOL CHuaGoCorrectDlg::OnInitDialog()
|
|||
// 根据调整好的tabRect放置m_VisonDlg子对话框,并设置为隐藏
|
||||
m_VisonDlg.SetWindowPos(NULL, tabRect.left, tabRect.top, tabRect.Width(), tabRect.Height(), SWP_HIDEWINDOW);
|
||||
|
||||
m_ComboxDpi.InsertString(0, _T("300"));
|
||||
m_ComboxDpi.InsertString(1, _T("200"));
|
||||
m_ComboxDpi.InsertString(2, _T("150"));
|
||||
m_ComboxDpi.SetCurSel(1);
|
||||
m_ComboxDpi.InsertString(0, _T("200"));
|
||||
m_ComboxDpi.InsertString(1, _T("300"));
|
||||
m_ComboxDpi.InsertString(2, _T("600"));
|
||||
m_ComboxDpi.SetCurSel(0);
|
||||
|
||||
m_ComboxColor.InsertString(0, _T("gray"));
|
||||
m_ComboxColor.InsertString(1, _T("color"));
|
||||
|
@ -345,8 +345,8 @@ void CHuaGoCorrectDlg::Scan()
|
|||
m_drv->PID == 0x8739 ||
|
||||
m_drv->PID == 0x8629)
|
||||
{
|
||||
config.g200params.dpi = 1;//only support 200DPI
|
||||
config.g200params.paper = 2;
|
||||
config.g200params.dpi = m_iDpiIndex==0?1:(m_iDpiIndex==1?2:3);//only support 200DPI
|
||||
config.g200params.paper = 16;
|
||||
config.g200params.pc_correct = ((CButton*)GetDlgItem(IDC_CKBORGINIMG))->GetCheck();
|
||||
config.g200params.color = m_iColorIndex == 1 ? 1 : 0;
|
||||
config.g200params.double_feed_enbale = TRUE;
|
||||
|
@ -355,7 +355,7 @@ void CHuaGoCorrectDlg::Scan()
|
|||
}
|
||||
else
|
||||
{
|
||||
config.g400params.dpi = 1;//only support 200DPI
|
||||
config.g400params.dpi = m_iDpiIndex == 0 ? 1 : (m_iDpiIndex == 1 ? 2 : 3);//only support 200DPI ;// 1;//only support 200DPI
|
||||
config.g400params.pageSize = 0;
|
||||
config.g400params.isCorrect = !((CButton*)GetDlgItem(IDC_CKBORGINIMG))->GetCheck();
|
||||
config.g400params.isColor = m_iColorIndex == 1 ? 1 : 0;
|
||||
|
|
|
@ -110,6 +110,9 @@ public:
|
|||
afx_msg void OnCbnSelchangeCmbUsbs();
|
||||
afx_msg void OnBnClickedBtnstart();
|
||||
afx_msg void OnBnClickedBtnstop();
|
||||
int GetSelectDPIIndex() {
|
||||
return m_iDpiIndex;
|
||||
}
|
||||
private:
|
||||
CString updateFilePath;
|
||||
std::thread m_updateThread;
|
||||
|
|
|
@ -18,8 +18,8 @@ public:
|
|||
virtual std::string GetMbVersion() = 0;
|
||||
virtual std::string GetIpAddr() = 0;
|
||||
virtual std::string GetKernelVersion() =0;
|
||||
virtual void SetRatio(int tyepe, int ration) = 0;
|
||||
virtual void GetRatio(int type, int& ratio) = 0;
|
||||
virtual void SetRatio(int tyepe, int ration,int dpi=0) = 0;
|
||||
virtual void GetRatio(int type, int& ratio,int dpi=0) = 0;
|
||||
virtual void Reboot(bool loader=false) = 0;
|
||||
virtual void PowerOff() = 0;
|
||||
virtual bool is_scan() = 0;
|
||||
|
@ -54,6 +54,7 @@ public:
|
|||
virtual void SetFlatCallback(std::function<void(std::string)> func) = 0;
|
||||
virtual void GetSpeedMode(int& speedmode,bool get) = 0 ;
|
||||
virtual void GetOrSetVIDPID(int& value, bool get) = 0;
|
||||
virtual std::string GetSysInfo() = 0;
|
||||
void SetPath(std::string csFilePath)
|
||||
{
|
||||
csPath = csFilePath;
|
||||
|
|
Binary file not shown.
|
@ -0,0 +1,61 @@
|
|||
#include "stdafx.h"
|
||||
#include "ScannerTypeConfig.h"
|
||||
#include "json.hpp"
|
||||
#include <io.h>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
|
||||
|
||||
ScannerTypeConfig::ScannerTypeConfig()
|
||||
{
|
||||
if (_access("scannerconfig.json", 0) != 0)
|
||||
{
|
||||
json j = json::array();
|
||||
{
|
||||
for (size_t i = 0; i < m_supscanner.size(); i++)
|
||||
{
|
||||
json t_j;
|
||||
auto tsup = m_supscanner[i];
|
||||
to_json(t_j, tsup);
|
||||
j.push_back(t_j);
|
||||
}
|
||||
}
|
||||
std::ofstream ofs("scannerconfig.json");
|
||||
//ofs << std::setw(4) << js << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
ScannerTypeConfig::~ScannerTypeConfig()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
std::vector<SupScanner> ScannerTypeConfig::GetSupScanners()
|
||||
{
|
||||
return std::vector<SupScanner>();
|
||||
}
|
||||
|
||||
void ScannerTypeConfig::AddSupScanner(SupScanner add)
|
||||
{
|
||||
}
|
||||
|
||||
void ScannerTypeConfig::initconfig()
|
||||
{
|
||||
}
|
||||
|
||||
void ScannerTypeConfig::from_json(json& j, SupScanner& sup)
|
||||
{
|
||||
j.at("VID").get_to(sup.VID);
|
||||
j.at("PID").get_to(sup.PID);
|
||||
j.at("ScannerType").get_to(sup.ScannerType);
|
||||
}
|
||||
|
||||
void ScannerTypeConfig::to_json(json& j, SupScanner& sup)
|
||||
{
|
||||
j = json{
|
||||
{"VID",sup.VID},
|
||||
{"PID",sup.PID},
|
||||
{"ScannerType",sup.ScannerType}
|
||||
};
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
#pragma once
|
||||
#include "commondef.h"
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include "json.hpp"
|
||||
|
||||
using json = nlohmann::json;
|
||||
class ScannerTypeConfig
|
||||
{
|
||||
public:
|
||||
ScannerTypeConfig();
|
||||
~ScannerTypeConfig();
|
||||
std::vector<SupScanner> GetSupScanners();
|
||||
void AddSupScanner(SupScanner add);
|
||||
private:
|
||||
void initconfig();
|
||||
void from_json(json& j, SupScanner& sup);
|
||||
void to_json(json& j, SupScanner& sup);
|
||||
const std::vector< SupScanner> m_supscanner = {
|
||||
{0x064b,0x7823,ScannerType::S_G139},
|
||||
{0x3072,0x0139,ScannerType::S_G139},
|
||||
{0x3072,0x0239,ScannerType::S_G239},
|
||||
{0x3072,0x0300,ScannerType::S_G300_3288},
|
||||
{0x3072,0x0300,ScannerType::S_G300UV_3288},
|
||||
{0x3072,0x0339,ScannerType::S_G300_3399},
|
||||
{0x3072,0x0400,ScannerType::S_G400_3288},
|
||||
{0x3072,0x0439,ScannerType::S_G400_3399},
|
||||
};
|
||||
};
|
|
@ -167,7 +167,9 @@ enum tagUsbKeyWords :unsigned int
|
|||
GET_UV_EXPOSA = 0x100,
|
||||
GET_UV_EXPOSB = 0x101,
|
||||
SET_UV_EXPOSA = 0x102,
|
||||
SET_UV_EXPOSB = 0x103
|
||||
SET_UV_EXPOSB = 0x103,
|
||||
GETSYSINFO_LEN = 0x200,
|
||||
GETSYSINFO = 0x201
|
||||
};
|
||||
|
||||
typedef enum tagUsbKeyWords UsbKeyWords, * PUsbKeyWords;
|
||||
|
@ -417,3 +419,21 @@ struct HGEIntInfo
|
|||
unsigned int Code;
|
||||
unsigned int Img_Index;
|
||||
};
|
||||
|
||||
enum class ScannerType
|
||||
{
|
||||
S_G139,
|
||||
S_G239,
|
||||
S_G300_3288,
|
||||
S_G300UV_3288,
|
||||
S_G300_3399,
|
||||
S_G400_3288,
|
||||
S_G400_3399
|
||||
};
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned short VID;
|
||||
unsigned short PID;
|
||||
ScannerType ScannerType;
|
||||
}SupScanner;
|
|
@ -197,12 +197,12 @@ std::string gscan3399::GetKernelVersion()
|
|||
return version;
|
||||
}
|
||||
|
||||
void gscan3399::SetRatio(int tyepe, int ration)
|
||||
void gscan3399::SetRatio(int tyepe, int ration,int dpi)
|
||||
{
|
||||
scanner_write_reg(m_usb, tyepe == 0 ? SR_SET_H_RATIO : SR_SET_V_RATIO, ration);
|
||||
|
||||
}
|
||||
void gscan3399::GetRatio(int type, int& ratio)
|
||||
void gscan3399::GetRatio(int type, int& ratio,int dpi)
|
||||
{
|
||||
ratio = scanner_read_reg(m_usb, type == 0 ? SR_GET_H_RATIO : SR_GET_V_RATIO);
|
||||
}
|
||||
|
@ -532,6 +532,11 @@ void gscan3399::GetOrSetVIDPID(int& value, bool get)
|
|||
}
|
||||
}
|
||||
|
||||
std::string gscan3399::GetSysInfo()
|
||||
{
|
||||
return "Unsupported";
|
||||
}
|
||||
|
||||
void gscan3399::usbcallback(bool isleft, void* usrdata)
|
||||
{
|
||||
gscan3399* This = (gscan3399*)usrdata;
|
||||
|
|
|
@ -19,8 +19,8 @@ public:
|
|||
virtual std::string GetKernelVersion();
|
||||
virtual std::string GetIpAddr();
|
||||
virtual std::string GetMbVersion();
|
||||
virtual void SetRatio(int tyepe, int ration);
|
||||
virtual void GetRatio(int type, int& ratio);
|
||||
virtual void SetRatio(int tyepe, int ration,int dpi=0);
|
||||
virtual void GetRatio(int type, int& ratio,int dpi=0);
|
||||
virtual void Reboot(bool loader=false);
|
||||
virtual void PowerOff();
|
||||
virtual bool is_scan();
|
||||
|
@ -72,7 +72,7 @@ public:
|
|||
virtual void SetFlatCallback(std::function<void(std::string)> func);
|
||||
virtual void GetSpeedMode(int& speedmode,bool getorset);
|
||||
virtual void GetOrSetVIDPID(int& value, bool get) override;
|
||||
|
||||
virtual std::string GetSysInfo() override;
|
||||
private:
|
||||
static void usbcallback(bool isleft, void* usrdata);
|
||||
int read_data(void* data, int length, int timeout);
|
||||
|
|
|
@ -267,6 +267,24 @@ void GScn_Drv::GetOrSetVIDPID(int& value, bool get)
|
|||
}
|
||||
}
|
||||
|
||||
std::string GScn_Drv::GetSysInfo()
|
||||
{
|
||||
UsbKeyWords keyword = GETSYSINFO_LEN;
|
||||
USBCB cmd = { keyword ,0,0 };
|
||||
m_usb->write_bulk(&cmd, sizeof(cmd));
|
||||
m_usb->read_bulk(&cmd, sizeof(cmd));
|
||||
int len = cmd.u32_Count;
|
||||
string str;
|
||||
str.resize(4096);
|
||||
cmd.u32_CMD = GETSYSINFO;
|
||||
cmd.u32_Count = 0;
|
||||
cmd.u32_Data = 0;
|
||||
m_usb->write_bulk(&cmd, sizeof(cmd));
|
||||
m_usb->read_bulk(&str[0], len);
|
||||
int aa = 0;
|
||||
return str;
|
||||
}
|
||||
|
||||
void GScn_Drv::reset()
|
||||
{
|
||||
while (!m_pImages.empty())
|
||||
|
@ -743,17 +761,17 @@ std::string GScn_Drv::GetSerialNum()
|
|||
return str;
|
||||
}
|
||||
|
||||
void GScn_Drv::SetRatio(int tyepe, int ration)
|
||||
void GScn_Drv::SetRatio(int tyepe, int ration, int dpi)
|
||||
{
|
||||
UsbKeyWords keyword = tyepe == 0 ? SET_JUST_COF_H : SET_JUST_COF_V;
|
||||
USBCB cmd = { keyword ,ration,0};
|
||||
USBCB cmd = { keyword ,ration,dpi };
|
||||
m_usb->write_bulk(&cmd, sizeof(cmd));
|
||||
}
|
||||
|
||||
void GScn_Drv::GetRatio(int type, int& ratio)
|
||||
void GScn_Drv::GetRatio(int type, int& ratio, int dpi)
|
||||
{
|
||||
UsbKeyWords keyword = type == 0 ? GET_JUST_COF_H : GET_JUST_COF_V;
|
||||
USBCB cmd = { keyword ,0,0 };
|
||||
USBCB cmd = { keyword ,0,dpi };
|
||||
m_usb->write_bulk(&cmd, sizeof(cmd));
|
||||
m_usb->read_bulk(&cmd, sizeof(cmd));
|
||||
ratio = cmd.u32_Data;
|
||||
|
|
|
@ -30,8 +30,8 @@ public:
|
|||
virtual std::string GetMbVersion();
|
||||
virtual std::string GetIpAddr();
|
||||
virtual std::string GetKernelVersion();
|
||||
virtual void SetRatio(int tyepe, int ration);
|
||||
virtual void GetRatio(int type, int& ratio);
|
||||
virtual void SetRatio(int tyepe, int ration,int dpi=0);
|
||||
virtual void GetRatio(int type, int& ratio,int dpi=0);
|
||||
virtual void Reboot(bool loader=false);
|
||||
virtual void PowerOff() {};
|
||||
virtual bool is_scan()override;
|
||||
|
@ -80,6 +80,7 @@ public:
|
|||
virtual void SetFlatCallback(std::function<void(std::string)> func)override;
|
||||
virtual void GetSpeedMode(int& speedmode, bool get)override;
|
||||
virtual void GetOrSetVIDPID(int& value, bool get) override;
|
||||
virtual std::string GetSysInfo() override;
|
||||
private:
|
||||
volatile int devState;
|
||||
volatile bool m_bRun;
|
||||
|
|
Loading…
Reference in New Issue