#ifdef MXSP_EXPORTS
#define MXSP_API __declspec(dllexport)
#else
#define MXSP_API __declspec(dllimport)
#endif

// This class is exported from the mxsp.dll
class MXSP_API Cmxsp {
public:
	Cmxsp(void);
	// TODO: add your methods here.
};

extern MXSP_API int nmxsp;

MXSP_API int fnmxsp(void);



//#ifdef __cplusplus    // If used by C++ code, 
//extern "C" {          // we need to export the C interface
//#endif

/*
	Initialize Uart
	
	param:
		port  :	 port number	
				
	Return value:
		unsigned int :			return UART handle
*/
MXSP_API HANDLE mxsp_open();

/*
	Get UART Mode
	
	param:
		(in)int index :	Port index (0,1)		
				
	Return value:
		int:		0 : RS232 Mode
					1 : RS485-2W Mode
					2 : RS422 Mode
					3 : RS485-4W Mode
*/
MXSP_API  int mxsp_get_interface(HANDLE fd, int port_index);

/*
	Set UART Mode
	
	param:
		(in)int index  :	Port index		
		(in)int mode   :	Port mode		
				
	Return value:
		int:			Current Mode. 
*/
MXSP_API int mxsp_set_interface(HANDLE fd, int port_index, int port_interface);

/*
	close UART	
	param:
		(in)unsigned int fd  :	Handle of the open port		
				
	Return value:
		none
*/
MXSP_API void mxsp_close(HANDLE fd);

//#ifdef __cplusplus    // If used by C++ code, 
//}
//#endif
MXSP_API int* GetPortsName(int *count);

int SetRegistryValue(DWORD nPort,DWORD nMode);