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

#include "MPosControllerDevices.h"

typedef int (__stdcall *pCheckPrinterStatus)(int bgtId);
typedef int (__stdcall *pPrintBuffer)(int bgtId, int numberOfcopies);
typedef	int	(__stdcall *pPrintRawData)(int bgtId, char* rawData, int rawDataLength);
typedef int	(__stdcall *pDrawTextDeviceFont)(int bgtId, LPCTSTR data, int xPos, int yPos, char fontSelection,
											  int fontWidth, int fontHeight, int rightSpace, int rotation, BOOL reverse, BOOL bold, BOOL rightToLeft, int alignment);
typedef int	(__stdcall *pDrawTextVectorFont)(int bgtId, LPCTSTR data, int xPos, int yPos, char fontSelection,
											 int fontWidth, int fontHeight, int rightSpace, int rotation, BOOL reverse, BOOL bold, BOOL italic, BOOL rightToLeft, int alignment);


typedef int (__stdcall *pDrawBarcode1D)(int bgtId, LPCTSTR data, int xPos, int yPos, int barcodeType, int widthNarrow, int widthWide,
									  int height, int hri, int quietZoneWidth, int rotation);
typedef int (__stdcall *pDrawBarcodeMaxiCode)(int bgtId, LPCTSTR data, int xPos, int yPos, int mode);
typedef int (__stdcall *pDrawBarcodePDF417) (int bgtId, LPCTSTR data, int xPos, int Ypos, int rowCount, int columnCount, int eccLevel,
											 int dataCompressionMethod, BOOL hri, int startPosition, int moduleWidth, int barHeight, int rotaion);
typedef int (__stdcall *pDrawBarcodeQRCode)(int bgtId, LPCTSTR data, int xPos, int yPos, int size, int model, int eccLevel, int rotaion);
typedef int (__stdcall *pDrawBarcodeDataMatrix) (int bgtId, LPCTSTR data, int xPos, int yPos, int size, BOOL reverse, int rotation);
typedef int (__stdcall *pDrawBarcodeAztec)(int bgtId, LPCTSTR data, int xPos, int yPos, int size, BOOL extendedChannel, int eccLevel, BOOL menuSymbol, int numberOfSymbols, LPCTSTR optionalID, int rotation);
typedef int (__stdcall *pDrawBarcodeCode49) (int bgtId, LPCTSTR data, int xPos, int yPos, int widthNarrow, int widthWide, int height, int hri, int startingMode, int rotation);
typedef int (__stdcall *pDrawBarcodeCodaBlock) (int bgtId, LPCTSTR data, int xPos, int yPos, int widthNarrow, int widthWide, int height, BOOL securityLevel, int dataColumns, char mode, int encode);
typedef int (__stdcall *pDrawBarcodeMicroPDF)(int bgtId, LPCTSTR data, int xPos, int yPos, int moduleWidth, int height, int mode, int rotation);
typedef int (__stdcall *pDrawBarcodeIMB) (int bgtId, LPCTSTR data, int xPos, int yPos, BOOL hri, int rotation);
typedef int (__stdcall *pDrawBarcodeMSI)(int bgtId, LPCTSTR data, int xPos, int yPos, int widthNarrow, int widthWide, int height, int checkDigit, BOOL printCheckDigit, int hri, int rotation);
typedef int (__stdcall *pDrawBarcodePlessey)(int bgtId, LPCTSTR data, int xPos, int yPos, int widthNarrow, int widthWide, int height, BOOL printCheckDigit, int hri, int rotation);
typedef int (__stdcall *pDrawBarcodeTLC39)(int bgtId, LPCTSTR data, int xPos, int yPos, int widthNarrow, int widthWide, int height, int rowHeightOfMicroPDF417,
					  int narrowWidthOfMicroPDF417, int rotation);
typedef int (__stdcall *pDrawBarcodeRSS)(int bgtId, LPCTSTR data, int xPos, int yPos, int barcodeType,	int magnification, int separatorHeight, int height, 
					int segmentWidth, int rotation);	


