#include "stdafx.h"
#include "MPosControllerBCD.h"

//////////////////////////////////////////////////////////////////////////

CMPosControllerBCD::CMPosControllerBCD()
: CMPosControllerDevices(_T("MPosControllerBCD.dll"))
{
	LoadDll();
}

CMPosControllerBCD::~CMPosControllerBCD()
{
}
bool CMPosControllerBCD::LoadDll()
{ 	
	if(m_hDll == 0)
		return FALSE;
	
	fdisplayString	= (pDisplayString)GetProcAddress(m_hDll, ("displayString"));
	fclearScreen	= (pClearScreen)GetProcAddress(m_hDll, ("clearScreen"));
	fstoreImageFile = (pStoreImageFile)GetProcAddress(m_hDll, ("storeImageFile"));
	fdisplayImage	= (pDisplayImage)GetProcAddress(m_hDll, ("displayImage"));
	fclearImage		= (pClearImage)GetProcAddress(m_hDll, ("clearImage"));
	fshowCursor		= (pShowCursor)GetProcAddress(m_hDll, ("showCursor"));

	return TRUE;
}

int CMPosControllerBCD::displayString(LPCTSTR data, int codePage, int internationalCharacterSet, int line)
{
	return fdisplayString(m_nBgtId, data, codePage, internationalCharacterSet, line);
}

int CMPosControllerBCD::clearScreen()
{	
	return fclearScreen(m_nBgtId);
}

int CMPosControllerBCD::storeImageFile(LPCTSTR filename, int width, int imageNumber)
{
	return fstoreImageFile(m_nBgtId, filename, width, imageNumber);
}

int CMPosControllerBCD::displayImage(int imageNumber, int xPos, int yPos)
{
	return fdisplayImage(m_nBgtId, imageNumber, xPos, yPos);
}

int CMPosControllerBCD::clearImage(int imageNumber)
{
	return fclearImage(m_nBgtId, imageNumber);
}

int CMPosControllerBCD::showCursor(int cursor)
{
	return fshowCursor(m_nBgtId, cursor);
}