//////////////////////////////////////////////////////////////////////////
//Export Function
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#include "mPOSConst.h"
#include "MPosControllerDevices.h"

typedef int  (__stdcall *pPrintText)(int bgtId, LPCWSTR data, int fontType, int fontWidth, int fontHeight, int bold, int underline, int reverse, int alignment);
typedef int  (__stdcall *pPrintBitmapFile)(int bgtId, LPCWSTR filename, int width, int alignment, int brightness, BOOL isDithering, BOOL isCompress);
typedef int  (__stdcall *pPrintImageFile)(int bgtId, LPCWSTR filename, int width, int alignment, int threshold, int ditheringType, int compressType);
typedef int  (__stdcall *pPrintImage)(int bgtId, char* image, int imageLength, int width, int alignment, int threshold, int ditheringType, int compressType);
typedef int  (__stdcall *pPrintBase64Image)(int bgtId, LPCWSTR base64String, int width, int alignment, int threshold, int ditheringType, int compressType);

typedef int  (__stdcall *pPrint1DBarcode)(int bgtId, LPCWSTR data, int symbology, int barWidth, int height, int alignment, int textPosition);
typedef int  (__stdcall *pPrintQRCode)(int bgtId, LPCWSTR data, int model, int alignment, int moduleSize, int eccLevel);
typedef int  (__stdcall *pPrintPDF417)(int bgtId, LPCWSTR data, int symbol, int alignment, int columnNumber, int rowNumber, int moduleWidth, int moduleHeight, int eccLevel);
typedef int  (__stdcall *pPrintDataMatrix)(int bgtId, LPCWSTR data, int alignment, int moduleSize);
typedef int  (__stdcall *pPrintGS1Databar)(int bgtId, LPCWSTR data, int symbol, int alignment, int size);
typedef int  (__stdcall *pPrintGS1DatabarMobile)(int bgtId, LPCWSTR data, int symbol, int alignment, int moduleWidth, int moduleHeight, int segmentHeight, int separatorHeight);
typedef int  (__stdcall *pPrintCompositeSymbology)(int bgtId, LPCWSTR data, LPCWSTR cData, int symbol, int cSymbol, int alignment, int size);
typedef int  (__stdcall *pPrintMaxicode)(int bgtId, LPCWSTR data, int mode, int alignment);
typedef int  (__stdcall *pPrintAztec)(int bgtId, LPCWSTR data, int alignment, int moduleSize, int eccLevel, int mode);

typedef int  (__stdcall *pSetCharacterset)(int bgtId, int codepage);
typedef int  (__stdcall *pSetInternationalCharacterset)(int bgtId, int internationalCharset);
typedef int  (__stdcall *pCutPaper)(int bgtId, int cutType);

typedef int  (__stdcall *pSetPagemode)(int bgtId, int mode);
typedef int  (__stdcall *pSetPagemodePrintArea)(int bgtId, int x, int y, int width, int height);
typedef int  (__stdcall *pSetPagemodeDirection)(int bgtId, int direction);
typedef int  (__stdcall *pSetPagemodePosition)(int bgtId, int x, int y);
typedef int  (__stdcall *pPrintLine)(int bgtId, int x1, int y1, int x2, int y2, int thickness);
typedef int  (__stdcall *pPrintBox)(int bgtId, int left, int top, int right, int bottom, int thickness);

typedef int  (__stdcall *pasbEnable)(int bgtId, bool enable);
typedef LPCTSTR  (__stdcall *pgetModelName)(int bgtId);
typedef LPCTSTR  (__stdcall *pgetFirmwareVersion)(int bgtId);

typedef int	 (__stdcall *pDisplayString)(int bgtId, LPCTSTR data, int codePage, int internationalCharacterSet, int line);
typedef int	 (__stdcall *pClearScreen)(int bgtId);
typedef int	 (__stdcall *pStoreImageFile)(int bgtId, LPCTSTR filename, int width, int imageNumber);
typedef int	 (__stdcall *pDisplayImage)(int bgtId, int imageNumber, int xPos, int yPos);
typedef int	 (__stdcall *pClearImage)(int bgtId, int imageNumber);
typedef int	 (__stdcall *pShowCursor)(int bgtId, int cursor);

class CMPosControllerPrinter : public CMPosControllerDevices
{
public:
	CMPosControllerPrinter();
	~CMPosControllerPrinter();
	
