
#define MSG_RECEIVE_CHECK    _T("WOOSIM_PRT_OK")

/****************************************************************************
	CONST DEFINE
****************************************************************************/
//Message used in Protocol mode
#define NACK				0x15			//
#define DATA				0x44			// 
#define STATUS_ANSWER		0x53			//Response of printer status


//Set buffer size
#define BUFF_SIZE				0x19000		// Buffer size

//Return Message
#define SUCCESS									1
#define ALREADY_OPENED							-1
#define TIMEOUT									-7
#define NOT_OPEN_THE_PORT						-11

//Serial, Bluetooth Err message
#define UNABLE_TO_OPEN_THE_PORT					-2
#define UNABLE_TO_CONFIGURE_THE_SERIAL_PORT		-3 
#define UNABLE_TO_SET_THE_TIMEOUT_PARAMETERS	-4

//Wireless Err message
#undef SOCKET_ERROR
#define SOCKET_ERROR							-2
#define CONNECT_FAIL							-3

//USB Err message
#define UNABLE_TO_MAKE_CONNECTION				-2
#define UNABLE_TO_GET_INFOMATION				-3 
#define NOT_WOOSIM_PRINTER						-4

enum Barcode: int
{
	UPCA=65,
	UPCE,
	EAN13,
	EAN8,
	CODE39,
	ITF,
	CODABAR,
	CODE93,
	CODE128
};

enum WIDTH: int
{
	_1INCH=192,
	_2INCH=384,
	_3INCH=576,
	_4INCH=768
};

enum MCU: int
{
	M16C = 0,
	ARM,
	RX
};

enum TEXTWIDTH: BYTE
{
	TEXTWIDTH01 = 0x00,
	TEXTWIDTH02,
	TEXTWIDTH03,
	TEXTWIDTH04,
	TEXTWIDTH05,
	TEXTWIDTH06,
	TEXTWIDTH07,
	TEXTWIDTH08
};

enum TEXTHIGHT: BYTE
{
	TEXTHIGHT01 = 0x00,
	TEXTHIGHT02,
	TEXTHIGHT03,
	TEXTHIGHT04,
	TEXTHIGHT05,
	TEXTHIGHT06,
	TEXTHIGHT07,
	TEXTHIGHT08
};
/****************************************************************************
	END 
****************************************************************************/



/****************************************************************************
	IMPORT
****************************************************************************/

class CWoosimPrinter
{
	public:
		//1. Printable Data Handling APIs
		static void ClearSpool();
		static void CompressedBmpSaveSpool(char *bmpFilePath); 
		static int ControlCommand(BYTE *Cmds, int iLength);
		static void DataMatrixSaveSpool(int width, int height, int module, char *barcodeData);
		static void GS1DatabarSaveSpool(int type, int n, char * barcodeData);
		static void LoadLogoSaveSpool(int n);
		static void MaxicodeSaveSpool(int mode, char *barcodeData);
		static void MicroPDF417SaveSpool(int width, int column, int row, int ratio, char *barcodeData, BOOL HRI);
		static void NormalBmpSaveSpool(char* bmpFilePath);
		static void OneDimensionBarcodeSaveSpool(BYTE ucBarcodeType,
													int ucBarWidth, int ucBarHeight, BOOL HRI_On, char* barcodeData);
		static void Page_DotFeed(int dots);
		static void Page_DrawBox(int iXPos, int iYPos, int width, int height, int thickness);
		static void Page_DrawEllipse(int iXPos, int iYPos, int A_length, int B_length, int thickness);
		static void Page_DrawLine(int iXPos, int iYPos, int iX2Pos, int iY2Pos, int thickness);
		static void Page_LineFeed(int lines);
		static void Page_Newline();	
		static void Page_Print();
		static void Page_Print_StandardMode();
		static void PDF417SaveSpool(int width, int column, int level, int ratio, char *barcodeData, BOOL HRI);
		static void PrintData();
		static void PrintDotFeed(int dots);
		static void PrintLineFeed(int lines);
		static int PrintSpool(BOOL bDelete_Spool = TRUE);
		static int PrintSpoolForTTF(char* sData,BYTE iXFontSize, BYTE iYFontSize);
		static void QRCodeSaveSpool(int version, char level, int module, char *barcodeData);
		static void TextSaveSpool(char *textData);
		static void TruncatedPDF417SaveSpool(int width, int column, int level, int ratio, char *barcodeData, BOOL HRI)	;

		//2. Printer Mode & Setting APIs
		static void GetPrinterModelName();
		static void GetFirmwareVersion();
		static int GetPrinterStatus(int iTimeoutMsec);
		static int GetPrinterStatusEx(int iTimeoutMsec);
		static void InitLineSpace();
		static void InitPageMode(int iXPos, int iYPos, int width, int height);
		static void InitPrinterStatus();
		static void Page_ClearCurrentData();
		static void Page_SetArea(int iXPos,int iYPos, int width, int height);
		static void Page_SetDirection(int n);
		static void Page_SetPosition(int iXPos, int iYPos);
		static void Page_SetStandardMode();
		static void SetAbsPosition(int distance);
		static void SetCharCodeTable(int n, int MCU);
		static void SetCharSpace(int n);
		static void SetFontForTTF(char *ttfFile);
		static void SetFontSize(int n);
		static void SetLineSpace(int n);
		static void SetPageMode();
		static void SetTextAlignment(int n);
		static void SetTextStyle(int underline, BOOL emphasize, int width, int height, BOOL reverse);
		static void SetUpsideDown(BOOL set);

		//3. Misc. Device Handling APIs
		static void CancelMSRMode();
		static BOOL ClosePrinterConnection();
		static void CancelSCRMode();
		static int ConnectSerialPrinter(char *sPortName, int iBaudRate=57600,int iTimeoutMsec=200, BOOL bProtocol=FALSE);
		static int ConnectUSBPrinter(int iTimeoutMsec, BOOL Protocol);
		static int ConnectWirelessPrinter(char *sIP_ADDR, int iPortNum, int iTimeoutMsec, BOOL bProtcol = FALSE);
		static void CutPaper(int mode);
		static void EnterMSRMode(int n);
		static void EnterSCRMode();
		static void FeedToMark();
		static void SetPositionFromMark(int distance);
};


