// 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 001 //#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 112 // 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 StartAgent(unsigned char iMode, int ComPara[][6]); WINCONAGENT_API unsigned char StopAgent(void); /* To get and set the DI/DO/AI/AO values of I8K/I87K modules */ WINCONAGENT_API unsigned char GetDIO(unsigned char iSlot, unsigned char iChannel, unsigned char *iRecv, unsigned char iAttribute); WINCONAGENT_API unsigned char GetAIO(unsigned char iSlot, unsigned char iChannel, 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 char iSlot, unsigned char iChannel, unsigned char iSend); WINCONAGENT_API unsigned char SetAO(unsigned char iSlot, unsigned char iChannel, 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 Get7KDIO(unsigned char iCOM, unsigned char iSlave, unsigned char iChannel, unsigned char *iRecv, unsigned char iAttribute); WINCONAGENT_API unsigned char Get7KAIO(unsigned char iCOM, unsigned char iSlave, unsigned char iChannel, float *iRecv, unsigned char iAttribute); WINCONAGENT_API unsigned char Get7KMultiDIO(unsigned char iCOM, unsigned char iSlave, unsigned char *iRecv, unsigned char iAttribute); WINCONAGENT_API unsigned char Get7KMultiAIO(unsigned char iCOM, unsigned char iSlave, float *iRecv, unsigned char iAttribute); WINCONAGENT_API unsigned char Set7KDO(unsigned char iCOM, unsigned char iSlave, unsigned char iChannel, unsigned char iSend); WINCONAGENT_API unsigned char Set7KAO(unsigned char iCOM, unsigned char iSlave, unsigned char iChannel, float iSend); WINCONAGENT_API unsigned char Set7KMultiDO(unsigned char iCOM, unsigned char iSlave, unsigned char *iSend); WINCONAGENT_API unsigned char Set7KMultiAO(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 GetNameOf7KModule(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 GetAtriOf7KModule(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 Get7KCountVal(unsigned char iCOM, unsigned char iSlave, unsigned char iChannel, unsigned short *iRecv); /* Modbus functions */ WINCONAGENT_API unsigned char MBSetToCoil(unsigned short iMBAddress, unsigned char iStatus, unsigned char iAttr/* 1: input 0:output*/); WINCONAGENT_API unsigned char MBGetFromCoil(unsigned short iMBAddress, unsigned char *iStatus, unsigned char iAttr/* 1: input 0:output*/); WINCONAGENT_API unsigned char MBSetToReg(unsigned short iMBAddress, short iStatus, unsigned char iAttr/* 1: input 0:output*/); WINCONAGENT_API unsigned char MBGetFromReg(unsigned short iMBAddress, short *iStatus, unsigned char iAttr/* 1: input 0:output*/); /* User share functions */ WINCONAGENT_API unsigned char UserSetCoil(unsigned short iUserAddress/* 1~8192 */, unsigned char iStatus); WINCONAGENT_API unsigned char UserGetCoil(unsigned short iUserAddress/* 1~8192 */, unsigned char *iStatus); WINCONAGENT_API unsigned char UserSetReg(unsigned short iUserAddress/* 1~8192 */, short iStatus); WINCONAGENT_API unsigned char UserGetReg(unsigned short iUserAddress/* 1~8192 */, short *iStatus);