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

📄 monitor.h

📁 MDF监控源码2
💻 H
字号:

#pragma once
#include "eqpool.h"
#include "system.h"
//#include "dataanalyse.h"
#include "protocol.h"
#include "listinfoframe.h"

#include "serialport.h"
#include "socketcomm.h"
#include "gsmcomm.h"
#include "media.h"

#pragma comment(lib,"CMSerial.lib")
#pragma comment(lib,"CMTCPServer.lib")
#pragma comment(lib,"CMGSMComm.lib")

//#include "..\\CMTCPServer\\CMTCPServer\\udpserver.h"
//#include "..\\CMSerial\\CMSerial\\serialport.h"

// CMonitor 对话框

//##ModelId=4652869F01B5
class CMonitor : public CWnd
{

public:
	//##ModelId=4652869F01C5
	CMonitor();   // 标准构造函数
	//CMonitor();   // 标准构造函数
	//##ModelId=4652869F01C6
	virtual ~CMonitor();
// 对话框数据
//enum { IDD = IDD_MONITOR };

protected:
	DECLARE_DYNAMIC(CMonitor)
	//##ModelId=4652869F01D4
	static UINT SendThd(LPVOID lpWnd);
	DECLARE_MESSAGE_MAP()

	//##ModelId=4652869F01E5
	afx_msg void OnSetFocus(CWnd *pOldWnd);


//{{AFX_MSG(CMDFDlg)

	//##ModelId=4652869F01F4
	afx_msg LRESULT onCom_RXChar(WPARAM wParam, LPARAM lParam);
	//##ModelId=4652869F0203
	afx_msg LRESULT onSockReadString(WPARAM wParam, LPARAM lParam);
	//##ModelId=4652869F0213
	afx_msg LRESULT onStatusChange(WPARAM wParam, LPARAM lParam);		//设备状态改变
	//##ModelId=4652869F0224
	afx_msg LRESULT onAlarming(WPARAM wParam, LPARAM lParam);			//设备状态改变
	//##ModelId=4652869F0233
	afx_msg LRESULT onReadData(WPARAM wParam, LPARAM lParam);			//设备状态改变
	//##ModelId=4652869F0237
	afx_msg LRESULT onSendSMSInfo(WPARAM wParam, LPARAM lParam);		//接收手机短信
	
	//##ModelId=4652869F0245
	char buff[MAX_SIZE];
	//##ModelId=4652869F0251
	int iRev;
	//##ModelId=4652869F0252
	HANDLE				m_hEventArray[3];
	
	//##ModelId=4652869F0261
	CString strReceive;
//}}AFX_MSG
	//##ModelId=4652869F0272
	CStatusBar  m_wndStatusBar;
	//##ModelId=4652869F0277
	CToolBar    m_wndToolBar;
	//CChildView    m_wndView;
	//##ModelId=4652869F0281
	CSplitterWnd  m_SplitterWnd;
	//CMainForm	  m_wndView;


public:
	// 监测服务器

	//CUdpServer		*m_udpServer[2];
	//##ModelId=4652869F0286
	CSocketComm		*m_udpServer[2];

	//##ModelId=4652869F0294
	CEQPool*		m_pEQPool ;				//设备池
	//##ModelId=4652869F02A0
	//CDataAnalyse	*m_pAnalyse;			//数据逻辑处理包
	//##ModelId=4652869F02AF
	CGsmComm		*m_Gsm;					//短信组件

	// 起动系统监测功能
	//##ModelId=4652869F02B3
	BOOL StartMonitoring(void);
	// 停止系统监测功能
	//##ModelId=4652869F02BF
	BOOL StopMonitoring(void);
	// 重新起动监测功能
	//##ModelId=4652869F02CE
	int Restart(void);
	// 关闭监测功能
	//##ModelId=4652869F02DE
	BOOL Close(void);
	// 串口组件
	//CSerialPort		*m_comPort[10];
	//##ModelId=4652869F02EF
	CArray<CSerialPort *,CSerialPort *>  m_comPort;
	//##ModelId=4652869F02F4
	CStringArray	m_comArray;
	//##ModelId=4652869F0301
	CMedia m_pMedia;
	// 取得监测串口号
	//##ModelId=4652869F030D
	int GetComPort(void);
	// 数据访问组件
	//##ModelId=4652869F031D
	CAdoDB *p_adodb;
	// 数据分析处理
	//##ModelId=4652869F0321
	int DataAnalyse(CInfoFrame frame);
	//##ModelId=4652869F032D
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	// 协议处理包
	//##ModelId=4652869F033D
	CProtocol* m_protocol;
	// 命令发送器
	//##ModelId=4652869F034C
	CArray< sUnit,sUnit> m_UnitArray ;
	//##ModelId=4652869F035C
	CArray<CEquipmentPort,CEquipmentPort> m_EquipState;		//MDF列告警设备状态
	CArray<tyCircle,tyCircle> m_CircleList;					//工频环设备状态
	CArray<tyPowerDC,tyPowerDC> m_PowerDCList;				//直流电源柜设备状态
	CArray<tyPowerAC,tyPowerAC> m_PowerACList;				//交流电源柜设备状态
	CArray<tyCable,tyCable> m_CableList;					//电缆监测设备状态

