⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 103.h

📁 规约转换 103.104 规约转换 适用于电力系统
💻 H
字号:
// 103 protocol DLL implementation module
// 103.h : main header file for the 103 DLL
//
// This is a part of the Nice Information's source code.
// Copyright (C) 1994 Nice Information Corporation
// All rights reserved.
//
// Complier: Microsoft Visual C++ 5.00, MFC 4.2
//
// create : Doo, 1998.12.28
// modify : Doo, 2000.4.20 for NZ-103
//

 #if !defined(AFX_103_H__4D8E8968_A502_11D2_948D_0000B4746F2C__INCLUDED_)
#define AFX_103_H__4D8E8968_A502_11D2_948D_0000B4746F2C__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

#ifndef __AFXWIN_H__
	#error include 'stdafx.h' before including this file for PCH
#endif

#include "resource.h"		// main symbols

#include "nsclass.h"
#include "dbtempl.h"

// ini filename
#define PROTOCOL_INIFILE			"103.ini"

// timer elapse in millisecond
#define TIMER_ELAPSE				100

// name of the protocol
#define PROTOCOL103NAME				"5-103"

// broadcast data length
#define BROADCASTDATALEN			41

// port for data & broadcasting
#define NS_PROTOCOL_PORT			0x418
#define NS_BROADCASTING_PORT		0x408

/////////////////////////////////////////////////////////////////////////////
// C103App
// See 103.cpp for the implementation of this class
//

class C103App : public CWinApp
{
public:
	C103App();
	~C103App();

public:
	// db template
	CDBTemplate m_dbTemplate;

	// channel list
	CList<CChannel*, CChannel*> m_ListChannel;
	// equipment list
	CList<CEquipment*, CEquipment*> m_ListEquipment;

	// timer ID
	UINT m_uTimer;

	// broadcast socket
	SOCKET m_BroadcastSocket;
	// broadcast type
	BYTE m_btType;

	// fault signal
	WORD m_wRtuSignal, m_wIndexSignal;

	// menu
	CMenu m_Menu;

public:
	BOOL m_bProtectValue;

	// timeout for receive in millisecond
	UINT m_uTimeOut;
	// timeout for broadcast name in millisecond
	UINT m_uTimeBroadcast, m_uBroadcastCounter;
	// timeout for time-sync in millisecond
	UINT m_uTimeSync, m_uSyncCounter;
	// timeout for general interrogation
	UINT m_uTimeGI, m_uGICounter;

public:
	void LoadData();

	CChannel* GetChannel( CString szIP );
	CChannel* GetChannel( SOCKET socket );

	CChannel* AddChannel( CString szIP );

	CEquipment* GetEquipmentByOrder( WORD wOrder );

	int GetPointOrder( int nType, BYTE btType, int nGroup, int nCode );
	int GetPointCode( int nType, BYTE btType, int nOrder, BYTE& btGroup, BYTE& btCode );
	int GetRelayCode( int nType, int nOrder, BYTE btRelayValue, BYTE& btValue );

	void AdjustLocalTime( SYSTEMTIME* pLocalTime );
	void ProcessBroadcastData( CString szAddr );
	void BroadcastName();

	void NotifyMainframe( int nType, CString szIP, UINT uPort );
	
	void OnFaultSignal( BOOL bFault );

public:
	void NSSockCallBack( UINT uMsg, const char FAR* addr, PORT port, SOCKET socket );
	void TimerProc();

	int InitPrem();
	void ExitPrem();
	int SendPremMessage( UINT msg, WPARAM wParam, LPARAM lParam );

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(C103App)
	//}}AFX_VIRTUAL

	//{{AFX_MSG(C103App)
		// NOTE - the ClassWizard will add and remove member functions here.
		//    DO NOT EDIT what you see in these blocks of generated code !
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};


/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_103_H__4D8E8968_A502_11D2_948D_0000B4746F2C__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -