#pragma once #ifdef UCB_EXPORTS #define UCB_API _declspec(dllexport) #else #define UCB_API _declspec(dllimport) #endif #define UCB_MAX_DI 16 #define UCB_MAX_DO 16 #define UCB_COPYDATA_SET 0 #define UCB_COPYDATA_DATA 1 #ifndef MSG_SYN_UCB #define MSG_SYN_UCB WM_USER + 1120 //WPARAM: #define SYN_UCB_IO_ON 1 #define SYN_UCB_IO_OFF 2 #define SYN_UCB_IO_RESET 3 #define SYN_UCB_ECHO 4 #define SYN_UCB_CANDATA 5 #define SYN_UCB_CONNECTLOST 6 #define SYN_UCB_AECSTOPTIME 7 #define SYN_UCB_AECCHANNEL 8 #endif enum UCB_RESULT { UCBRST_NOTOPEN = -1, UCBRST_OK = 0, UCBRST_FAULT = 1, UCBRST_BUSY = 2, }; //--------------------------------------------------------------------------------------- // 作 者:郑丽华 // 日 期:2014-03-11 // 枚举名称:ECOM_UCB_PWM_MODE // 枚举说明:PWM模式 //--------------------------------------------------------------------------------------- typedef enum { UCB_PWMMODE_DISABLE = 0, UCB_PWMMODE_ENABLE = 1, UCB_PWMMODE_ONCE = 2, UCB_PWMMODE_CONTINUOUS = 3, }ECOM_UCB_PWM_MODE; //--------------------------------------------------------------------------------------- // 作 者:郑丽华 // 日 期:2014-03-11 // 枚举名称:ECOM_UCB_EXPO_MODE // 枚举说明:曝光模式 //--------------------------------------------------------------------------------------- typedef enum { UCB_EXPOMODE_0 = 0, UCB_EXPOMODE_1 = 1, UCB_EXPOMODE_2 = 2, UCB_EXPOMODE_3 = 3 }ECOM_UCB_EXPO_MODE; //--------------------------------------------------------------------------------------- // 作 者:郑丽华 // 日 期:2014-03-11 // 枚举名称:ECOM_UCB_CHANNEL_TYPE // 枚举说明:UCB通道类型 //--------------------------------------------------------------------------------------- typedef enum { UCB_DI = 0, UCB_DO = 1, UCB_ALL = 2 }ECOM_UCB_CHANNEL_TYPE; //--------------------------------------------------------------------------------------- // 作 者:郑丽华 // 日 期:2013-10-23 // 结构名称:ECOM_UCB_CHANNEL_MAP // 结构说明:UCB通道ID与名称之间的Map信息 //--------------------------------------------------------------------------------------- typedef struct tagECOMUCBChannelMap { CString strVer; CString strChannelName[32]; ECOM_UCB_CHANNEL_TYPE eChanneltype[32]; UCHAR cChannelID[32]; tagECOMUCBChannelMap& operator =(const tagECOMUCBChannelMap &ChannelMap) { strVer = ChannelMap.strVer; for(int i=0;i<32;i++) { strChannelName[i] = ChannelMap.strChannelName[i]; eChanneltype[i] = ChannelMap.eChanneltype[i]; cChannelID[i] = ChannelMap.cChannelID[i]; } return *this; } } ECOM_UCB_CHANNEL_MAP; //--------------------------------------------------------------------------------------- // 作 者:郑丽华 // 日 期:2013-10-23 // 结构名称:ECOM_UCB_IO_CONF // 结构说明:UCB通道设置 //--------------------------------------------------------------------------------------- typedef struct tagECOMUCBIOConfigure { CString strVer; UCHAR unSet1[4][32]; UCHAR unSet2[4][32]; UCHAR unSet3[4][32]; UCHAR unRelay1[4][32]; UCHAR unRelay2[4][32]; UCHAR unRelay3[4][32]; tagECOMUCBIOConfigure& operator =(const tagECOMUCBIOConfigure &IOConf) { strVer = IOConf.strVer; memcpy((void *)&unSet1,(void *)&IOConf.unSet1,32*4); memcpy((void *)&unSet2,(void *)&IOConf.unSet2,32*4); memcpy((void *)&unSet3,(void *)&IOConf.unSet3,32*4); memcpy((void *)&unRelay1,(void *)&IOConf.unRelay1,32*4); memcpy((void *)&unRelay2,(void *)&IOConf.unRelay2,32*4); memcpy((void *)&unRelay3,(void *)&IOConf.unRelay3,32*4); return *this; } } ECOM_UCB_IO_CONF; //--------------------------------------------------------------------------------------- // 作 者:郑丽华 // 日 期:2014-04-11 // 结构名称:ECOM_UCB_CAN_DATA // 结构说明:CAN数据包 //--------------------------------------------------------------------------------------- #define MAX_CANDATA_LEN 64 typedef struct tagECOMUCBCanData { int nCanType; int nCanAddr; int nCanLen; UCHAR cCanStr[MAX_CANDATA_LEN]; //CString strAddr; //CString strDATA; } ECOM_UCB_CAN_DATA; //--------------------------------------------------------------------------------------- // 作 者:郑丽华 // 日 期:2014-07-4 // 结构名称:ECOM_UCB_CAN_SET // 结构说明:CAN设置 //--------------------------------------------------------------------------------------- #define MAX_CANFILTER_LEN 16 typedef struct tagECOMUCBCanSet { int nCanType; int nBaud; char cFilter[MAX_CANFILTER_LEN]; int nEnable; } ECOM_UCB_CAN_SET; extern "C" UCB_API int _stdcall UCB_BeginLog(CString strPath = _T(""),CString strName = _T("UCB"),int nLogDays = 15,int nLogMode = 5); extern "C" UCB_API int _stdcall UCB_Open(HWND hWnd,CString strCommType,int nPort,int nBaud); extern "C" UCB_API int _stdcall UCB_Close(); extern "C" UCB_API int _stdcall UCB_Restart(); extern "C" UCB_API int _stdcall UCB_Reset(); extern "C" UCB_API int _stdcall UCB_SetDObyName(CString strName, bool bStatus); extern "C" UCB_API int _stdcall UCB_SetDObyIndex(int nIndex, bool bStatus); extern "C" UCB_API int _stdcall UCB_SetPWM(CString strName,int nCycle,int nPulse); extern "C" UCB_API int _stdcall UCB_SetPWMEnable(CString strName,ECOM_UCB_PWM_MODE eMode,bool bEnable); extern "C" UCB_API int _stdcall UCB_ReadSerial(char *strSerial); extern "C" UCB_API int _stdcall UCB_WriteSerial(char *strSerial); extern "C" UCB_API int _stdcall UCB_SetExpoMode(ECOM_UCB_EXPO_MODE nMode,int nCount); extern "C" UCB_API int _stdcall UCB_VerifyVer(); extern "C" UCB_API int _stdcall UCB_Echo(bool bSyn = true); extern "C" UCB_API int _stdcall UCB_ReadVer(int nType,char *strVer); extern "C" UCB_API int _stdcall UCB_LoadMapFile(CString strPath,ECOM_UCB_CHANNEL_MAP *pstChannelMap); extern "C" UCB_API int _stdcall UCB_SaveMapFile(CString strPath,ECOM_UCB_CHANNEL_MAP *pstChannelMap); extern "C" UCB_API int _stdcall UCB_GetIOConf(int nZone,ECOM_UCB_IO_CONF *pstIOConf); extern "C" UCB_API int _stdcall UCB_SaveIOConf(CString strPath,ECOM_UCB_IO_CONF *pstIOConf); extern "C" UCB_API int _stdcall UCB_DownLoadIOConf(CString strPath,int nZone); extern "C" UCB_API int _stdcall UCB_FactReset(); extern "C" UCB_API int _stdcall UCB_EEPROMCopy(int nZone1,int nZone2); extern "C" UCB_API int _stdcall UCB_GetIndex(ECOM_UCB_CHANNEL_TYPE eType, CString strName,int &nIndex); extern "C" UCB_API int _stdcall UCB_GetName(ECOM_UCB_CHANNEL_TYPE eType, int nIndex, CString &strName); extern "C" UCB_API int _stdcall UCB_CANSet(int nDataType,int nBaud,char *cFilter,int nEnable); extern "C" UCB_API int _stdcall UCB_CANSend(int nDataType,CString strID,CString strData,int nWaitTime); extern "C" UCB_API int _stdcall UCB_ABSSet(int nChannel,bool bAmpli,int nValue,bool bEnable); extern "C" UCB_API int _stdcall UCB_ADCSet(char cChannel,bool bEnable); extern "C" UCB_API int _stdcall UCB_ADCGet(char cChannel,int& nValue); extern "C" UCB_API int _stdcall UCB_AECSet(int nInID,int nOutID,char cIO,int nID,int nTime,int nMode,bool bEnable); extern "C" UCB_API int _stdcall UCB_AECReadStopTime(int nInID,int& nTime); extern "C" UCB_API int _stdcall UCB_GetConfPath(CString& strPath); extern "C" UCB_API int _stdcall UCB_SetConfPath(CString strPath); extern "C" UCB_API int _stdcall UCB_TestSignals(int nOuputChannelID, int nInputChannelID, bool bState, int nWaitTime,int &nUsedTime, int &nErrorCode); extern "C" UCB_API int _stdcall UCB_GetLastError(CString& strError); extern "C" UCB_API int _stdcall UCB_SetWindowName(CString strName);