	CListInfoFrame  *m_ListInfo;
	// 送出信息到串口
	//##ModelId=4652869F036B
	int SendInfoToCom(int iPort, CString strBuf);
private:
	// 监测线程指针
	//##ModelId=4652869F037B
	CWinThread *m_pThread,*m_pAnalyseThread;
	
	//线程状态


public:
	// 起动告警查询线程
	//##ModelId=4652869F038A
	BOOL StartAsking(int iSecond);
	//##ModelId=4652869F039A
	BOOL m_AskingStatus,m_thdAnalyseStatus;		//线程当前活动状态
	BOOL m_AskingClose,m_thdAnalyseClose;		//线程关闭变量


public:
	//##ModelId=4652869F03A9
	afx_msg void OnSize(UINT nType, int cx, int cy);
	//##ModelId=4652869F03C8
	afx_msg void OnCmStart();
	//##ModelId=4652869F03D9
	afx_msg void OnCmStop();
	//##ModelId=4652869F03DB
	afx_msg void OnAppExit();



protected:
//	virtual BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult);

	//##ModelId=465286A00000
	afx_msg LRESULT onSoundOpen(UINT wParam,LONG lParam);
	//##ModelId=465286A0000F
	afx_msg LRESULT onSoundDone(UINT wParam,LONG lParam);
	//##ModelId=465286A0002E
	afx_msg LRESULT onSoundClose(UINT wParam,LONG lParam);
	//##ModelId=465286A0003F
	afx_msg LRESULT GsmVoice(WPARAM wParam,LPARAM lParam) ;
	//##ModelId=465286A0005D
	afx_msg LRESULT GsmVoiceClose(WPARAM wParam,LPARAM lParam) ;

public:
	// 初始化监测设备端口状态
	// WEB接收数据包分析
	//##ModelId=465286A0007E
	int __cdecl WebDataAnalyse(CInfoFrame frame);
	// 初始化短信组件
	//##ModelId=465286A00080
	BOOL IniGsmInfo(void);
	// 送出告警信息
	//##ModelId=465286A0008D
	// 关闭GSMMODEM
	//##ModelId=465286A0009D
	BOOL ClsoeGSM(void);
	//afx_msg void OnBnClickedOk();
	//afx_msg void OnBnClickedButton1();
	//afx_msg void OnBnClickedCancel();
	//##ModelId=465286A000AC
	afx_msg void OnCmSound();
	// 数据分析线程函数,队列中有数据时处理数据包,如果无数据时,自动退出线程。
	static UINT DataAnalyseThd(LPVOID lpWnd);
	// 起动数据包分析线程
	BOOL StartAnalyseing(void);
	// 停止数据分析线程
	BOOL StopAnalyseing(void);
	// 停止轮训线程
	BOOL StopAsking(void);
	// 初始设备状态
	int IniEquipmentStatus(int iType);
	// 播放告警声音
	int PlayAlarmSound(long lDevid, UCHAR ucTypeNum);
	// 送出告警信息到维护人员的手机
	int SendAlarmInfoToPhone(long lDevid, CString strInfo);
	// 按照设备ID获得设备的当前状态
	LPVOID GetDevStateByID(long lDevid, UCHAR ucTypeNum);
	// 获得硬件设备使用协议版本号
	int GetProtocolVer(long lDevid);
	// 获得设备地址码
	int GetDeviceAddr(long lDevid);
	// 获取设备制造厂家信息
	int GetDeviceMaker(void);
	// 初始设备
	int IniDevice(long lDevid);
	// 设置新的地址编码
	int SetDeviceAddr(long lDevid, UCHAR ucnewAddr);
	// 获取设备时间
	int GetDeviceTime(long lDevid, CString & strTime);
	// 设置设备时间
	int SetDeviceTime(long lDevid, CString strTime);
	// 获取告警字符内容
	CString GetAlarmString(long lDevid, UCHAR ucTypeNum);
};

⌨️ 快捷键说明

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