// The following ifdef block is the standard way of creating macros which make exporting 
// from a DLL simpler. All files within this DLL are compiled with the DTMSRAPI_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see 
// DTMSRAPI_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
#pragma once

#ifdef DTMSRAPI_EXPORTS
#define DTMSR_API __declspec(dllexport)
#else
#define DTMSR_API __declspec(dllimport)
#endif



#ifdef __cplusplus
extern "C" {
#endif

	/*---------------------------------------------------Msr------------------------------------------*/

	typedef struct tagPARSEDATAFORMAT
	{
		WCHAR startSentinel;
		WCHAR endSentinel;
	}PARSEDATAFORMAT;

	typedef struct tagTRACKDATA
	{
		WCHAR startSentinel;
		WCHAR endSentinel;
		WCHAR lpszDataBuf[256];
		DWORD dwDataLen;
	}TRACKDATA;

	typedef void (__stdcall *MsrDataCallback)(TRACKDATA *pTrackData, DWORD dwTrackCount);

	//Connect to Msr with specific serial port
	DTMSR_API USHORT Msr_Connect(int port);

	//Disconnect the connection with Msr
	DTMSR_API USHORT Msr_Disconnect(void);

	//Acquire Msr's product name and firmware version.
	DTMSR_API USHORT Msr_GetFirmwareInfo(TCHAR *name, long nameBufLen, TCHAR *version, long verBufLen);

	//Acquire Msr's communication parameters.
	DTMSR_API USHORT Msr_GetPortParameters(int *baud, int * databits, int *parity, int* stopbits);

	//Set serial port communication parameters 
	DTMSR_API USHORT Msr_SetPortParameters(int baud, int databits, int parity, int stopbits);

	//Set callback function
	DTMSR_API USHORT Msr_SetDataReceiverCallback (MsrDataCallback revFun);

	//Do parsing data.
	DTMSR_API USHORT Msr_ParseEnable (BOOL bParse,PARSEDATAFORMAT* parseFormat,int parseCount);
#ifdef __cplusplus
}
#endif