/*++

Copyright (c) 2013 Seiko Instruments Inc.
All rights reserved.

Module Name:

    DllFunc.h

Abstract:

    Header file for dynamic library functions

Author:

Revision History:

--*/

#pragma once




/*	Define callback finction	*/
typedef INT (CALLBACK EXPORT *FNC_CB_STATUS)(DWORD);

/*	Define finction type		*/
typedef INT (WINAPI *F_RpOpenMonPrinter)(INT,LPCTSTR);
typedef INT (WINAPI *F_RpCloseMonPrinter)(INT);

typedef INT (WINAPI *F_RpLockPrinter)(INT,DWORD);
typedef INT (WINAPI *F_RpUnlockPrinter)(INT);

typedef INT (WINAPI *F_RpDirectIO)(INT,BYTE,LPBYTE,LPBYTE,LPBYTE,DWORD,BOOL);
typedef INT (WINAPI *F_RpDirectIOEx)(INT,DWORD,LPBYTE,LPDWORD,LPBYTE,DWORD,BOOL,BYTE);

typedef INT (WINAPI *F_RpResetPrinter)(INT);

typedef INT (WINAPI *F_RpGetStatus)(INT,LPDWORD);
typedef INT (WINAPI *F_RpSetStatusBackFunction)(INT,FNC_CB_STATUS);
typedef INT (WINAPI *F_RpSetStatusBackWnd)(INT,HANDLE,LPDWORD);
typedef INT (WINAPI *F_RpCancelStatusBack)(INT);

typedef INT (WINAPI *F_RpPowerOff)(INT);
typedef INT (WINAPI *F_RpGetCounter)(INT,WORD,LPDWORD);
typedef INT (WINAPI *F_RpResetCounter)(INT,WORD);
typedef INT (WINAPI *F_RpGetType)(INT,LPBYTE,LPBYTE,LPBYTE,LPBYTE);
typedef INT (WINAPI *F_RpGetPrnCapability)(INT,BYTE,LPBYTE,LPBYTE);
typedef INT (WINAPI *F_RpOpenDrawer)(INT,BYTE,BYTE);

typedef INT (WINAPI *F_RpSendDataFile)(INT,LPCTSTR);
typedef INT (WINAPI *F_RpDirectSendRead)(INT,LPCTSTR,LPCTSTR,LPDWORD,LPBYTE,DWORD,BOOL);

typedef INT (WINAPI *F_RpGetProperty)(INT,LPDEVMODE,BYTE,LPBYTE,LPDWORD);
typedef INT (WINAPI *F_RpSetProperty)(INT,LPDEVMODE,BYTE,LPBYTE,LPDWORD);


/*	Define function macros		*/
#if defined(UNICODE)
#define PFN_OPEN				((F_RpOpenMonPrinter)GetProcAddress( hModule, "RpOpenMonPrinterW"))
#define PFN_SEND_DATA_FILE		((F_RpSendDataFile)GetProcAddress( hModule, "RpSendDataFileW"))
#define PFN_DIRECT_SEND_READ	((F_RpDirectSendRead)GetProcAddress( hModule, "RpDirectSendReadW"))
#else
#define PFN_OPEN				((F_RpOpenMonPrinter)GetProcAddress( hModule, "RpOpenMonPrinterA"))
#define PFN_SEND_DATA_FILE		((F_RpSendDataFile)GetProcAddress( hModule, "RpSendDataFileA"))
#define PFN_DIRECT_SEND_READ	((F_RpDirectSendRead)GetProcAddress( hModule, "RpDirectSendReadA"))
#endif

#define PFN_CLOSE				((F_RpCloseMonPrinter)GetProcAddress( hModule, "RpCloseMonPrinter"))

#define PFN_LOCK				((F_RpLockPrinter)GetProcAddress( hModule, "RpLockPrinter"))
#define PFN_UNLOCK				((F_RpUnlockPrinter)GetProcAddress( hModule, "RpUnlockPrinter"))

#define PFN_DIRECTIO			((F_RpDirectIO)GetProcAddress( hModule, "RpDirectIO"))
#define PFN_DIRECTIO_EX			((F_RpDirectIOEx)GetProcAddress( hModule, "RpDirectIOEx"))

#define PFN_RESET				((F_RpResetPrinter)GetProcAddress( hModule, "RpResetPrinter"))

#define PFN_GET_STATUS			((F_RpGetStatus)GetProcAddress( hModule, "RpGetStatus"))
#define PFN_SET_CALLBACK_STATUS	((F_RpSetStatusBackFunction)GetProcAddress( hModule, "RpSetStatusBackFunction"))
#define PFN_SET_CALLBACK_WND	((F_RpSetStatusBackWnd)GetProcAddress( hModule, "RpSetStatusBackWnd"))
#define PFN_SET_CALLBACK_CANCEL	((F_RpCancelStatusBack)GetProcAddress( hModule, "RpCancelStatusBack"))

#define PFN_SET_POWEROFF		((F_RpPowerOff)GetProcAddress( hModule, "RpPowerOff"))
#define PFN_GET_COUNTER			((F_RpGetCounter)GetProcAddress( hModule, "RpGetCounter"))
#define PFN_RESET_COUNTER		((F_RpResetCounter)GetProcAddress( hModule, "RpResetCounter"))
#define PFN_GET_TYPE			((F_RpGetType)GetProcAddress( hModule, "RpGetType"))
#define PFN_GET_CAPABILITY		((F_RpGetPrnCapability)GetProcAddress( hModule, "RpGetPrnCapability"))
#define PFN_OPEN_DRAWER			((F_RpOpenDrawer)GetProcAddress( hModule, "RpOpenDrawer"))

#define PFN_GET_PROPERTY		((F_RpGetProperty)GetProcAddress( hModule, "RpGetProperty"))
#define PFN_SET_PROPERTY		((F_RpSetProperty)GetProcAddress( hModule, "RpSetProperty"))


// status define
#define ASB_VP_ERR					0x00000001
#define ASB_HEAD_ERR				0x00000002		// RP-E10
#define ASB_HARDWARE_ERR			0x00000002
#define ASB_HEAD_TEMPERATUR_ERR		0x00000004
#define ASB_AUTOCUTTER_ERR			0x00000008
#define ASB_RECEIPT_END				0x00000010
#define ASB_COVER_OPEN				0x00000080
#define ASB_PAPER_FEED				0x00000100
#define ASB_NOW_PRINTING			0x00000400
#define ASB_RETURN_WAITING			0x00000800
#define ASB_DRAWER_KICK				0x00008000
#define ASB_FLASH_MEMORY_REWRITING	0x00010000
#define ASB_PERIPHERAL_EQUIPMENT	0x00020000
#define ASB_HARD_ERR1				0x00100000
#define ASB_HARD_ERR2				0x00200000
#define ASB_HARD_ERR3				0x00400000
#define ASB_HARD_ERR4				0x00800000
#define ASB_AUTORECOVER_ERR			0x20000000      
#define ASB_UNRECOVER_ERR			0x40000000      
#define ASB_NO_RESPONSE				0x80000000



BOOL LoadDll();
VOID UnloadDll();

BOOL OpenSamp(LPTSTR);
VOID WriteSamp();
VOID ReadSamp();
VOID CallbackSamp(BOOL);


