This commit is contained in:
parent
b9efee3bf4
commit
966f5cda46
|
@ -71,7 +71,7 @@
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<IncludePath>..\..\..\sdk\include;$(IncludePath)</IncludePath>
|
<IncludePath>..\..\..\sdk\include;C:\Users\modehua\Desktop\sane\code_production\app\HGProductionTool;$(IncludePath)</IncludePath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
|
|
|
@ -12,7 +12,6 @@ static struct Test_Map
|
||||||
const wchar_t* title; //"Íáб¼ì²â"
|
const wchar_t* title; //"Íáб¼ì²â"
|
||||||
const int ver;
|
const int ver;
|
||||||
io_code num;
|
io_code num;
|
||||||
|
|
||||||
}Test_Map_NO[] =
|
}Test_Map_NO[] =
|
||||||
{
|
{
|
||||||
{HGPDTTOOLDB_NAME_DIAL_SWITCH ,HGPDTTOOLDB_TITLE_DIAL_SWITCH ,0,IO_CTRL_CODE_BASE},
|
{HGPDTTOOLDB_NAME_DIAL_SWITCH ,HGPDTTOOLDB_TITLE_DIAL_SWITCH ,0,IO_CTRL_CODE_BASE},
|
||||||
|
@ -50,7 +49,7 @@ Test_Map_Bool[]
|
||||||
Test_Map_String[]
|
Test_Map_String[]
|
||||||
{
|
{
|
||||||
|
|
||||||
{HGPDTTOOLDB_NAME_CLEAR_ROLLER_COUNT ,HGPDTTOOLDB_TITLE_CLEAR_ROLLER_COUNT,0,IO_CTRL_CODE_SET_CLEAR_ROLLER_COUNT},
|
{L"123" ,HGPDTTOOLDB_TITLE_CLEAR_ROLLER_COUNT,0,IO_CTRL_CODE_SET_CLEAR_ROLLER_COUNT},
|
||||||
},
|
},
|
||||||
Test_Map_Int[]
|
Test_Map_Int[]
|
||||||
{
|
{
|
||||||
|
@ -66,7 +65,7 @@ Test_Map_Int[]
|
||||||
//test
|
//test
|
||||||
static std::string jsontext1("{\"1\":{\"name\":\"test-8\",\"ver\":1}}");
|
static std::string jsontext1("{\"1\":{\"name\":\"test-8\",\"ver\":1}}");
|
||||||
|
|
||||||
int sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigned int* len, void* param)
|
int sane_ex_callback1(SANE_Handle hdev, int code, void* data, unsigned int* len, void* param)
|
||||||
{
|
{
|
||||||
switch (code)
|
switch (code)
|
||||||
{
|
{
|
||||||
|
@ -153,6 +152,7 @@ int get_json_config_file()
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
std::cout << buf << std::endl;
|
std::cout << buf << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
int func_test_init(void* init)
|
int func_test_init(void* init)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -167,8 +167,8 @@ int func_test_go(const wchar_t* name, const wchar_t* oper, ui_helper* helper)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
helper->add_ref();
|
//helper->add_ref();
|
||||||
helper->register_sane_callback(sane_ex_callback, NULL);
|
helper->register_sane_callback(sane_ex_callback1, NULL);
|
||||||
|
|
||||||
bool flag = false;
|
bool flag = false;
|
||||||
wchar_t* des = NULL;
|
wchar_t* des = NULL;
|
||||||
|
@ -185,16 +185,15 @@ int func_test_go(const wchar_t* name, const wchar_t* oper, ui_helper* helper)
|
||||||
{
|
{
|
||||||
SANE_Bool map_bool = true;
|
SANE_Bool map_bool = true;
|
||||||
unsigned int len = sizeof(SANE_Bool);
|
unsigned int len = sizeof(SANE_Bool);
|
||||||
ret = helper->io_control(Test_Map_Bool[i].num,&map_bool, &len);
|
ret = helper->io_control(Test_Map_Bool[i].num,(void *)&map_bool, &len);
|
||||||
if (ret == SCANNER_ERR_OK)
|
if (ret == SCANNER_ERR_OK)
|
||||||
{
|
{
|
||||||
ev = ui_helper::TEST_EVENT_RESULT;
|
ev = ui_helper::TEST_EVENT_RESULT;
|
||||||
helper->test_callback(Test_Map_Bool[i].name, ev, des, true);
|
helper->test_callback(Test_Map_Bool[i].name, ev, des, true);
|
||||||
map_bool = false;
|
map_bool = false;
|
||||||
ret = helper->io_control(Test_Map_Bool[i].num, &map_bool, &len);
|
ret = helper->io_control(Test_Map_Bool[i].num, &map_bool, &len);
|
||||||
|
|
||||||
return SCANNER_ERR_OK;
|
|
||||||
}
|
}
|
||||||
|
return SCANNER_ERR_OK;
|
||||||
}
|
}
|
||||||
else if(wcscmp(name, Test_Map_String[i].name) == 0)
|
else if(wcscmp(name, Test_Map_String[i].name) == 0)
|
||||||
{
|
{
|
||||||
|
@ -209,8 +208,8 @@ int func_test_go(const wchar_t* name, const wchar_t* oper, ui_helper* helper)
|
||||||
return SCANNER_ERR_OK;
|
return SCANNER_ERR_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
helper->release();
|
//helper->release();
|
||||||
helper->unregister_sane_callback(sane_ex_callback);
|
//helper->unregister_sane_callback(sane_ex_callback);
|
||||||
return SCANNER_ERR_OK;
|
return SCANNER_ERR_OK;
|
||||||
}
|
}
|
||||||
int func_test_uninit(void* uninit)
|
int func_test_uninit(void* uninit)
|
||||||
|
@ -238,24 +237,3 @@ int main11()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
parameter* ui_helper::get_user_input(data_from from, value_type type, const wchar_t* title, const wchar_t* desc = NULL)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
int ui_helper::register_sane_callback(sane_callback cb, void* param)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int ui_helper::unregister_sane_callback(sane_callback cb)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int ui_helper::io_control(unsigned long code, void* data, unsigned* len)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
void ui_helper::test_callback(const wchar_t* name/*test name*/, test_event ev, void* data, size_t flag)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,7 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "string"
|
#include "string"
|
||||||
#include "sane/sane_ex.h"
|
#include "sane/sane_ex.h"
|
||||||
|
#include "ui_helper.h"
|
||||||
//////////////////////////////////////TITLE//////////////////////////////////////
|
//////////////////////////////////////TITLE//////////////////////////////////////
|
||||||
/* 拨码开关校验 */
|
/* 拨码开关校验 */
|
||||||
#define HGPDTTOOLDB_TITLE_DIAL_SWITCH L"拨码开关校验"
|
#define HGPDTTOOLDB_TITLE_DIAL_SWITCH L"拨码开关校验"
|
||||||
|
@ -146,95 +146,6 @@
|
||||||
/* 清除滚轴计数 */
|
/* 清除滚轴计数 */
|
||||||
#define HGPDTTOOLDB_NAME_CLEAR_ROLLER_COUNT L"test-35"
|
#define HGPDTTOOLDB_NAME_CLEAR_ROLLER_COUNT L"test-35"
|
||||||
|
|
||||||
class ref
|
|
||||||
{
|
|
||||||
volatile long ref_;
|
|
||||||
public:
|
|
||||||
ref() : ref_(1)
|
|
||||||
{}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual ~ref()
|
|
||||||
{}
|
|
||||||
|
|
||||||
public:
|
|
||||||
long add_ref(void)
|
|
||||||
{
|
|
||||||
return _InterlockedIncrement(&ref_);
|
|
||||||
}
|
|
||||||
long release(void)
|
|
||||||
{
|
|
||||||
long r = _InterlockedDecrement(&ref_);
|
|
||||||
|
|
||||||
if (r == 0)
|
|
||||||
delete this;
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class parameter : public ref
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
parameter()
|
|
||||||
{}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual ~parameter()
|
|
||||||
{}
|
|
||||||
|
|
||||||
public:
|
|
||||||
virtual size_t get_size(void) = 0;
|
|
||||||
virtual void* get_data(void) = 0; // return data pointer, bool*, int*, double*, (wchar_t*)
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class ui_helper : public ref
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ui_helper()
|
|
||||||
{}
|
|
||||||
protected:
|
|
||||||
virtual ~ui_helper()
|
|
||||||
{}
|
|
||||||
|
|
||||||
public:
|
|
||||||
enum data_from
|
|
||||||
{
|
|
||||||
DATA_FROM_KNOWN = 0, // pre-defined data name, i.e. resulotion, paper, bright, ...
|
|
||||||
DATA_FROM_USER, // need a window for user inputing
|
|
||||||
};
|
|
||||||
enum value_type
|
|
||||||
{
|
|
||||||
VAL_TYPE_BOOL = 0,
|
|
||||||
VAL_TYPE_INT,
|
|
||||||
VAL_TYPE_FLOAT,
|
|
||||||
VAL_TYPE_STRING,
|
|
||||||
VAL_TYPE_CUSTOM, // custom data, such as gamma table ...
|
|
||||||
};
|
|
||||||
|
|
||||||
// get testing parameter ...
|
|
||||||
virtual parameter* get_user_input(data_from from, value_type type
|
|
||||||
, const wchar_t* title // window title when from == DATA_FROM_USER, or parameter name when from == DATA_FROM_KNOWN
|
|
||||||
, const wchar_t* desc = NULL // description of the parameter if from was DATA_FROM_USER, unused in DATA_FROM_KNOWN
|
|
||||||
) = 0;
|
|
||||||
|
|
||||||
enum test_event
|
|
||||||
{
|
|
||||||
TEST_EVENT_TIPS = 0, // messages in testing process, data is (wchar_t*), flag is unused
|
|
||||||
TEST_EVENT_xxx, // should be complemented ...
|
|
||||||
TEST_EVENT_RESULT, // test result, data is (wchar_t*)description, flag is (bool)result, true - test pass
|
|
||||||
};
|
|
||||||
virtual void test_callback(const wchar_t* name/*test name*/, test_event ev, void* data, size_t flag) = 0;
|
|
||||||
|
|
||||||
// register/unregister sane callback, the sane_callback in UI module should dispatch the events to these registered callback
|
|
||||||
virtual int register_sane_callback(sane_callback cb, void* param) = 0;
|
|
||||||
virtual int unregister_sane_callback(sane_callback cb) = 0;
|
|
||||||
|
|
||||||
// All IO operations are blocking
|
|
||||||
virtual int io_control(unsigned long code, void* data, unsigned* len) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef TEST_DLL
|
#ifdef TEST_DLL
|
||||||
#define DECL_API(ret) __declspec(dllexport) ret __stdcall
|
#define DECL_API(ret) __declspec(dllexport) ret __stdcall
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue