
// 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 GetVerOfAgent(void);
/* To start and stop the WinConAgent      */
/* iMode = 0~15 XXXX => ex. 0x0000~0x1111 */
/*  X    X    X    X                      */
/* COM3 COM2 87K  8K                      */
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(unsigned short iMBAddr, float *iRecv, unsigned char iAttribute);
//WINCONAGENT_API unsigned char GetMultiDIO(unsigned char iSlot, unsigned char *iRecv, unsigned char iAttribute);
//WINCONAGENT_API unsigned char GetMultiAIO(unsigned char iSlot, float *iRecv, unsigned char iAttribute);
WINCONAGENT_API unsigned char SetDO(unsigned short iMBAddr, unsigned char iSend);
WINCONAGENT_API unsigned char SetAO(unsigned short iMBAddr, float iSend);
//WINCONAGENT_API unsigned char SetMultiDO(unsigned char iSlot, unsigned char *iSend);
//WINCONAGENT_API unsigned char SetMultiAO(unsigned char iSlot, float *iSend);
/* To get and set the DI/DO/AI/AO values of I7K modules via COM2/COM3 */
/*WINCONAGENT_API unsigned char GetRemoteDIO(unsigned char iCOM, unsigned char iSlave, unsigned char iChannel, unsigned char *iRecv, unsigned char iAttribute);
WINCONAGENT_API unsigned char GetRemoteAIO(unsigned char iCOM, unsigned char iSlave, unsigned char iChannel, float *iRecv, unsigned char iAttribute);
WINCONAGENT_API unsigned char GetRemoteMultiDIO(unsigned char iCOM, unsigned char iSlave, unsigned char *iRecv, unsigned char iAttribute);
WINCONAGENT_API unsigned char GetRemoteMultiAIO(unsigned char iCOM, unsigned char iSlave, float *iRecv, unsigned char iAttribute);
WINCONAGENT_API unsigned char SetRemoteDO(unsigned char iCOM, unsigned char iSlave, unsigned char iChannel, unsigned char iSend);
WINCONAGENT_API unsigned char SetRemoteAO(unsigned char iCOM, unsigned char iSlave, unsigned char iChannel, float iSend);
WINCONAGENT_API unsigned char SetRemoteMultiDO(unsigned char iCOM, unsigned char iSlave, unsigned char *iSend);
WINCONAGENT_API unsigned char SetRemoteMultiAO(unsigned char iCOM, unsigned char iSlave, float *iSend);
*/
/* To get the module name */
/*WINCONAGENT_API unsigned char GetNameOf8KModule(unsigned char iSlot, char *cName);
WINCONAGENT_API unsigned char GetNameOf87KModule(unsigned char iSlot, char *cName);
WINCONAGENT_API unsigned char GetNameOfRemoteModule(unsigned char iCOM, unsigned char iSlave, char *cName);
*/
/* To get the module attribute */
/*WINCONAGENT_API unsigned char GetAtriOf8KModule(unsigned char iSlot, unsigned char *iAtri);
WINCONAGENT_API unsigned char GetAtriOf87KModule(unsigned char iSlot, unsigned char *iAtri);
WINCONAGENT_API unsigned char GetAtriOfRemoteModule(unsigned char iCOM, unsigned char iSlave, unsigned char *iAtri);
*/
/* To get the counter values of I87K modules */
//WINCONAGENT_API unsigned char Get87KCountVal(unsigned char iSlot, unsigned char iChannel, unsigned short *iRecv);
/* To get the counter values of I7K modules */
//WINCONAGENT_API unsigned char GetRemoteCountVal(unsigned char iCOM, unsigned char iSlave, unsigned char iChannel, unsigned short *iRecv);
/* 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_Sht(unsigned short iUserAddress/* 1~19999 */, short iStatus);
//WINCONAGENT_API unsigned char UserGetReg_Sht(unsigned short iUserAddress/* 1~19999 */, short *iStatus);
//WINCONAGENT_API unsigned char UserSetReg_Flt(unsigned short iUserAddress/* 1~19999 */, float iStatus);
//WINCONAGENT_API unsigned char UserGetReg_Flt(unsigned short iUserAddress/* 1~19999 */, float *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);