// 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 GPRS_RTU_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 // EXPORTS functions as being imported from a DLL, wheras this DLL sees symbols // defined with this macro as being exported. #ifdef __cplusplus #define EXPORTS extern "C" __declspec (dllexport) #else #define EXPORTS #endif typedef unsigned char BYTE; #define _NOERROR 0 #define _CON_FAILED 1 #define _MB_DATA_FAILED 2 #define _INIT_FAILED 3 #define _STATIONID_OR_SLAVEID_ERR 4 #define _NO_ENABLE_GPS 5 #define _CHANNEL_FAILED 6 #define STATION_NUM_MAX_SIZE 1024 #define MODBUS_DEVICE_MAX_SIZE 11 struct OPC_Total_Info { unsigned int iStationID; unsigned int iModbus_Num; unsigned int iModule; //Module Type: 0:G-4500, 1:GT-540 unsigned char cModule_Name[40]; //Alias Name unsigned int uiModule_Name_Len; char Modbus_Module_Name[MODBUS_DEVICE_MAX_SIZE][24]; BYTE Slave_ID[MODBUS_DEVICE_MAX_SIZE]; BYTE DI_Num[MODBUS_DEVICE_MAX_SIZE]; BYTE DO_Num[MODBUS_DEVICE_MAX_SIZE]; BYTE AI_Num[MODBUS_DEVICE_MAX_SIZE]; BYTE AO_Num[MODBUS_DEVICE_MAX_SIZE]; BYTE Counter_Num[MODBUS_DEVICE_MAX_SIZE]; unsigned short usEnGPS[MODBUS_DEVICE_MAX_SIZE]; }; //== Get version of Dll //return: // 0xAABB --> Version AA.BB EXPORTS unsigned int _stdcall GetDllVersion(void); //== Get date of Dll EXPORTS int _stdcall GetDllDate(char *cDate); //== Open(Execute) M2M RTU Center // parameter: // bMethod: // 0 = from OPC Server // 1 = from Other Server // return: // 0: No Error EXPORTS int __stdcall RTU_WakeUpAP(BYTE bMethod); //== Close(shutdown) M2M RTU Center // return: // 0: No Error EXPORTS int __stdcall RTU_CloseAP(void); //== Get Total Station Number of RTU Center (include online and offline station) //return: // 0: No Error // other: initial Error EXPORTS int __stdcall GET_Total_Station_NUM(unsigned int *iStation_Num); //== Get information of the Station //return: // 0: No Error // other: Error EXPORTS int __stdcall GET_StationID_Total_Info(unsigned int iNum, struct OPC_Total_Info *StationID_Total_Info); // offline就沒資料,回應Error //== Get Data, Time of Station's last update (if not on line, still can get?) EXPORTS int __stdcall GET_DateTime(unsigned int iStationID, int *iYear, int *iMonth, int *iDay, int *iHour, int *iMinute, int *iSec); // 目前demo沒用到 //== Get single Channel DO value // return: // 0: No Error // 1: don't establish the connection // 2: Modbus Data are invalid // 4: Station ID or Modbus Slave ID is invalid. EXPORTS int __stdcall GET_Modbus_DO_Channel(unsigned int iStationID, BYTE *bModbus_Module_Name, BYTE bModbus_SlaveID, BYTE channel, BYTE *Value); //== Get multi-Channel DO value //return: // 0: No Error // 1: don't establish the connection // 2: Modbus Data are invalid // 4: Station ID or Modbus Slave ID is invalid. EXPORTS int __stdcall GET_Modbus_DO(unsigned int iStationID, BYTE *bModbus_Module_Name, BYTE bModbus_SlaveID, unsigned long *Value); //== Get single Channel DI value // return: // 0: No Error // 1: don't establish the connection // 2: Modbus Data are invalid // 4: Station ID or Modbus Slave ID is invalid. EXPORTS int __stdcall GET_Modbus_DI_Channel(unsigned int iStationID, BYTE *bModbus_Module_Name, BYTE bModbus_SlaveID, BYTE channel, BYTE *Value); //== Get multi-Channel DI value //return: // 0: No Error // 1: don't establish the connection // 2: Modbus Data are invalid // 4: Station ID or Modbus Slave ID is invalid. EXPORTS int __stdcall GET_Modbus_DI(unsigned int iStationID, BYTE *bModbus_Module_Name, BYTE bModbus_SlaveID, unsigned long *Value); //== Get single Channel AO value // return: // 0: No Error // 1: don't establish the connection // 2: Modbus Data are invalid // 4: Station ID or Modbus Slave ID is invalid. EXPORTS int __stdcall GET_Modbus_AO_Channel(unsigned int iStationID, BYTE *bModbus_Module_Name, BYTE bModbus_SlaveID, BYTE channel, BYTE *DataFormat, BYTE *Type, unsigned short *Value); //== Get single Channel AI value // return: // 0: No Error // 1: don't establish the connection // 2: Modbus Data are invalid // 4: Station ID or Modbus Slave ID is invalid. EXPORTS int __stdcall GET_Modbus_AI_Channel(unsigned int iStationID, BYTE *bModbus_Module_Name, BYTE bModbus_SlaveID, BYTE channel, BYTE *DataFormat, BYTE *Type, unsigned short *Value); //== Get single Channel Counter value // return: // 0: No Error // 1: don't establish the connection // 2: Modbus Data are invalid // 4: Station ID or Modbus Slave ID is invalid. EXPORTS int __stdcall GET_Modbus_Counter_Channel(unsigned int iStationID, BYTE *bModbus_Module_Name, BYTE bModbus_SlaveID, BYTE channel, unsigned int *Value); //== Get GPS information // return: // 0: No Error // 1: don't establish the connection // 2: Modbus Data are invalid // 4: Station ID or Modbus Slave ID is invalid. // 5: Module didn't enable GPS function. EXPORTS int __stdcall GET_Modbus_GPS(unsigned int iStationID, BYTE *bModbus_Module_Name, BYTE bModbus_SlaveID, char *Value); //== Write single Channel DO // parameter: // bValue: 0=OFF, 1=ON // return: // 0: No Error // 4: Station ID or Modbus Slave ID is invalid. EXPORTS int __stdcall WRITE_Modbus_DO_Channel(unsigned int iStationID, BYTE *bModbus_Module_Name, BYTE bModbus_SlaveID, BYTE bChannel, BYTE bValue); //== Write Multi-Channel DO // parameter: // ulValue: DO value --> 1 channel is 1 bit // return: // 0: No Error // 4: Station ID or Modbus Slave ID is invalid. EXPORTS int __stdcall WRITE_Modbus_DO(unsigned int iStationID, BYTE *bModbus_Module_Name, BYTE bModbus_SlaveID, unsigned long ulValue); //== Write single Channel AO // parameter: // usValue: AO value // return: // 0: No Error // 4: Station ID or Modbus Slave ID is invalid. EXPORTS int __stdcall WRITE_Modbus_AO_Channel(unsigned int iStationID, BYTE *bModbus_Module_Name, BYTE bModbus_SlaveID, BYTE bChannel, unsigned short usValue); //== Set single Channel Counter as 0 // return: // 0: No Error // 4: Station ID or Modbus Slave ID is invalid. EXPORTS int __stdcall WRITE_Modbus_CountZero_Channel(unsigned int iStationID, BYTE *bModbus_Module_Name, BYTE bModbus_SlaveID, BYTE bChannel); //== Get soft-WDT value of RTU Center (add 1 every second) EXPORTS unsigned int __stdcall Get_RTUWDT(void);