diff --git a/app/HGProductionTool/mainwindow.cpp b/app/HGProductionTool/mainwindow.cpp index 811f284..8fc283b 100644 --- a/app/HGProductionTool/mainwindow.cpp +++ b/app/HGProductionTool/mainwindow.cpp @@ -7,6 +7,7 @@ #include "dialog_changepwd.h" #include "dialog_accountmanage.h" #include "dialog_uploadcfgfile.h" +#include "hgscanner.h" MainWindow::MainWindow(HGPdtToolDbUserMgr userMgr, QWidget *parent) : QMainWindow(parent) @@ -41,6 +42,7 @@ MainWindow::MainWindow(HGPdtToolDbUserMgr userMgr, QWidget *parent) vLayout->setStretch(0, 1); vLayout->setStretch(1, 0); this->centralWidget()->setLayout(vLayout); + test(); } MainWindow::~MainWindow() @@ -75,6 +77,7 @@ std::vector MainWindow::get_devices() return name; } + int MainWindow::sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigned int* len, void* param) { switch (code) @@ -107,6 +110,7 @@ int MainWindow::sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigne } void MainWindow::test() { + SANE_Handle devHandle; SANE_Status status = SANE_STATUS_GOOD; SANE_Int version_code = 0; status = sane_init_ex(&version_code, sane_ex_callback, NULL); @@ -114,14 +118,15 @@ void MainWindow::test() const SANE_Device** device_list; //status = sane_get_devices(&device_list, SANE_TRUE); std::vector name = get_devices(); - SANE_Handle devHandle = NULL; + // SANE_String_Const n = name[0].c_str(); int len = name[0].size(); char* buf = new char[len]; strcpy(buf, name[0].c_str()); sane_open(buf, &devHandle); - ui_helper* helper = new ui_helper(devHandle); - + ui_helper* helper; + hgscanner* hg = new hgscanner(devHandle); + helper = dynamic_cast(hg); // sane_ex_callback1(); func_test_go(L"test-35", L"null", helper); } @@ -225,6 +230,6 @@ QString MainWindow::getLogInfo(HGResult ret) void MainWindow::on_act_upload_triggered() { - Dialog_uploadCfgFile dlg(m_pdtToolDbuserMgr, this); - dlg.exec(); + // Dialog_uploadCfgFile dlg(m_pdtToolDbuserMgr, this); + //dlg.exec(); } diff --git a/app/HGProductionTool/mainwindow.h b/app/HGProductionTool/mainwindow.h index c1a9d81..7770f4c 100644 --- a/app/HGProductionTool/mainwindow.h +++ b/app/HGProductionTool/mainwindow.h @@ -7,13 +7,11 @@ #include #include "HGPdtToolDb.h" #include "sane/sane_ex.h" -#include "ui_helper.h" -#include "test_base.h" QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } QT_END_NAMESPACE -class MainWindow : public QMainWindow +class MainWindow : public QMainWindow { Q_OBJECT @@ -27,6 +25,7 @@ public: void test(); static int sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigned int* len, void* param); std::vector get_devices(); + private slots: void on_act_newDevice_triggered(); diff --git a/app/HGProductionTool/ui_helper.cpp b/app/HGProductionTool/ui_helper.cpp index e5c9c25..8edac01 100644 --- a/app/HGProductionTool/ui_helper.cpp +++ b/app/HGProductionTool/ui_helper.cpp @@ -22,11 +22,10 @@ int ui_helper::unregister_sane_callback(sane_callback cb) } int ui_helper::io_control(unsigned long code, void* data, unsigned* len) { - SANE_Status status = SANE_STATUS_GOOD; - status = sane_io_control(dev_, code, data, len); - return status; + + return 0; } -ui_helper::ui_helper(SANE_Handle dev) :dev_(dev) +ui_helper::ui_helper() { } parameter* ui_helper::get_user_input(data_from from, value_type type, const wchar_t* title, const wchar_t* desc) diff --git a/app/HGProductionTool/ui_helper.h b/app/HGProductionTool/ui_helper.h index 8cd37b7..15b1b61 100644 --- a/app/HGProductionTool/ui_helper.h +++ b/app/HGProductionTool/ui_helper.h @@ -52,11 +52,10 @@ class ui_helper : public ref public: - ui_helper(SANE_Handle dev); + ui_helper(); public: virtual ~ui_helper() {} - SANE_Handle dev_; public: enum data_from diff --git a/code/base/test.vcxproj b/code/base/test.vcxproj index d256bcf..75c55b3 100644 --- a/code/base/test.vcxproj +++ b/code/base/test.vcxproj @@ -73,6 +73,9 @@ ..\..\..\sdk\include;C:\Users\modehua\Desktop\sane\code_production\app\HGProductionTool;$(IncludePath) + + $(VC_IncludePath);$(WindowsSDK_IncludePath);..\..\..\sdk\include;C:\Users\modehua\Desktop\sane\code_production\app\HGProductionTool;$(IncludePath) + Level3 diff --git a/code/base/test_base.cpp b/code/base/test_base.cpp index 44e57e5..d630d54 100644 --- a/code/base/test_base.cpp +++ b/code/base/test_base.cpp @@ -220,20 +220,4 @@ int func_test_uninit(void* uninit) -int main11() -{ - /*get_json_config_file(); - int ret = 0; - wchar_t* str_wchar = NULL; - size_t len = 0; - ret = func_test_get_list(str_wchar, &len); - if (ret == ERROR_INSUFFICIENT_BUFFER) - { - str_wchar = new wchar_t[len]; - ret = func_test_get_list(str_wchar, &len); - } - ret = func_test_go(L"test-5",L"start",NULL);*/ - //std::wcout << str_wchar << std::endl; - return 0; -} diff --git a/code/base/test_base.h b/code/base/test_base.h index 198818e..cf9d454 100644 --- a/code/base/test_base.h +++ b/code/base/test_base.h @@ -2,6 +2,7 @@ #include "string" #include "sane/sane_ex.h" #include "ui_helper.h" +#include //////////////////////////////////////TITLE////////////////////////////////////// /* 拨码开关校验 */ #define HGPDTTOOLDB_TITLE_DIAL_SWITCH L"拨码开关校验"