typedef int (__stdcall *pDrawBlock)(int bgtId, int startPosX, int startPosY, int endPosX, int endPosY, LPCTSTR option, int thickness);
typedef int (__stdcall *pDrawCircle)(int bgtId, int startPosX, int startPosY, int size, int multiplier);
typedef int (__stdcall *pDrawImageFile) (int bgtId, LPCTSTR fileName, int startPosX, int startPosY, int width, int threshold, int ditheringType, int compressType);
typedef int (__stdcall *pDrawBase64Image) (int bgtId, LPCTSTR base64String, int startPosX, int startPosY, int width, int threshold, int dithering, int compressType);

typedef int (__stdcall *pSetCharacterset) (int bgtId, int characterset, int internationalCharset);
typedef int (__stdcall *pSetPrintingType) (int bgtId, char printingType);
typedef int (__stdcall *pSetMargin)  (int bgtId, int horizontalMargin, int verticalMargin);
typedef int (__stdcall *pSetLength) (int bgtId, int labelLength, int gapLength, LPCTSTR mediaType, int offsetLength);
typedef int (__stdcall *pSetWidth) (int bgtId, int labelWidth);
typedef int (__stdcall *pSetSpeed) (int bgtId, int speed);
typedef int (__stdcall *pSetDensity) (int bgtId, int density);
typedef int (__stdcall *pSetOrientation)(int bgtId, char orientation);
typedef int (__stdcall *pSetOffset) (int bgtId, int offset);
typedef int (__stdcall *pSetCuttingPosition) (int bgtId, int position);
typedef int (__stdcall *pSetAutoCutter) (int bgtId, BOOL enableAutoCutter, int cuttingPeriod);
typedef int (__stdcall *pSetSpeed)(int bgtId, int speed);
typedef int (__stdcall *pSetAutoCutter)(int bgtId, BOOL enableAutoCutter, int cuttingPeriod);

typedef int (__stdcall *pSetRewinder) (int bgtId, BOOL enable);
typedef int (__stdcall *pSetupRFID)(int bgtId, int rfidType, int numberOfRetries, int numberOfLabel, int radioPower);
typedef int (__stdcall *pSetEPCDataStructure) (int bgtId, int totalSize, LPCTSTR fieldSizes);
typedef int (__stdcall *pSetRFIDPosition) (int bgtId, int transPosition);
typedef int (__stdcall *pCalibrateRFID)(int bgtId);
typedef int (__stdcall *pWriteRFID)(int bgtId, int dataType, int startingBlockNumber, int dataLength, LPCTSTR data);
typedef int (__stdcall *pSetRFIDPassword) (int bgtId, LPCTSTR oldAccessPwd, LPCTSTR oldKillPwd, LPCTSTR newAccessPwd, LPCTSTR newKillPwd);
typedef int (__stdcall *pLockRFID) (int bgtId);

typedef int (__stdcall *pGetPrinterDPI)(int bgtId);
typedef int (__stdcall *pGetMaxWidth)(int bgtId);
typedef LPCTSTR (__stdcall *pGetModelName) (int bgtId);
typedef LPCTSTR (__stdcall *pGetFirmwareVersion) (int bgtId);
typedef LPCTSTR (__stdcall *pGetSupportedSpeeds)(int bgtId);
typedef LPCTSTR (__stdcall *pGetStatisticsData)(int bgtId, int Info);


class CMPosControllerLabelPrinter : public CMPosControllerDevices
{
	public:
		CMPosControllerLabelPrinter();
		 ~CMPosControllerLabelPrinter();

