#ifdef __cplusplus
     #define EXPORTS extern "C" __declspec (dllimport)
#else
     #define EXPORTS
#endif


#define  DATEBITS_4       4
#define  DATEBITS_5       5
#define  DATEBITS_6       6
#define  DATEBITS_7       7
#define  DATEBITS_8       8

#define  ADAMSER_PARITY_NO        0
#define  ADAMSER_PARITY_ODD       1
#define  ADAMSER_PARITY_EVEN      2
#define  ADAMSER_PARITY_MARK      3
#define  ADAMSER_PARITY_SPACE     4

#define  STOPBIT_1        0
#define  STOPBIT_1POINT5  1
#define  STOPBIT_2        2  

#define  MODBUS_ASCII     0
#define  MODBUS_RTU       1  

//--------------- Error Code --------------------
#define   ADAMSER_OK                           0 
#define   ADAMSER_PortNotOpen                (-1)
#define   ADAMSER_CannotOpen                 (-2)
#define   ADAMSER_CannotClose                (-3)
#define   ADAMSER_InvalidModbusProtocol      (-4)
#define   ADAMSER_InvalidParity              (-5)
#define   ADAMSER_ComPortReadFailure         (-6)
#define   ADAMSER_ComPortWriteFailure        (-7)
#define   ADAMSER_TimeoutOccur               (-8)
#define   ADAMSER_InvalidPortHandle          (-9)
#define   ADAMSER_InvalidPortNumber          (-10)
		

EXPORTS  int  CALLBACK  ADAMSER_GetDLLVersion(void);
EXPORTS  long CALLBACK  ADAMSER_Open(int PortNumber);
EXPORTS  int  CALLBACK	ADAMSER_Close(long PortHandle);
EXPORTS  int  CALLBACK  ADAMSER_SetCommState(long PortHandle, int iBaudRate, int iParity, int iDataBits, int iStopBits);
EXPORTS  int  CALLBACK  ADAMSER_AdamCommand(long PortHandle, wchar_t* szwSend, wchar_t* szwReceive, int iTimeout);
EXPORTS  int  CALLBACK  ADAMSER_ComPortWrite (long PortHandle, BYTE *ucData, int nLength, int iTimeout);
EXPORTS  int  CALLBACK  ADAMSER_ComPortRead(long PortHandle, BYTE *ucData, int *nLength, int iTimeout);
