#ifndef _MH_H_
#define _MH_H_
#pragma pack (8) 
/********************************/
/* BiMultiFunction              */
/********************************/
// Message ID
#define WM_MF_DONE						(WM_USER +1)
#define WM_MF_PROGRESS					(WM_USER +2)

// wParam
#define MF_MACRO_GETUNITID(wParam)		LOBYTE(HIWORD(wParam))
#define MF_MACRO_GETPHASE(wParam)		LOBYTE(LOWORD(wParam))
#define MF_MACRO_GETFACE(lParam)		LOBYTE(HIWORD(lParam))
#define MF_MACRO_PERCENT(lParam)		LOBYTE(LOWORD(lParam))

#define MF_PHASE_INIT					0
#define MF_PHASE_MICR					1
#define MF_PHASE_SCAN					2
#define MF_PHASE_PRINT					3
#define MF_PHASE_EXIT					4

#define MF_PROGRESS_START				0
#define MF_PROGRESS_DONE				100
#define MF_PROGRESS_WAIT_PAPER			101
#define MF_PROGRESS_CLUMP_PAPER			102
#define MF_PROGRESS_PAPER_PILED			103

// Function define
#define MF_EXEC							0x0000
#define MF_CONTINUE						0x0001
#define MF_MICR_RETRANS					0x0002
#define MF_SCAN_FRONT_RETRANS			0x0003
#define MF_SCAN_BACK_RETRANS			(MF_SCAN_FRONT_RETRANS + 1)

#define MF_SET_BASE_PARAM				0x0010
#define MF_SET_MICR_PARAM				0x0011
#define MF_SET_SCAN_FRONT_PARAM			0x0012
#define MF_SET_SCAN_PARAM				0x0012
#define MF_SET_SCAN_BACK_PARAM			(MF_SET_SCAN_FRONT_PARAM + 1)
#define MF_SET_PRINT_PARAM				0x0014

#define MF_CLEAR_BASE_PARAM				0x0020
#define MF_CLEAR_MICR_PARAM				0x0021
#define MF_CLEAR_SCAN_FRONT_PARAM		0x0022
#define MF_CLEAR_SCAN_PARAM				0x0022
#define MF_CLEAR_SCAN_BACK_PARAM		(MF_CLEAR_SCAN_FRONT_PARAM + 1)
#define MF_CLEAR_PRINT_PARAM			0x0024

#define	MF_GET_BASE_DEFAULT				0x0030
#define	MF_GET_MICR_DEFAULT				0x0031
#define	MF_GET_SCAN_DEFAULT				0x0032
#define	MF_GET_SCAN_FRONT_DEFAULT		0x0032
#define	MF_GET_SCAN_BACK_DEFAULT		(MF_GET_SCAN_FRONT_DEFAULT + 1)
#define	MF_GET_PRINT_DEFAULT			0x0034

/**********************/
/* Base parameters    */
/**********************/
// Version define
#define MF_FIRST_VERSION				0x0100
#define MF_BASE_VERSION01				0x0101
#define MF_BASE_VERSION					0x0100

// Message method
#define MF_BASE_MESSAGE_NO_MESSAGE		1
#define MF_BASE_MESSAGE_EVENT			2
#define MF_BASE_MESSAGE_HWND			3
#define MF_BASE_MESSAGE_BUTTON_CLICK	4
#define MF_BASE_MESSAGE_NOTIFY_MAX		MF_BASE_MESSAGE_BUTTON_CLICK

#define MF_BASE_TIMEOUT_MAX				300		// 5 min
#define MF_BASE_TIMEOUT_DEFAULT			0		// INFINIT

// NV Memory
#define MF_BASE_NVMEMORY_NOT_USE		0
#define MF_BASE_NVMEMORY_USE			1

// Eject Type when error occured
#define	MF_EJECT_DISCHARGE			0x0000
#define	MF_EJECT_RELEASE			0x0001
#define	MF_EXIT_ERROR_DISCHARGE		MF_EJECT_DISCHARGE
#define	MF_EXIT_ERROR_RELEASE		MF_EJECT_RELEASE
#define	MF_EXIT_SUCCESS_DISCHARGE	MF_EJECT_DISCHARGE
#define	MF_EXIT_SUCCESS_RELEASE		MF_EJECT_RELEASE
#define	MF_EXIT_ERROR_CONTINUE_DISCHARGE	0x0010	// MICR Error 05.07.05 ADD
#define	MF_EXIT_ERROR_CONTINUE_RELEASE		0x0011	// MICR Error 05.07.05 ADD

#define	MF_BUZZER_TYPE_SUCCESS		0
#define	MF_BUZZER_TYPE_ERROR		1
#define	MF_BUZZER_TYPE_WFEED		2
#define	MF_BUZZER_TYPE_MAX			3

#define	MF_BUZZER_HZ_4000			0
#define	MF_BUZZER_HZ_440			1
#define	MF_BUZZER_HZ_880			2

#define	MF_BUZZER_DISABLE			0
#define	MF_BUZZER_COUNT_MAX			3

// Structure (Version 0x0101)
typedef struct {
// Base Section
	int iSize;
	int iVersion;
	int iRet;
	DWORD dwNotifyType;
	DWORD dwTimeout;
	union {
		LPHANDLE lphNotifyEvent;
		HWND hNotifyWnd;
	} uNotifyHandle;
	HWND hProgressWnd;
	WORD wErrorEject;
	BYTE bBuzzerHz[MF_BUZZER_TYPE_MAX];
	BYTE bBuzzerCount[MF_BUZZER_TYPE_MAX];
	BYTE bUseNVMemory;
	char cPortName[256];
	WORD wSuccessEject;
} MF_BASE01, *LPMF_BASE01;