		 int checkPrinterStatus();
		 int printBuffer(int numberOfCopies);
		 int printRawData(char* rawData, int rawDataLength);
		 int drawTextDeviceFont(LPCTSTR data, int xPos, int yPos, char fontSelection,
			 int fontWidth, int fontHeight, int rightSpace, int rotation, BOOL reverse, BOOL bold, BOOL rightToLeft, int alignment);
		 int drawTextVectorFont (LPCTSTR data, int xPos, int yPos, char fontSelection,
			 int fontWidth, int fontHeight, int rightSpace, int rotation, BOOL reverse, BOOL bold, BOOL italic, BOOL rightToLeft, int alignment);

		 //Barcode Methods
		 int drawBarcode1D(LPCTSTR data, int xPos, int yPos, int barcodeType, int widthNarrow,	int widthWide, int height, int hri, int quietZoneWidth, int rotation);

		 int drawBarcodeMaxiCode(LPCTSTR data, int xPos, int yPos, int mode);

		 int drawBarcodePDF417(LPCTSTR data, int xPos, int yPos, int rowCount, int columnCount, int eccLevel, int dataCompressionMethod, BOOL hri,
								 int startPosition, int moduleWidth, int barHeight, int rotation);
		 int drawBarcodeQRCode(LPCTSTR data, int xPos, int yPos, int size, int model, int eccLevel, int rotation);

		 int drawBarcodeDataMatrix(LPCTSTR data, int xPos, int yPos, int size, BOOL reverse, int rotation);

		 int drawBarcodeAztec(LPCTSTR data, int xPos, int yPos, int size, BOOL extendedChannel, int eccLevel, BOOL menuSymbol, int numberOfSymbols, LPCTSTR optionalID, int rotation);

		 int drawBarcodeCode49(LPCTSTR data, int xPos, int yPos, int widthNarrow, int widthWide, int height, int hri, int startingMode, int rotation);

		 int drawBarcodeCodaBlock(LPCTSTR data, int xPos, int yPos, int widthNarrow, int widthWide,int height, BOOL securityLevel, int dataColumns, char mode, int encode);

		 int drawBarcodeMicroPDF(LPCTSTR data, int xPos, int yPos, int moduleWidth, int height, int mode, int rotation);

		 int drawBarcodeIMB(LPCTSTR data, int xPos, int yPos, BOOL hri, int rotation);

		 int drawBarcodeMSI(LPCTSTR data, int xPos, int yPos, int widthNarrow, int widthWide, int height, int checkDigit, BOOL printCheckDigit, int hri, int rotation);

		 int drawBarcodePlessey(LPCTSTR data, int xPos, int yPos, int widthNarrow, int widthWide, int height, BOOL printCheckDigit, int hri, int rotation);

		 int drawBarcodeTLC39(LPCTSTR data, int xPos, int yPos, int widthNarrow, int widthWide, int height, int rowHeightOfMicroPDF417, int narrowWidthOfMicroPDF417, int rotation);

		 int drawBarcodeRSS(LPCTSTR data, int xPos, int yPos, int barcodeType,	int magnification, int separatorHeight, int height, int segmentWidth, int rotation);	

		 //Image Methods
		 int drawBlock(int startPosX, int startPosY, int endPosX, int endPosY, LPCTSTR option, int thickness);
		 int drawCircle(int startPosX, int startPosY, int size, int multiplier);
		 int drawImageFile(LPCTSTR filename, int startPosX, int startPosY, int width, int threshold, int dithering, int compressType);
		 int drawBase64Image(LPCTSTR base64String, int startPosX, int startPosY, int width, int threshold, int dithering, int compressType);
		
		 //Printer Setting Methods
		 int setCharacterset(int characterset, int internationalCharset);
		 int setPrintingType(char printingType);
		 int setMargin(int horizontalMargin, int verticalMargin);
		 int setLength(int labelLength, int gapLength, LPCTSTR mediaType, int offsetLength);
		 int setWidth(int labelWidth);
		 int setSpeed(int speed);
		 int setDensity(int density);
		 int setOrientation(char orientation);
		 int setOffset(int offset);
		 int setCuttingPosition(int position);
		 int setAutoCutter(BOOL enableAutoCutter, int cuttingPeriod);

