
// 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 WINCONAGENT_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 
// WINCONAGENT_API functions as being imported from a DLL, wheras this DLL sees symbols
// defined with this macro as being exported.
#ifdef WINCONAGENT_EXPORTS
#define WINCONAGENT_API extern "C" __declspec(dllexport)
#else
#define WINCONAGENT_API extern "C" __declspec(dllimport)
#endif

#define		WCA_OK				0
#define		WCA_DMASK_TRUE		0xFF	//Digital mask true
#define		WCA_DMASK_FALSE		0x00	//Digital mask false
#define		WCA_AMASK_TRUE		0xFFFF	//Analog mask true
#define		WCA_AMASK_FALSE		0x0000	//Analog mask false
//Error list and description
#define		WCA_Version			101		
//#define		WCA_Start			101		//WinCon agent has been started
#define		WCA_Stop			102		//WinCon agent has been stopped
#define		WCA_SLOTNO_OVER		103		// Slot No. must be 1 - 8
#define		WCA_ATT_ERROR		104		// Attribute No. error 1 or 0
#define		WCA_COMNO_OVER		105		// COM port No. must be 2 or 3
#define		WCA_SLAVENO_OVER	106		// Slave No. must be 1 - 256
#define		WCA_NOT_MASTER		107		// Not the main AP which calls AgentKernel
#define     WCA_MBADDR_OVER		108		// Modbus DIO address must be 449 - 2048 AIO address must be 225 - 2048 
#define		WCA_MBATTR_ERROR	109		// Modbus attribute must be 1 or 0
#define     WCA_USERADDR_OVER	110		// User defined address must be 1 - 8192  
//#define		WCA_USERCATTR_ERROR	111		// User defined coil status must be 1 or 0
#define		WCA_USERRATTR_ERROR	111		// User defined reg status must be -32768 to 32767
/* Get the version number of WinConAgent */
WINCONAGENT_API unsigned char StartQuicker(unsigned char iMode);
WINCONAGENT_API unsigned char StopQuicker(void);
WINCONAGENT_API unsigned char GetVersion();
/* To get and set the DI/DO/AI/AO values of I8K/I87K modules */
WINCONAGENT_API unsigned char GetDIO(unsigned short iMBAddr, unsigned char *iRecv, unsigned char iAttribute);
WINCONAGENT_API unsigned char GetAIO_Float(unsigned short iMBAddr, float *iRecv, unsigned char iAttribute);
/* Add by Wilson 2005.4.21 */
WINCONAGENT_API unsigned char GetAIO_Short(unsigned short iMBAddr, short *iRecv, unsigned char iAttribute);
WINCONAGENT_API unsigned char GetAIO_Long(unsigned short iMBAddr, long *iRecv, unsigned char iAttribute);
WINCONAGENT_API unsigned char GetAIO_Word(unsigned short iMBAddr, unsigned short *iRecv, unsigned char iAttribute);
WINCONAGENT_API unsigned char GetAIO_DWord(unsigned short iMBAddr, unsigned long *iRecv, unsigned char iAttribute);
/* End - Add by Wilson 2005.4.21 */
WINCONAGENT_API unsigned char SetDO(unsigned short iMBAddr, unsigned char iSend);
WINCONAGENT_API unsigned char SetAO_Float(unsigned short iMBAddr, float *iSend);
/* Add by Wilson 2005.4.21 */
WINCONAGENT_API unsigned char SetAO_Short(unsigned short iMBAddr, short *iSend);
WINCONAGENT_API unsigned char SetAO_Long(unsigned short iMBAddr, long *iSend);
WINCONAGENT_API unsigned char SetAO_Word(unsigned short iMBAddr, unsigned short *iSend);
WINCONAGENT_API unsigned char SetAO_DWord(unsigned short iMBAddr, unsigned long *iSend);
/* End - Add by Wilson 2005.4.21 */
/* Modbus functions */
WINCONAGENT_API unsigned char MBSetCoil(unsigned short iMBAddress, unsigned char iStatus, unsigned char iAttr/* 1: input 0:output*/);
WINCONAGENT_API unsigned char MBGetCoil(unsigned short iMBAddress, unsigned char *iStatus, unsigned char iAttr/* 1: input 0:output*/);
WINCONAGENT_API unsigned char MBSetReg(unsigned short iMBAddress, short iStatus, unsigned char iAttr/* 1: input 0:output*/);
WINCONAGENT_API unsigned char MBGetReg(unsigned short iMBAddress, short *iStatus, unsigned char iAttr/* 1: input 0:output*/);
/* User share functions */
WINCONAGENT_API unsigned char UserSetCoil(unsigned short iUserAddress/* 1~19999 */, unsigned char iStatus);
WINCONAGENT_API unsigned char UserGetCoil(unsigned short iUserAddress/* 1~19999 */, unsigned char *iStatus);
WINCONAGENT_API unsigned char UserSetReg_Str(unsigned short iUserAddress/* 1~1024 */, char *iStatus);
WINCONAGENT_API unsigned char UserGetReg_Str(unsigned short iUserAddress/* 1~1024 */, char *iStatus);
WINCONAGENT_API unsigned char UserSetReg(unsigned short iUserAddress/* 1~19999 */, long *iStatus, unsigned char iDType);
WINCONAGENT_API unsigned char UserGetReg(unsigned short iUserAddress/* 1~19999 */, long *iStatus, unsigned char iDType);
WINCONAGENT_API unsigned char UserSetReg_Float(unsigned short iUserAddress/* 1~19999 */, float *iStatus);
WINCONAGENT_API unsigned char UserGetReg_Float(unsigned short iUserAddress/* 1~19999 */, float *iStatus);
WINCONAGENT_API unsigned char UserSetReg_Short(unsigned short iUserAddress/* 1~19999 */, short *iStatus);
WINCONAGENT_API unsigned char UserGetReg_Short(unsigned short iUserAddress/* 1~19999 */, short *iStatus);
WINCONAGENT_API unsigned char UserSetReg_Long(unsigned short iUserAddress/* 1~19999 */, int *iStatus);
WINCONAGENT_API unsigned char UserGetReg_Long(unsigned short iUserAddress/* 1~19999 */, int *iStatus);