diff --git a/HuaGoCorrect/A3.cpp b/HuaGoCorrect/A3.cpp index c119825..762afef 100644 --- a/HuaGoCorrect/A3.cpp +++ b/HuaGoCorrect/A3.cpp @@ -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); } } -} \ No newline at end of file +} + +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); + } +} diff --git a/HuaGoCorrect/A3.h b/HuaGoCorrect/A3.h index fc9fdea..98bb484 100644 --- a/HuaGoCorrect/A3.h +++ b/HuaGoCorrect/A3.h @@ -52,6 +52,7 @@ private: unsigned int GraySp; }; int speedemodelen; + std::map 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(); }; diff --git a/HuaGoCorrect/A4.cpp b/HuaGoCorrect/A4.cpp index 4dcfbcd..71c328e 100644 --- a/HuaGoCorrect/A4.cpp +++ b/HuaGoCorrect/A4.cpp @@ -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); + } +} diff --git a/HuaGoCorrect/A4.h b/HuaGoCorrect/A4.h index 64b5d02..6ca56e6 100644 --- a/HuaGoCorrect/A4.h +++ b/HuaGoCorrect/A4.h @@ -75,4 +75,5 @@ public: afx_msg void OnBnClickedBtnbdown(); void UpdateGains(int id, bool get); afx_msg void OnEnChangetbxfrexposure2(); + afx_msg void OnBnClickedBtngetMbVersion(); }; diff --git a/HuaGoCorrect/HuaGoCorrect.rc b/HuaGoCorrect/HuaGoCorrect.rc index 5a4c15d..cfe9e04 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..5f2cbea 100644 --- a/HuaGoCorrect/HuaGoCorrect.vcxproj +++ b/HuaGoCorrect/HuaGoCorrect.vcxproj @@ -38,7 +38,7 @@ Application true - MultiByte + Unicode Dynamic v142 14.28.29910 @@ -55,7 +55,7 @@ Application false true - MultiByte + Unicode Dynamic v142 @@ -192,8 +192,7 @@ opencv_imgproc2410d.lib;%(AdditionalDependencies) true true .\pub\external\lib;.\pub\opencv\lib;D:\local\boost_1_71_0_b1_rc1\lib32-msvc-14.1 - turbojpeg.lib;opencv_core2410.lib;opencv_highgui2410.lib; -opencv_imgproc2410.lib;%(AdditionalDependencies) + turbojpeg.lib;opencv_world346.lib;%(AdditionalDependencies) false diff --git a/HuaGoCorrect/IScanner.h b/HuaGoCorrect/IScanner.h index a7f750f..6c881bb 100644 --- a/HuaGoCorrect/IScanner.h +++ b/HuaGoCorrect/IScanner.h @@ -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; diff --git a/HuaGoCorrect/Resource.h b/HuaGoCorrect/Resource.h index 4b68b22..4186bd5 100644 Binary files a/HuaGoCorrect/Resource.h and b/HuaGoCorrect/Resource.h differ diff --git a/HuaGoCorrect/commondef.h b/HuaGoCorrect/commondef.h index 9861740..65d7340 100644 --- a/HuaGoCorrect/commondef.h +++ b/HuaGoCorrect/commondef.h @@ -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 diff --git a/HuaGoCorrect/gscan3399.cpp b/HuaGoCorrect/gscan3399.cpp index ee14292..29cefe0 100644 --- a/HuaGoCorrect/gscan3399.cpp +++ b/HuaGoCorrect/gscan3399.cpp @@ -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) { diff --git a/HuaGoCorrect/gscan3399.h b/HuaGoCorrect/gscan3399.h index 4222473..96f83a2 100644 --- a/HuaGoCorrect/gscan3399.h +++ b/HuaGoCorrect/gscan3399.h @@ -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(); diff --git a/HuaGoCorrect/gscn_drv.cpp b/HuaGoCorrect/gscn_drv.cpp index f5cbd58..72181b8 100644 --- a/HuaGoCorrect/gscn_drv.cpp +++ b/HuaGoCorrect/gscn_drv.cpp @@ -561,10 +561,19 @@ void GScn_Drv::SetFWVersion() if (m_usb->is_connected()) { std::lock_guard 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()) diff --git a/HuaGoCorrect/gscn_drv.h b/HuaGoCorrect/gscn_drv.h index 2ff5058..9ba8ae8 100644 --- a/HuaGoCorrect/gscn_drv.h +++ b/HuaGoCorrect/gscn_drv.h @@ -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);