		 //RFID Methods
		 int setRewinder(BOOL enable);
		 int setupRFID(int rfidType, int numberOfRetries, int numberOfLabel, int radioPower);
		 int setEPCDataStructure(int totalSize, LPCTSTR fieldSizes);
		 int setRFIDPosition(int transPosition);
		 int calibrateRFID();
		 int writeRFID(int dataType, int startingBlockNumber, int dataLength, LPCTSTR data);
		 int setRFIDPassword(LPCTSTR oldAccessPwd, LPCTSTR oldKillPwd, LPCTSTR newAccessPwd, LPCTSTR newKillPwd);
		 int lockRFID();

		 //get Printer Info
		 int getPrinterDPI();
		 int getMaxWidth();	
		 LPCTSTR getStatisticsData(int Info);
		 LPCTSTR getSupportedSpeeds();
		 LPCTSTR getModelName();
		 LPCTSTR getFirmwareVersion();


	protected:
		int nBgtId;

	private:
		bool LoadDll();
	
		pCheckPrinterStatus		fCheckPrinterStatus;
		pPrintBuffer			fPrintBuffer;
		pPrintRawData			fPrintRawData;
		pDrawTextDeviceFont		fDrawTextDeviceFont;
		pDrawTextVectorFont		fDrawTextVectorFont;
		
		pDrawBarcode1D			fDrawBarcode1D;
		pDrawBarcodeMaxiCode	fDrawBarcodeMaxiCode;
		pDrawBarcodePDF417		fDrawBarcodePDF417;
		pDrawBarcodeQRCode		fDrawBarcodeQRCode;
		pDrawBarcodeDataMatrix  fDrawBarcodeDataMatrix;
		pDrawBarcodeAztec		fDrawBarcodeAztec;
		pDrawBarcodeCode49		fDrawBarcodeCode49;
		pDrawBarcodeCodaBlock	fDrawBarcodeCodaBlock;
		pDrawBarcodeMicroPDF	fDrawBarcodeMicroPDF;
		pDrawBarcodeIMB			fDrawBarcodeIMB;
		pDrawBarcodeMSI			fDrawBarcodeMSI;
		pDrawBarcodePlessey		fDrawBarcodePlessey;
		pDrawBarcodeTLC39		fDrawBarcodeTLC39;
		pDrawBarcodeRSS			fDrawBarcodeRSS;

		pDrawBlock				fDrawBlock;
		pDrawCircle				fDrawCircle;
		pDrawImageFile			fDrawImageFile;
		pDrawBase64Image		fDrawBase64Image;

		pSetCharacterset		fSetCharacterset;
		pSetPrintingType		fSetPrintingType;
		pSetMargin				fSetMargin;
		pSetLength				fSetLength;
		pSetWidth				fSetWidth;
		pSetSpeed				fSetSpeed;
		pSetDensity				fSetDensity;
		pSetOrientation			fSetOrientation;
		pSetOffset				fSetOffset;
		pSetCuttingPosition		fSetCuttingPosition;
		pSetAutoCutter			fSetAutoCutter;

		pSetRewinder			fSetRewinder;		
		pSetupRFID				fSetupRFID;
		pSetEPCDataStructure	fSetEPCDataStructure;
		pSetRFIDPosition		fSetRFIDPosition;
		pCalibrateRFID			fCalibrateRFID;
		pWriteRFID				fWriteRFID;
		pSetRFIDPassword		fSetRFIDPassword;
		pLockRFID				fLockRFID;
		
		pGetSupportedSpeeds		fGetSupportedSpeeds;
		pGetStatisticsData		fGetStatisticsData;		
		pGetPrinterDPI			fGetPrinterDPI;
		pGetMaxWidth			fGetMaxWidth;
		pGetModelName			fGetModelName;
		pGetFirmwareVersion		fGetFirmwareVersion;
		
};