	int		printText(LPCWSTR data, int fontType, int fontWidth, int fontHeight, int bold, int underline, int reverse, int alignment);
	int		printBitmapFile(LPCWSTR filename, int width, int alignment, int brightness, BOOL isDithering, BOOL isCompress);
	int		printImageFile(LPCWSTR filename, int width, int alignment, int threshold, int ditheringType, int compressType);
	int		printImage(char* image, int imageLength, int width, int alignment, int threshold, int ditheringType, int compressType);
	int		printBase64Image(LPCWSTR base64String, int width, int alignment, int threshold, int ditheringType, int compressType);

	int		print1DBarcode(LPCWSTR data, int symbology, int barWidth, int height, int alignment, int textPosition);
	int		printQRCode(LPCWSTR data, int model, int alignment, int moduleSize, int eccLevel);
	int		printPDF417(LPCWSTR data, int symbol, int alignment, int columnNumber, int rowNumber, int moduleWidth, int moduleHeight, int eccLevel);
	int		printDataMatrix(LPCWSTR data, int alignment, int moduleSize);
	int		printGS1Databar(LPCWSTR data, int symbol, int alignment, int size);
	int		printGS1DatabarMobile(LPCWSTR data, int symbol, int alignment, int moduleWidth, int moduleHeight, int segmentHeight, int separatorHeight);
	int		printCompositeSymbology(LPCWSTR data, LPCWSTR cData, int symbol, int cSymbol, int alignment, int size);
	int		printMaxicode(LPCWSTR data, int mode, int alignment);
	int		printAztec(LPCWSTR data, int alignment, int moduleSize, int eccLevel, int mode);

	int		setCharacterset(int characterset);
	int		setInternationalCharacterset(int internationalCharset);
	int		cutPaper(int cutType);

	int		setPagemode(int mode);
	int		setPagemodePrintArea(int x, int y, int width, int height);
	int		setPagemodeDirection(int direction);
	int		setPagemodePosition(int x, int y);
	int		printLine(int x1, int y1, int x2, int y2, int thickness);
	int		printBox(int left, int top, int right, int bottom, int thickness);

	int		asbEnable(bool enable);
	LPCTSTR	getModelName();
	LPCTSTR	getFirmwareVersion();

	int		displayString(LPCTSTR data, int codePage, int internationalCharacterSet, int line);
	int		clearScreen();
	int		storeImageFile(LPCTSTR filename, int width, int imageNumber);
	int		displayImage(int imageNumber, int xPos, int yPos);
	int		clearImage(int imageNumber);
	int		showCursor(int cursor);

private:
	bool LoadDll();

	pPrintText						fprintText;
	pPrintBitmapFile				fprintBitmapFile;
	pPrintImageFile					fprintImageFile;
	pPrintImage						fprintImage;
	pPrintBase64Image				fprintBase64Image;

	pPrint1DBarcode					fprint1DBarcode;
	pPrintQRCode					fprintQRCode;
	pPrintPDF417					fprintPDF417;
	pPrintDataMatrix				fprintDataMatrix;
	pPrintGS1Databar				fprintGS1Databar;
	pPrintGS1DatabarMobile			fprintGS1DatabarMobile;
	pPrintCompositeSymbology		fprintCompositeSymbology;
	pPrintMaxicode					fprintMaxicode;
	pPrintAztec						fprintAztec;

	pSetCharacterset				fsetCharacterset;
	pSetInternationalCharacterset	fsetInternationalCharacterset;
	pCutPaper						fcutPaper;

	pSetPagemode					fsetPagemode;
	pSetPagemodePrintArea			fsetPagemodePrintArea;
	pSetPagemodeDirection			fsetPagemodeDirection;
	pSetPagemodePosition			fsetPagemodePosition;
	pPrintLine						fprintLine;
	pPrintBox						fprintBox;
	pasbEnable						fasbEnable;
	pgetModelName					fgetModelName;
	pgetFirmwareVersion				fgetFirmwareVersion;

	pDisplayString					fdisplayString;
	pClearScreen					fclearScreen;
	pStoreImageFile					fstoreImageFile;
	pDisplayImage					fdisplayImage;
	pClearImage						fclearImage;
	pShowCursor						fshowCursor;
};


