You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
135 lines
4.7 KiB
C
135 lines
4.7 KiB
C
|
|
#ifndef __COMM_PORT_H_ICL__
|
|
#define __COMM_PORT_H_ICL__
|
|
|
|
#include "common.h"
|
|
|
|
#define MSGTYPE_BAOHU_BASE 200
|
|
#define MSGTYPE_BAOHU_103CMD MSGTYPE_BAOHU_BASE+0
|
|
#define MSGTYPE_BAOHU_103DATA MSGTYPE_BAOHU_BASE+1
|
|
#define MSGTYPE_BAOHU_SCADACMD MSGTYPE_BAOHU_BASE+2
|
|
#define MSGTYPE_BAOHU_SCADADATA MSGTYPE_BAOHU_BASE+3
|
|
|
|
// 从 config.ini 或 portconfig.ini 读信息
|
|
u_long GetPrivateProString(const char *section, const char *entry, const char *defaultstr, char *result, int len, char *inifile);
|
|
int GetPrivateProInt(const char *section, const char *entry, int idefault, char *inifile);
|
|
u_long GetPrivateProString2(const char *section, const char *entry, const char *defaultstr, char *result, int len, HDSFILE hFile);
|
|
int GetPrivateProInt2(const char *section, const char *entry, int idefault, HDSFILE hFile);
|
|
|
|
int PutDataToBuf( DATA_BUF *buf, u_char *msg, int len );
|
|
int GetDataFormBuf( DATA_BUF *databuf, u_char *buf, int len, int clrflag );
|
|
|
|
// 读设备信息,检查芯片状态和读芯片类型和频率
|
|
void ReadPortConfigInfo( u_short );
|
|
void ReadPortConfigInfoEx(u_short);
|
|
|
|
void OpenAllPort( void );
|
|
void CloseOnePort( int commid );
|
|
void CloseAllPort( void );
|
|
void PollAllSerialPort( void );
|
|
void PollAllNetPort( void );
|
|
|
|
int SetPntMsg( int port, int point, void *pntmsg, BYTE type, BYTE attr );
|
|
int GetPntMsg( int port, int point, void *pntmsg, BYTE type, BYTE attr );
|
|
int SetPorvPntMsg( int port, int point, void *pntmsg, BYTE type, BYTE attr );
|
|
int GetPorvPntMsg( int port, int point, void *pntmsg, BYTE type );
|
|
|
|
int CheckPollCmdBufEmpty( int port );
|
|
int PutPollCmdToBuf( int port, int type, WORD wait, char *buf, int len );
|
|
void SendCmdFormPollCmdBuf( int port );
|
|
|
|
// wen 2005.09.08 清空指令缓冲区中的所有指令
|
|
void ClearAllCmdFromPollCmdBuf(int port);
|
|
// wen 2004.10.25 公布函数接口
|
|
void ClearCmdFormPollCmdBuf( int port );
|
|
void ClearCmdFormPollCmdBufEx( int port, char *file, int line );
|
|
void ClearCmdAllFlag( int port );
|
|
int GetCmdFormPollCmdBuf( int port, u_char *buf, int len );
|
|
int ReGetCmdFormPollCmdBuf( int port, u_char *buf, int len );
|
|
|
|
int GetMaxPort();
|
|
int GetPortProtocolIdx(char *name);
|
|
char *GetPortProtocolName(int Idx);
|
|
|
|
// wen 2004.11.16 增加转发soe数据的处理
|
|
// 返回缓冲区中的soe数据数量
|
|
int ProvWriteSoeData( int provport, SOE_DEF *ptrSoe );
|
|
int ProvAndDelGetSoeData( int provport, SOE_DEF *ptrSoe );
|
|
int ProvHaveSoeData( int provport );
|
|
|
|
// wen 2005.02.23
|
|
void SendDataToPort(int commid, char *buf, int len);
|
|
|
|
// wen 2005.02.28
|
|
void SendYkYtCommand(int commid, char *buf, int len);
|
|
BOOL SendYkYtCommand2(int commid, YKYT_PARAM *pParam);
|
|
int FindProvPntFromYkYtPnt(int commid, int ykytpnt, SIO_PARAM_BAOHU_DEF *pBaohuParam);
|
|
BOOL ProvPortYkYtIsTimeOut( int commid, PROV_YKYT_DEF *pProvYkYt );
|
|
BOOL IsProvYkYtAck(int commid, PROV_YKYT_DEF *pProvYkYt);
|
|
BOOL ShmGetDispYkYtFlag();
|
|
BOOL ShmGetDispHostLinkFlag();
|
|
|
|
// wen 2005.04.18 内存的分配与释放
|
|
void PortMemoryMalloc( int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam );
|
|
void PortMemoryMallocEx( int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam );
|
|
BOOL PortDataPntInit(int commid, int type, SIO_PARAM_BAOHU_DEF *pBaohuParam);
|
|
void PortMemoryFree( int commid, SIO_PARAM_DEF *pGenParam );
|
|
void PortWriteDataFree( int commid );
|
|
|
|
BOOL IsBaoHuPtr( int commid );
|
|
BOOL IsExtInfoPtr( int commid );
|
|
BOOL IsSerialPtr( int commid );
|
|
|
|
/*!
|
|
\brief 获取端口打开标识
|
|
\param commid -- 端口号
|
|
\param rwflag -- 读标识还是写标识
|
|
\返回值 retval-- 返回端口读或者写状态
|
|
*/
|
|
int ShmGetPortFlag(int commid, int rwflag);
|
|
|
|
// 保护数据处理
|
|
/*!
|
|
\brief 发送保护数据到实际的装置
|
|
\param commid -- 端口号
|
|
\param rtumsg -- 转发的保护指令
|
|
\note
|
|
指令格式暂时用部颁103规约格式
|
|
*/
|
|
void SendProtectCmdToDev(int commid, RTUMSG *rtumsg);
|
|
|
|
/*!
|
|
\brief 将实际装置数据保存到指令下发端口
|
|
\param rtumsg -- 转发的保护指令
|
|
\note
|
|
指令格式暂时用部颁103规约格式
|
|
*/
|
|
void PutBaohuDataToPort(RTUMSG *rtumsg);
|
|
void PutBaohuDataToPortEx(int commid, RTUMSG *rtumsg);
|
|
|
|
/*!
|
|
\brief 将数据发送到所有的scadaprotect规约端口
|
|
\param rtumsg -- 转发的保护指令
|
|
*/
|
|
void SendDataToAllScadaProtectPort(RTUMSG *rtumsg);
|
|
|
|
/*!
|
|
\brief 获取指定装置的保护数据库
|
|
\param commid -- 端口号
|
|
\param iProvAddr -- 保护装置转发地址,端口统一编排的地址
|
|
\param ppBaoHuDB -- 存储保护装置保护数据的指针(PAI,PDI,PFIX...)
|
|
\retval 返回该装置保护数据组数
|
|
*/
|
|
int GetBaohuDB(int commid, int iProvAddr, GROUPDEF **ppBaoHuDB);
|
|
|
|
int GetSioParam(SIO_PARAM_DEF **ppParam);
|
|
int GetDevParam(DEV_DEF **ppParam);
|
|
int SetCurPort(int PortNo);
|
|
int GetCurPortEx();
|
|
int SetDispFlag(int iFlag);
|
|
|
|
// 获取全局变量
|
|
SIO_PARAM_DEF *GetSioParamPtr();
|
|
#endif
|
|
|