// Structure (OLD:Version 0x0100)
typedef struct {
// Base Section
	int iSize;
	int iVersion;
	int iRet;
	DWORD dwNotifyType;
	DWORD dwTimeout;
	union {
		LPHANDLE lphNotifyEvent;
		HWND hNotifyWnd;
	} uNotifyHandle;
	HWND hProgressWnd;
	WORD wErrorEject;
	BYTE bBuzzerHz[MF_BUZZER_TYPE_MAX];
	BYTE bBuzzerCount[MF_BUZZER_TYPE_MAX];
	BYTE bUseNVMemory;
	char cPortName[256];
} MF_BASE, *LPMF_BASE;

/**********************/
/* MICR parameters    */
/**********************/
// Version define
#define MF_MICR_VERSION					0x0100

// MICR type
#define MF_MICR_USE_MICR				1
#define MF_MICR_USE_OCR					2

// Font
#define MF_MICR_FONT_E13B				0
#define MF_MICR_FONT_CMC7				1

#define MF_MICR_CHAR_MAX				81
#define MF_MICR_CHAR_LEN				80

// Structure
typedef struct{
	CHAR cRecogChar;		// 
	LONG lPercentage;		// 
} MF_OCR_RELIABILITY;

typedef struct{
	LONG				lPosition;		// 
	MF_OCR_RELIABILITY	stFirstSelect;	// 
	MF_OCR_RELIABILITY	stSecondSelect;	// 
} MF_OCR_RELIABLE_INFO;

typedef struct{
// MIC_OCR Section
	int iSize;
	int iVersion;
	int iRet;
	BYTE bFont;
	BYTE bMicOcrSelect;
	BOOL blParsing;

	BYTE	bStatus;
	BYTE	bDetail;
	CHAR szMicrStr[MF_MICR_CHAR_MAX];
	MF_OCR_RELIABLE_INFO stOcrReliableInfo[MF_MICR_CHAR_MAX];
	CHAR	szAccountNumber[MF_MICR_CHAR_MAX];
	CHAR	szAmount[MF_MICR_CHAR_MAX];
	CHAR	szBankNumber[MF_MICR_CHAR_MAX];
	CHAR	szSerialNumber[MF_MICR_CHAR_MAX];
	CHAR	szEPC[MF_MICR_CHAR_MAX];
	CHAR	szTransitNumber[MF_MICR_CHAR_MAX];
	long	lCheckType;
	long	lCountryCode;
} MF_MICR, *LPMF_MICR;

/**********************/
/* Scan parameters    */
/**********************/
// Version define
#define MF_SCAN_VERSION					0x0100

// Scan face
#define MF_SCAN_FACE_FRONT				0
#define MF_SCAN_FACE_BACK				1
#define MF_SCAN_FACE_BOTH				2

#define MF_SCAN_DPI_DEFAULT				0
#define MF_SCAN_DPI_100					100
#define MF_SCAN_DPI_200					200

// Structure
typedef struct{
// Scan Section
	int iSize;
	int iVersion;
	int iRet;
	WORD wImageID;
	short sResolution;
	BYTE bAddInfoDataSize;
	LPBYTE pAddInfoData;
	BYTE bStatus;
	BYTE bDetail;
	DWORD dwXSize;
	DWORD dwYSize;
	DWORD dwScanSize;
	LPBYTE lpbScanData;
} MF_SCAN, *LPMF_SCAN;

/**********************/
/* Print parameters   */
/**********************/
// Version define
#define MF_PRINT_VERSION				0x0100

// Line
#define MF_PRINT_LINE_1					0
#define MF_PRINT_LINE_2					1
#define MF_PRINT_LINE_3					2
#define MF_PRINT_LINE_MAX				MF_PRINT_LINE_3

// Charactor attribute
#define MF_PRINT_NO_ATTRIBUTE			0x00000000
#define MF_PRINT_BOLD					0x00000001
#define MF_PRINT_UNDERLINE_1			0x00000010
#define MF_PRINT_UNDERLINE_2			0x00000020
#define MF_PRINT_BLACK					0x00000100
#define MF_PRINT_1ST_COLOR				0x00000100
#define MF_PRINT_COLOR					0x00000200
#define MF_PRINT_2ND_COLOR				0x00000200
#define MF_PRINT_MIXED					0x00000300

// Font type
#define MF_PRINT_FONT_A					1
#define MF_PRINT_FONT_B					2

// Font size
#define MF_PRINT_FONT_W1_H1				0x0011
#define MF_PRINT_FONT_W1_H2				0x0012
#define MF_PRINT_FONT_W2_H1				0x0021
#define MF_PRINT_FONT_W2_H2				0x0022

// ˆóŽš‘¬“x
#define	MF_PRINT_SPEED_NORMAL			0
#define	MF_PRINT_SPEED_HIGH				1
#define	MF_PRINT_SPEED_ECONOMY			2

// Other
#define MF_PRINT_DERECTION_DOUBLE		0
#define MF_PRINT_DERECTION_SINGLE		1

// Structure
typedef struct{
// Print Section
	int iSize;
	int iVersion;
	int iRet;
	BOOL blElectricEndorse;
	LPSTR lpString[3];
	DWORD dwAttribute[3];
	WORD wFont[3];
	WORD wFontSize[3];
	BYTE bSpeed;
	BOOL bDirection;
} MF_PRINT, *LPMF_PRINT;


/********************************/
/* BiMICRResultBeep             */
/********************************/
// define
#define MICR_BEEP_SUCCESS				0
#define MICR_BEEP_ERROR					1
#define MICR_BEEP_PAPER					2
#define MICR_BEEP_LOW					0
#define MICR_BEEP_HIGH					1
#define MICR_BEEP_COUNT_MAX				3
#pragma pack()
#endif