mirror of http://192.168.1.51:8099/lmh188/twain3.0
365 lines
8.5 KiB
C++
365 lines
8.5 KiB
C++
#ifndef ICONFIG_H
|
||
#define ICONFIG_H
|
||
// !ICONFIG_H
|
||
#include <map>
|
||
#include "PublicFunc.h"
|
||
#include "PaperSize.h"
|
||
#define FOR_LANXUM
|
||
|
||
using u32 = unsigned int;
|
||
|
||
static std::map<PaperStatus, unsigned int> SupPaperTyps = {
|
||
#ifdef G200
|
||
#ifdef FOR_LANXUM
|
||
{{TwSS::A3,PaperAlign::Rot0},0},
|
||
{{TwSS::A4,PaperAlign::Rot0},1},
|
||
{{TwSS::A4,PaperAlign::Rot270},2},
|
||
{{TwSS::A5,PaperAlign::Rot0 },3},
|
||
{{TwSS::A5,PaperAlign::Rot270},4},
|
||
{{TwSS::A6,PaperAlign::Rot0},5},
|
||
{{TwSS::A6,PaperAlign::Rot270},6},
|
||
{{TwSS::B4,PaperAlign::Rot0},7},
|
||
{{TwSS::B5,PaperAlign::Rot0},8},
|
||
{{TwSS::B5,PaperAlign::Rot270},9},
|
||
{{TwSS::B6,PaperAlign::Rot0},10},
|
||
{{TwSS::B6,PaperAlign::Rot270},11},
|
||
{{TwSS::USLetter,PaperAlign::Rot0},14},
|
||
{{TwSS::USLedger,PaperAlign::Rot0},12},
|
||
{{TwSS::USLegal,PaperAlign::Rot0},13},
|
||
{{TwSS::None,PaperAlign::Rot0},0},
|
||
//#ifdef G1003399
|
||
// {{TwSS::USLetter,PaperAlign::Rot270},14},
|
||
// {{TwSS::USStatement,PaperAlign::Rot0},17},
|
||
// {{TwSS::MaxSize,PaperAlign::Rot0},19},
|
||
// {{TwSS::Trigeminy,PaperAlign::Rot0},17}
|
||
//#else
|
||
{ {TwSS::USLetter,PaperAlign::Rot270},15},
|
||
{{TwSS::USStatement,PaperAlign::Rot0},16},
|
||
{{TwSS::MaxSize,PaperAlign::Rot0},16},
|
||
{{TwSS::Trigeminy,PaperAlign::Rot0},16}
|
||
//#endif
|
||
#else
|
||
{{TwSS::A3,PaperAlign::Rot0},0},
|
||
{{TwSS::A4,PaperAlign::Rot0},1},
|
||
{{TwSS::A4,PaperAlign::Rot270},2},
|
||
{{TwSS::A5,PaperAlign::Rot0 },2},
|
||
{{TwSS::A5,PaperAlign::Rot270},2},
|
||
{{TwSS::A6,PaperAlign::Rot0},2},
|
||
{{TwSS::A6,PaperAlign::Rot270},2},
|
||
{{TwSS::B4,PaperAlign::Rot0},0},
|
||
{{TwSS::B5,PaperAlign::Rot0},0},
|
||
{{TwSS::B5,PaperAlign::Rot270},1},
|
||
{{TwSS::B6,PaperAlign::Rot0},2},
|
||
{{TwSS::B6,PaperAlign::Rot270},2},
|
||
{{TwSS::USLetter,PaperAlign::Rot0},1},
|
||
{{TwSS::USLetter,PaperAlign::Rot270},2},
|
||
{{TwSS::USLedger,PaperAlign::Rot0},0},
|
||
{{TwSS::USLegal,PaperAlign::Rot0},0},
|
||
{{TwSS::None,PaperAlign::Rot0},0},
|
||
{{TwSS::USStatement,PaperAlign::Rot0},16},
|
||
{{TwSS::MaxSize,PaperAlign::Rot0},16},
|
||
{{TwSS::Trigeminy,PaperAlign::Rot0},16}
|
||
#endif
|
||
#else
|
||
{{TwSS::A3,PaperAlign::Rot0},G400_A3},
|
||
{{TwSS::A4,PaperAlign::Rot0},G400_A4},
|
||
{{TwSS::A4,PaperAlign::Rot270},G400_A4R},
|
||
{{TwSS::A5,PaperAlign::Rot0 },G400_A5},
|
||
{{TwSS::A5,PaperAlign::Rot270},G400_A5R},
|
||
{{TwSS::A6,PaperAlign::Rot0},G400_A6},
|
||
{{TwSS::A6,PaperAlign::Rot270},G400_A6R},
|
||
{{TwSS::B4,PaperAlign::Rot0},G400_B4},
|
||
{{TwSS::B5,PaperAlign::Rot0},G400_B5},
|
||
{{TwSS::B5,PaperAlign::Rot270},G400_B5R},
|
||
{{TwSS::B6,PaperAlign::Rot0},G400_B6},
|
||
{{TwSS::B6,PaperAlign::Rot270},G400_B6R},
|
||
{{TwSS::USLetter,PaperAlign::Rot0},G400_LETTER},
|
||
{{TwSS::USLetter,PaperAlign::Rot270},G400_LETTERR},
|
||
{{TwSS::USLedger,PaperAlign::Rot0},G400_DOUBLELETTER},
|
||
{{TwSS::USLegal,PaperAlign::Rot0},G400_LEGAL},
|
||
#ifdef G300
|
||
{{TwSS::None,PaperAlign::Rot0},G400_A4},
|
||
#else // G300
|
||
{{TwSS::None,PaperAlign::Rot0},G400_A3},
|
||
#endif
|
||
{{TwSS::MaxSize,PaperAlign::Rot0},G400_LONGLETTER},
|
||
{{TwSS::USStatement,PaperAlign::Rot0},G400_LONGLETTER},
|
||
{{TwSS::Trigeminy,PaperAlign::Rot0},G400_LONGLETTER},
|
||
#endif
|
||
};
|
||
|
||
static std::map<unsigned short, unsigned int> SupPixelTypes = {
|
||
{0, 0},//bw
|
||
{1, 0},//gray
|
||
{2, 1},//color
|
||
};
|
||
|
||
static std::map<float, unsigned int> SupResolutions = {
|
||
{100.0f, 1},
|
||
{150.0f, 1},
|
||
{200.0f, 1},
|
||
{240.0f, 1},
|
||
{300.0f, 0},
|
||
{600.0f, 1} //<2F><>ʱ<EFBFBD>汾<EFBFBD><E6B1BE>1 ԭ<><D4AD><EFBFBD><EFBFBD>2
|
||
};
|
||
|
||
|
||
static std::map<BYTE, BYTE> secrewMaps = {
|
||
{1,0},
|
||
{2,1},
|
||
{3,2},
|
||
{4,3},
|
||
{5,4}
|
||
};
|
||
|
||
|
||
enum HGType
|
||
{
|
||
MtBoard = 1,
|
||
FPGA,
|
||
V4L2,
|
||
IMG,
|
||
AutoCorrect,
|
||
STOPSCAN,
|
||
};
|
||
|
||
struct HGEIntInfo
|
||
{
|
||
HGType From;
|
||
unsigned int Code;
|
||
unsigned int Img_Index;
|
||
};
|
||
|
||
#define USB_REQ_GET_FPGA_REGS 0x40
|
||
#define USB_REQ_SET_FPGA_REGS 0x41
|
||
#define USB_REQ_GET_MOTOR_REGS 0x42
|
||
#define USB_REQ_SET_MOTOR_REGS 0x43
|
||
|
||
#define USB_REQ_GET_DEV_STATUS 0x60
|
||
#define USB_REQ_GET_DEV_CONFIGURATION 0x61
|
||
#define USB_REQ_SET_DEV_CONFIGURATION 0x62
|
||
#define USB_REQ_GET_DEV_REGS 0x63
|
||
#define USB_REQ_SET_DEV_REGS 0x64
|
||
|
||
enum Scanner_Reg_Defs
|
||
{
|
||
SR_CMD,
|
||
SR_STATUS,
|
||
SR_SCAN_COUNT,
|
||
SR_OS,
|
||
SR_SENSORS,
|
||
SR_MOTOR,
|
||
SR_IM_TYPE,
|
||
SR_IM_COUNT,
|
||
SR_IM_TX,
|
||
SR_IM_FRONT_SIZE,
|
||
SR_IM_CLEAR,
|
||
SR_IM_TXING,
|
||
SR_IM_POP,
|
||
SR_IM_ABORT,
|
||
SR_COUNT,
|
||
SR_CONFIG_SCAN_PARAM,
|
||
SR_GET_FWVERSION,
|
||
SR_SET_FWERSION,
|
||
SR_GET_SERIALNUM,
|
||
SR_SET_SERIALNUM,
|
||
SR_CONFIF_IMGPROCPARAM,
|
||
SC_AUTOCORRECT,
|
||
SC_GET_CORRECT_PARAM,
|
||
SC_SET_CORRECT_PARAM,
|
||
SR_GET_H_RATIO,
|
||
SR_SET_H_RATIO,
|
||
SR_GET_V_RATIO,
|
||
SR_SET_V_RATIO,
|
||
SR_GET_SERIAL_LEN,
|
||
SR_GET_GRAY_SP,
|
||
SR_GET_COLOR_SP,
|
||
SR_SET_GRAY_SP,
|
||
SR_SET_COLOR_SP,
|
||
SR_SET_SLEEPTIME,
|
||
SR_GET_SLEEPTIME,
|
||
SR_GET_SLEEP_STAUTUS,
|
||
SR_GET_IMAGEPROCESSDONE,
|
||
SR_GET_KEEP_LAST_PAPER,
|
||
SR_GET_PAPERON,
|
||
SR_SET_SPEEDMODE,
|
||
SR_GET_SPEEDMODE,
|
||
SR_GET_JOSN_SIZE,
|
||
SR_GET_JSON,
|
||
SR_SET_JSON_PATH,
|
||
SR_SET_JSON,
|
||
SR_GET_FILE_POS,
|
||
SR_SET_FILE_POS,
|
||
SR_NOTIFY_SLEEP,
|
||
SR_GET_FEEDMODE,
|
||
SR_SET_FEEDMODE,
|
||
SR_GET_AUTOMATICCONTROLFEEDMODE_ENABLE,
|
||
SR_SET_AUTOMATICCONTROLFEEDMODE_ENABLE,
|
||
SR_GET_AUTOMATICCONTROLFEEDMODE_THRESHOLD,
|
||
SR_SET_AUTOMATICCONTROLFEEDMODE_THRESHOLD,
|
||
SR_GET_TRAYPOSITION,
|
||
SR_SET_TRAYPOSITION,
|
||
SR_GET_LOCK_STATES,
|
||
SR_SET_LOCK_STATES,
|
||
SR_GET_TOKEN,
|
||
SR_SET_TOKEN,
|
||
SR_GET_TOKEN_LENGHT,
|
||
SR_DECODE_TOKEN,
|
||
SR_GET_CUO_ERROR = 0x50,
|
||
SR_GET_DOU_ERROR,
|
||
SR_GET_JAM_ERROR,
|
||
SR_GET_SCANN_NUM,
|
||
SR_CLR_ROLLER_NUM,
|
||
SR_GET_ROLLER_NUM,
|
||
SR_CLR_SCANN_NUM,
|
||
SR_GET_H_200_RATIO,
|
||
SR_SET_H_200_RATIO,
|
||
SR_GET_V_200_RATIO,
|
||
SR_SET_V_200_RATIO,
|
||
SR_GET_H_300_RATIO,
|
||
SR_SET_H_300_RATIO,
|
||
SR_GET_V_300_RATIO,
|
||
SR_SET_V_300_RATIO,
|
||
SR_GET_H_600_RATIO,
|
||
SR_SET_H_600_RATIO,
|
||
SR_GET_V_600_RATIO,
|
||
SR_SET_V_600_RATIO,
|
||
SR_UPDATA_START = 0x100,
|
||
SR_UPDATA_STAUTUS = 0x101,
|
||
SR_UPDATA_MD5_RELUST = 0x102,
|
||
SR_UPDATA_RECOVERY = 0x103,
|
||
SR_UPDATA_REBOOT = 0x104,
|
||
SR_POWEROFF = 0x105,
|
||
SR_REBOOT = 0x106, //Heartbeat
|
||
SR_FLAT_CLR_MAX_BRIGHT,
|
||
SR_FLAT_GRAY_MAX_BRIGHT,
|
||
SR_KERNEL_VERSION_INFO_LENGTH,
|
||
SR_GET_KERNEL_VERSION,
|
||
SR_GET_MBSTATUS,
|
||
SR_GET_IPADDR_LENGHT = 0x200,
|
||
SR_GET_MACADDR,
|
||
SR_GET_IPADDR,
|
||
SR_GET_MBVERSION_LENGHT,
|
||
SR_GET_MBVERSION,
|
||
SR_GET_USBVIDPID,
|
||
SR_SET_USBVIDPID,
|
||
SR_SET_ANDROID_SCANCOUNT = 0x1000,
|
||
SR_GET_ANDROID_STATE = 0x1001,
|
||
|
||
};
|
||
|
||
enum Scanner_Cmd_Defs
|
||
{
|
||
SC_START,
|
||
SC_STOP,
|
||
SC_CLEAR,
|
||
SC_COUNT
|
||
};
|
||
|
||
typedef union HG_ImgProcParms
|
||
{
|
||
unsigned int value;
|
||
struct
|
||
{
|
||
u32 papertype : 5;
|
||
u32 scanside : 3;
|
||
u32 res : 10;
|
||
u32 rotate : 2;
|
||
u32 autodescrew : 1;
|
||
u32 fillbackground : 1;
|
||
u32 filter : 4;
|
||
u32 enhancecolor : 2;
|
||
u32 fillhole : 1;
|
||
u32 reversed : 3;
|
||
}imgprocparams;
|
||
}HGImgProcParms;
|
||
|
||
|
||
///<2F><><EFBFBD><EFBFBD>CIS <20>Զ<EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
typedef struct
|
||
{
|
||
u32 gainF[6];
|
||
u32 gainB[6];
|
||
u32 offsetsF[6];
|
||
u32 offsetsB[6];
|
||
u32 expF[3];
|
||
u32 expB[3];
|
||
u32 sp;
|
||
}HGCISConfig;
|
||
|
||
|
||
typedef struct
|
||
{
|
||
HGCISConfig colorCorrect;
|
||
HGCISConfig color;
|
||
HGCISConfig grayCorrect;
|
||
HGCISConfig gray;
|
||
}HGCorrectConfigs;
|
||
|
||
typedef union Config_Param {
|
||
unsigned int value;
|
||
struct {
|
||
unsigned int paper : 5;
|
||
unsigned int color : 1;
|
||
unsigned int dpi : 2;
|
||
unsigned int double_feed_enbale : 1;
|
||
unsigned int stable_enbale : 1;
|
||
unsigned int screw_detect_enable : 1;
|
||
unsigned int screw_detect_level : 3;//<2F><>ʮ<EFBFBD><CAAE>λ
|
||
unsigned int unused_one : 6;
|
||
unsigned int pc_correct : 1;
|
||
unsigned int enable_sizecheck : 1;
|
||
unsigned int enabledsp_cache : 1;
|
||
unsigned int lowpowermode : 3;
|
||
unsigned int sizeerror_errorratio : 6;
|
||
};
|
||
} ConfigParam;
|
||
|
||
typedef union HG_ScanConfig
|
||
{
|
||
unsigned int value;
|
||
struct
|
||
{
|
||
unsigned int paper : 5;
|
||
unsigned int color : 1;
|
||
unsigned int dpi : 2;
|
||
unsigned int double_feed_enbale : 1;
|
||
unsigned int stable_enbale : 1;
|
||
unsigned int screw_detect_enable : 1;
|
||
unsigned int screw_detect_level : 3;//<2F><>ʮ<EFBFBD><CAAE>λ
|
||
unsigned int iscorrect_mod : 1;
|
||
unsigned int is_autopaper : 1;
|
||
unsigned int is_textcorrect : 1;
|
||
unsigned int is_fixedpaper : 1;
|
||
unsigned int en_anlogic_key : 1;
|
||
unsigned int en_autosize : 1;
|
||
unsigned int pc_correct : 1;
|
||
unsigned int enable_sizecheck : 1;
|
||
unsigned int enabledsp_cache : 1;
|
||
unsigned int sizeerror_errorratio : 9;
|
||
}g200params;
|
||
struct
|
||
{
|
||
unsigned int pageSize : 5;
|
||
unsigned int isColor : 1;
|
||
unsigned int dpi : 2;
|
||
unsigned int doubleFeeded : 1;
|
||
unsigned int enableStable : 1;
|
||
unsigned int enableLed : 1;
|
||
unsigned int reversed1 : 6;
|
||
unsigned int isCorrect : 1;
|
||
unsigned int dstHeight : 8;
|
||
unsigned int reversed2 : 6;
|
||
}g400params;
|
||
}HGScanConfig;
|
||
|
||
class IConfig
|
||
{
|
||
public:
|
||
IConfig(void) {};
|
||
virtual ~IConfig(void) {};
|
||
virtual unsigned int GetData()=0;
|
||
protected:
|
||
};
|
||
#endif
|