2022-12-15 03:00:46 +00:00
|
|
|
|
#include <Windows.h>
|
|
|
|
|
#include "sane/sane_ex.h"
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <vector>
|
|
|
|
|
#pragma once
|
|
|
|
|
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:
|
2022-12-15 06:05:53 +00:00
|
|
|
|
ui_helper();
|
2022-12-15 03:00:46 +00:00
|
|
|
|
public:
|
|
|
|
|
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,
|
2022-12-29 02:37:26 +00:00
|
|
|
|
VAL_TYPE_STRING,
|
2022-12-15 03:00:46 +00:00
|
|
|
|
VAL_TYPE_CUSTOM, // custom data, such as gamma table ...
|
2022-12-29 02:11:18 +00:00
|
|
|
|
VAL_TYPE_TIPS_VAL, // status info tips and data info
|
2022-12-15 03:00:46 +00:00
|
|
|
|
};
|
|
|
|
|
|
2022-12-29 02:11:18 +00:00
|
|
|
|
typedef struct _info// value_type == VAL_TUPE_TIPS
|
|
|
|
|
{
|
2022-12-29 02:37:26 +00:00
|
|
|
|
const wchar_t* desc; //data
|
2022-12-29 02:11:18 +00:00
|
|
|
|
const wchar_t* info; //info tips
|
|
|
|
|
}_INFOTIPS, * PINFOTIPS;
|
2022-12-15 03:00:46 +00:00
|
|
|
|
// 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
|
2022-12-26 10:38:34 +00:00
|
|
|
|
{
|
2022-12-28 04:04:50 +00:00
|
|
|
|
TEST_EVENT_TIPS = 0, // messages in testing process, data is (wchar_t*), flag is unused
|
|
|
|
|
TEST_EVENT_NOT_FIND_TEST, // dll. not find test ,data is (wchar_t*)description, flag is (false)
|
|
|
|
|
TEST_EVENT_IO_FAIL, // IO. err flag is SCANNER_ERR_DEVICE_NOT_SUPPORT or io err,data is null
|
2023-03-20 09:24:38 +00:00
|
|
|
|
TEST_EVENT_MANUAL_CONFIRMATION, // After send cmd ,need manual confirmation. struct_write_cfg
|
2022-12-28 04:04:50 +00:00
|
|
|
|
TEST_EVENT_RESULT, // test result, data is (wchar_t*)description, flag is (bool)result, true - test pass
|
|
|
|
|
TEST_EVENT_HAVE_IMAGE, // have image.
|
2023-01-05 09:46:52 +00:00
|
|
|
|
TEST_EVENT_DISTORTION_VAL, // get distortion_val, data is (float) data > 0 flag is true else false
|
2022-12-29 16:07:01 +00:00
|
|
|
|
TEST_EVENT_FALT_INFO, //
|
2023-02-15 11:40:08 +00:00
|
|
|
|
TEST_EVEB_GET_DEVICE_CONFIG_VIDPID, //get vid-pid; data is (int*) ;flag is (bool)result,true - get pass
|
|
|
|
|
TEST_EVEB_GET_DEVICE_CONFIG_SP, //get sp; data is (int*) ;flag is (bool)result,true - get pass
|
|
|
|
|
TEST_EVEB_GET_DEVICE_CONFIG_SLEEPTIME, //get sleeptime;data is (int*) ;flag is (bool)result,true - get pass
|
|
|
|
|
TEST_EVEB_GET_DEVICE_CONFIG_SN, //get sn ;data is (wchar*) ;flag is (bool)result,true - get pass
|
2023-03-06 03:45:01 +00:00
|
|
|
|
TEST_EVEB_GET_DEVICE_CONFIG_FW, //get fw ;data is (wchar*) ;flag is (bool)result,true - get pass
|
2023-03-20 04:11:00 +00:00
|
|
|
|
TEST_EVEB_GET_DEVICE_CONFIG_DEVS_MODEL, //get devs_model ;data is (wchar*) ;flag is (bool)result,true - get pass
|
2022-12-15 03:00:46 +00:00
|
|
|
|
};
|
|
|
|
|
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;
|
|
|
|
|
};
|