This commit is contained in:
13038267101 2022-12-15 14:05:53 +08:00
parent b057829401
commit b443419e76
7 changed files with 20 additions and 30 deletions

View File

@ -7,6 +7,7 @@
#include "dialog_changepwd.h" #include "dialog_changepwd.h"
#include "dialog_accountmanage.h" #include "dialog_accountmanage.h"
#include "dialog_uploadcfgfile.h" #include "dialog_uploadcfgfile.h"
#include "hgscanner.h"
MainWindow::MainWindow(HGPdtToolDbUserMgr userMgr, QWidget *parent) MainWindow::MainWindow(HGPdtToolDbUserMgr userMgr, QWidget *parent)
: QMainWindow(parent) : QMainWindow(parent)
@ -41,6 +42,7 @@ MainWindow::MainWindow(HGPdtToolDbUserMgr userMgr, QWidget *parent)
vLayout->setStretch(0, 1); vLayout->setStretch(0, 1);
vLayout->setStretch(1, 0); vLayout->setStretch(1, 0);
this->centralWidget()->setLayout(vLayout); this->centralWidget()->setLayout(vLayout);
test();
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
@ -75,6 +77,7 @@ std::vector<std::string> MainWindow::get_devices()
return name; return name;
} }
int MainWindow::sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigned int* len, void* param) int MainWindow::sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigned int* len, void* param)
{ {
switch (code) switch (code)
@ -107,6 +110,7 @@ int MainWindow::sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigne
} }
void MainWindow::test() void MainWindow::test()
{ {
SANE_Handle devHandle;
SANE_Status status = SANE_STATUS_GOOD; SANE_Status status = SANE_STATUS_GOOD;
SANE_Int version_code = 0; SANE_Int version_code = 0;
status = sane_init_ex(&version_code, sane_ex_callback, NULL); status = sane_init_ex(&version_code, sane_ex_callback, NULL);
@ -114,14 +118,15 @@ void MainWindow::test()
const SANE_Device** device_list; const SANE_Device** device_list;
//status = sane_get_devices(&device_list, SANE_TRUE); //status = sane_get_devices(&device_list, SANE_TRUE);
std::vector<std::string> name = get_devices(); std::vector<std::string> name = get_devices();
SANE_Handle devHandle = NULL;
// SANE_String_Const n = name[0].c_str(); // SANE_String_Const n = name[0].c_str();
int len = name[0].size(); int len = name[0].size();
char* buf = new char[len]; char* buf = new char[len];
strcpy(buf, name[0].c_str()); strcpy(buf, name[0].c_str());
sane_open(buf, &devHandle); sane_open(buf, &devHandle);
ui_helper* helper = new ui_helper(devHandle); ui_helper* helper;
hgscanner* hg = new hgscanner(devHandle);
helper = dynamic_cast<hgscanner*>(hg);
// sane_ex_callback1(); // sane_ex_callback1();
func_test_go(L"test-35", L"null", helper); func_test_go(L"test-35", L"null", helper);
} }
@ -225,6 +230,6 @@ QString MainWindow::getLogInfo(HGResult ret)
void MainWindow::on_act_upload_triggered() void MainWindow::on_act_upload_triggered()
{ {
Dialog_uploadCfgFile dlg(m_pdtToolDbuserMgr, this); // Dialog_uploadCfgFile dlg(m_pdtToolDbuserMgr, this);
dlg.exec(); //dlg.exec();
} }

View File

@ -7,13 +7,11 @@
#include <QSplitter> #include <QSplitter>
#include "HGPdtToolDb.h" #include "HGPdtToolDb.h"
#include "sane/sane_ex.h" #include "sane/sane_ex.h"
#include "ui_helper.h"
#include "test_base.h"
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; } namespace Ui { class MainWindow; }
QT_END_NAMESPACE QT_END_NAMESPACE
class MainWindow : public QMainWindow class MainWindow : public QMainWindow
{ {
Q_OBJECT Q_OBJECT
@ -27,6 +25,7 @@ public:
void test(); void test();
static int sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigned int* len, void* param); static int sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigned int* len, void* param);
std::vector<std::string> get_devices(); std::vector<std::string> get_devices();
private slots: private slots:
void on_act_newDevice_triggered(); void on_act_newDevice_triggered();

View File

@ -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) 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 0;
return status;
} }
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) parameter* ui_helper::get_user_input(data_from from, value_type type, const wchar_t* title, const wchar_t* desc)

View File

@ -52,11 +52,10 @@ class ui_helper : public ref
public: public:
ui_helper(SANE_Handle dev); ui_helper();
public: public:
virtual ~ui_helper() virtual ~ui_helper()
{} {}
SANE_Handle dev_;
public: public:
enum data_from enum data_from

View File

@ -73,6 +73,9 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<IncludePath>..\..\..\sdk\include;C:\Users\modehua\Desktop\sane\code_production\app\HGProductionTool;$(IncludePath)</IncludePath> <IncludePath>..\..\..\sdk\include;C:\Users\modehua\Desktop\sane\code_production\app\HGProductionTool;$(IncludePath)</IncludePath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);..\..\..\sdk\include;C:\Users\modehua\Desktop\sane\code_production\app\HGProductionTool;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>

View File

@ -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;
}

View File

@ -2,6 +2,7 @@
#include "string" #include "string"
#include "sane/sane_ex.h" #include "sane/sane_ex.h"
#include "ui_helper.h" #include "ui_helper.h"
#include <Windows.h>
//////////////////////////////////////TITLE////////////////////////////////////// //////////////////////////////////////TITLE//////////////////////////////////////
/* 拨码开关校验 */ /* 拨码开关校验 */
#define HGPDTTOOLDB_TITLE_DIAL_SWITCH L"拨码开关校验" #define HGPDTTOOLDB_TITLE_DIAL_SWITCH L"拨码开关校验"