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

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

typedef LPCTSTR  (__stdcall *pSearchDevices)(int bgtId);
typedef LPCTSTR  (__stdcall *pGetBgateSerialNumber)(int bgtId);
typedef LPCTSTR  (__stdcall *pGetUSBDevice)(int bgtId, int deviceId);
typedef LPCTSTR  (__stdcall *pGetSerialConfiguration)(int bgtId, int deviceId);
typedef int		 (__stdcall *pSetSerialConfiguration)(int bgtId, int deviceId, int baudrate, int dataBit, int stopBit, int parityBit, int flowControl);
typedef LPCTSTR  (__stdcall *pGetCustomDevices)(int bgtId, int deviceType);
typedef int		 (__stdcall *pAddCustomDevice)(int bgtId, int deviceType, LPCTSTR vid, LPCTSTR pid);
typedef int		 (__stdcall *pDeleteCustomDevice)(int bgtId, int deviceType, LPCTSTR vid, LPCTSTR pid);
typedef int		 (__stdcall *pReInitCustomDeviceType)(int bgtId, int deviceType);

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

	LPCTSTR		searchDevices();
	LPCTSTR		getBgateSerialNumber();
	LPCTSTR		getUSBDevice(int deviceId);
	LPCTSTR		getSerialConfiguration(int deviceId);
	int			setSerialConfiguration(int deviceId, int baudrate, int dataBit, int stopBit, int parityBit, int flowControl);
	LPCTSTR		getCustomDevices(int deviceType);
	int			addCustomDevice(int deviceType, LPCTSTR vid, LPCTSTR pid);
	int			deleteCustomDevice(int deviceType, LPCTSTR vid, LPCTSTR pid);
	int			reInitCustomDeviceType(int deviceType);

private:
	bool LoadDll();

	pSearchDevices			fsearchDevices;
	pGetBgateSerialNumber	fgetBgateSerialNumber;
	pGetUSBDevice			fgetUSBDevice;
	pGetSerialConfiguration	fgetSerialConfiguration;
	pSetSerialConfiguration	fsetSerialConfiguration;
	pGetCustomDevices		fgetCustomDevices;
	pAddCustomDevice		faddCustomDevice;
	pDeleteCustomDevice		fdeleteCustomDevice;
	pReInitCustomDeviceType	freInitCustomDeviceType;
};
