增加ip地址以及电机板版本读取

This commit is contained in:
masayume 2021-10-20 08:55:37 +08:00
parent d6ef2e7fcf
commit bbb6c10d02
13 changed files with 90 additions and 9 deletions

View File

@ -45,6 +45,7 @@ BEGIN_MESSAGE_MAP(CA3, CDialog)
ON_BN_CLICKED(IDC_BTNGETVERSION, &CA3::OnBnClickedBtngetversion)
ON_BN_CLICKED(IDC_BTNSETSPEED, &CA3::OnBnClickedBtnsetspeed)
ON_BN_CLICKED(IDC_BTNGETSPEED, &CA3::OnBnClickedBtngetspeed)
ON_BN_CLICKED(IDC_BTNGETIP, &CA3::OnBnClickedBtngetip)
END_MESSAGE_MAP()
@ -335,8 +336,6 @@ void CA3::updatespeedmode(bool get)
++j;
}
}
if (!bfound)
MessageBox(L"未找到对应的速度模式!", L"提示", MB_OK | MB_ICONINFORMATION);
}
@ -374,4 +373,15 @@ void CA3::updatespeedmode(bool get)
MessageBox(L"未找到扫描仪!", L"提示", MB_OK | MB_ICONINFORMATION);
}
}
}
}
void CA3::OnBnClickedBtngetip()
{
// TODO: 在此添加控件通知处理程序代码
auto parent = (CHuaGoCorrectDlg*)GetParent();
if (parent->m_drv.get() && parent->m_drv->IsConnected()) {
std::string version = parent->m_drv->GetIpAddr();
CString vs(version.c_str());
SetDlgItemText(IDC_LBIPADDR, vs);
}
}

View File

@ -52,6 +52,7 @@ private:
unsigned int GraySp;
};
int speedemodelen;
std::map<int, speedmodeparam> speedmodeMap = {
{0,{70,0x42d,0xc88}},
{1,{80,0x37f,0xa7f}},
@ -82,4 +83,6 @@ private:
{5,L"G400_80PPM"},
};
CComboBox m_cmbSpeedmode;
public:
afx_msg void OnBnClickedBtngetip();
};

View File

@ -71,6 +71,7 @@ BEGIN_MESSAGE_MAP(CA4, CDialog)
ON_BN_CLICKED(IDC_BTNADOWN, &CA4::OnBnClickedBtnadown)
ON_BN_CLICKED(IDC_BTNBUP, &CA4::OnBnClickedBtnbup)
ON_BN_CLICKED(IDC_BTNBDOWN, &CA4::OnBnClickedBtnbdown)
ON_BN_CLICKED(IDC_BTNGET_MB_VERSION, &CA4::OnBnClickedBtngetMbVersion)
END_MESSAGE_MAP()
@ -436,3 +437,15 @@ void CA4::OnEnChangetbxfrexposure2()
// TODO: 在此添加控件通知处理程序代码
}
void CA4::OnBnClickedBtngetMbVersion()
{
// TODO: 在此添加控件通知处理程序代码
auto parent = (CHuaGoCorrectDlg*)GetParent();
if (parent->m_drv.get() && parent->m_drv->IsConnected()) {
std::string version = parent->m_drv->GetMbVersion();
CString vs(version.c_str());
SetDlgItemText(IDC_tbxMbVersion, vs);
}
}

View File

@ -75,4 +75,5 @@ public:
afx_msg void OnBnClickedBtnbdown();
void UpdateGains(int id, bool get);
afx_msg void OnEnChangetbxfrexposure2();
afx_msg void OnBnClickedBtngetMbVersion();
};

Binary file not shown.

View File

@ -38,7 +38,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
<PlatformToolset>v142</PlatformToolset>
<VCToolsVersion>14.28.29910</VCToolsVersion>
@ -55,7 +55,7 @@
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>Dynamic</UseOfMfc>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
@ -192,8 +192,7 @@ opencv_imgproc2410d.lib;%(AdditionalDependencies)</AdditionalDependencies>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>.\pub\external\lib;.\pub\opencv\lib;D:\local\boost_1_71_0_b1_rc1\lib32-msvc-14.1</AdditionalLibraryDirectories>
<AdditionalDependencies>turbojpeg.lib;opencv_core2410.lib;opencv_highgui2410.lib;
opencv_imgproc2410.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>turbojpeg.lib;opencv_world346.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>

View File

@ -15,6 +15,8 @@ public:
virtual void SetFWVersion() = 0;
virtual std::string GetSerialNum() = 0;
virtual void SetSerialNum(std::string serial) = 0;
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;

Binary file not shown.

View File

@ -335,7 +335,12 @@ enum Scanner_Reg_Defs
SR_FLAT_CLR_MAX_BRIGHT,
SR_FLAT_GRAY_MAX_BRIGHT,
SR_KERNEL_VERSION_INFO_LENGTH,
SR_GET_KERNEL_VERSION
SR_GET_KERNEL_VERSION,
SR_GET_IPADDR_LENGHT = 0x200,
SR_GET_MACADDR,
SR_GET_IPADDR,
SR_GET_MBVERSION_LENGHT,
SR_GET_MBVERSION,
};
enum Scanner_Cmd_Defs

View File

@ -147,6 +147,38 @@ void gscan3399::SetSerialNum(std::string serial)
}
}
std::string gscan3399::GetIpAddr()
{
std::string version = "unkown";
if (m_usb.get() && m_usb->is_connected())
{
int length = scanner_read_reg(m_usb, SR_GET_IPADDR_LENGHT);
version.resize(length);
if (length > 0)
{
scanner_write_reg(m_usb, SR_GET_IPADDR, length);
read_data(&version[0], version.length(), 200);
}
}
return version;
}
std::string gscan3399::GetMbVersion()
{
std::string version = "unkown";
if (m_usb.get() && m_usb->is_connected())
{
int length = scanner_read_reg(m_usb, SR_GET_MBVERSION_LENGHT);
version.resize(length);
if (length > 0)
{
scanner_write_reg(m_usb, SR_GET_MBVERSION, length);
read_data(&version[0], version.length(), 200);
}
}
return version;
}
std::string gscan3399::GetKernelVersion()
{
std::string version = "unkown";
@ -457,7 +489,10 @@ void gscan3399::SetSptime(int type, int time)
void gscan3399::GetSleepTime(int& sleeptime)
{
char buf[100] = { 0 };
sleeptime = scanner_read_reg(m_usb, SR_GET_SLEEPTIME);
m_usb->read_bulk(buf,scanner_read_reg(m_usb, 0x200));
int x = 0;
}
void gscan3399::SetSleepTime(int sleeptime)
{

View File

@ -17,6 +17,8 @@ public:
virtual std::string GetSerialNum();
virtual void SetSerialNum(std::string serial);
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 Reboot();

View File

@ -561,10 +561,19 @@ void GScn_Drv::SetFWVersion()
if (m_usb->is_connected())
{
std::lock_guard<std::mutex> lck(m_imgLocker);
}
}
std::string GScn_Drv::GetIpAddr()
{
return "no support";
}
std::string GScn_Drv::GetMbVersion()
{
return "no support";
}
void GScn_Drv::SetSerialNum(std::string pvalue)
{
if (m_usb->is_connected())

View File

@ -27,6 +27,8 @@ public:
virtual void SetFWVersion();
virtual std::string GetSerialNum();
virtual void SetSerialNum(std::string serial);
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);