PrtIEC101.h
上传用户:asikq0571
上传日期:2014-07-12
资源大小:528k
文件大小:3k
- // PrtIEC101.h: interface for the CPrtIEC101 class.
- //
- //////////////////////////////////////////////////////////////////////
- #if !defined(AFX_PRTIEC101_H__3636AC31_7FBF_457D_B90A_BF5DD00C72A3__INCLUDED_)
- #define AFX_PRTIEC101_H__3636AC31_7FBF_457D_B90A_BF5DD00C72A3__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- #include "PrtObj.h"
- // 发送数据特性
- #define YX_SINGLE 0X00
- #define YX_DOUBLE 0X01
- #define YC_TYPEA 0X00
- #define YC_TYPEB 0X01
- #define TIME24 0X00
- #define TIME56 0X02
- #define YK_SINGLE 0X00
- #define YK_DOUBLE 0X01
- #define YK_S_ACK 0X00 //ACK:肯定应答 NAK:否定应答
- #define YK_S_NAK 0X02
- #define YK_E_ACK 0X00
- #define YK_E_NAK 0X04
- class CPrtIEC101 : public CPrtObj
- {
- public:
- CPrtIEC101();
- virtual ~CPrtIEC101();
- public: //虚函数,各规约函数使用时覆盖,实现各自功能
- virtual void SlaveSend();
- virtual void SlaveRec(BYTE recByte); //从站接收
- virtual void MasterRec(BYTE recByte);
- virtual void MasterSend(UINT nIDEvent);
- virtual void CloseTimer();
- virtual void StartTimer();
- virtual void InitPrt();
- public:
- void SPack_C_CI_ACK();
- void SPack_IT_NA();
- void SUnPack_TypeID65H();
- void SPack_C_SC_DC_Echo();
- void SUnPack_TypeID2EH();
- void SUnPack_TypeID2DH();
- void SlaveSend_ChangeYX(UINT nIndex,UINT nNumber);
- void SPack_M_SP_DP_TB(int nIndex, int nNumber);
- void SPack_M_SP_DP_TA(int nIndex, int nNumber);
- void SUnPack_TypeID67H();
- void SPack_M_ME_ND();
- void SlaveSend_Lv1End();
- // void SPack_M_DP_NA();
- void SPack_M_SP_DP_NA();
- void SlaveSend_Lv1YC();
- void SlaveSend_Lv1YX();
- void SUnPack_FC0aH();
- void SUnPack_FC0bH(); //召2级数据
- void SUnPack_FC09H(); //请求链路状态
- void SUnPack_FC00H(); //复位链路
- void SUnPack_Start10H_Unknow();
- void SUnPack_Start68H_Unknow();
- void SUnPack_TypeID64H();
- void SUnPack_Start68H();
- void SUnPack_Start10H();
-
- char m_Addr;
- char m_CauseOfTranLen; //传送原因字节数
- char m_CommAddrLen; //ASDU公共地址字节数
- char m_MsgAddrLen; //信息体地址字节数
- BYTE m_SRecByte[21]; //子站接收主站的报文,最长为21字节(校时报文)
- BYTE m_SAck_LinkR[5]; //链路复位应答报文
- BYTE m_SAck_LinkS[5]; //请求链路状态应答报文
- BYTE m_SAck_Lv2[5]; //2级数据
- BYTE m_SAck_IC[18]; //总召唤应答 (按最大长度)
- BYTE m_SAck_IC_End[18]; //总召唤结束
- BYTE m_SSendByte[261]; //可变帧结构的应答报文,最长为:4 + 255 + 2
-
- enum SlaveReading {StartByte,CtrlByte,AddrByte,CheckByte,EndByte,
- Num_68H_1,Num_68H_2,Start_68H_2,Msg_68H,Check_68H,End_68H} m_SReadState;
- enum SlaveSendLv1 {None,YX,YC} m_SSendLv1; //子站发送1级数据的流程(总召唤)
- int m_SYXAddrToSend;
- int m_SYCAddrToSend;
- int m_SYMAddrToSend;
- char m_YXChara; //发送特性(单点/双点,时标类型)
- char m_YCChara;
- char m_YKChara; //遥控相关特性:bit1 单点/双点;bit2 遥控选择肯定/否定应答;bit3 遥控执行肯定/否定应答;
- char m_FCBFlag; //帧记数,用于判断是否重发
- char m_ACDFlag; //请求访问位
- int m_MsgIndex;
- };
- #endif // !defined(AFX_PRTIEC101_H__3636AC31_7FBF_457D_B90A_BF5DD00C72A3__INCLUDED_)