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

📄 rightlogin.h

📁 实时监控
💻 H
字号:
#if !defined(AFX_RIGHTLOGIN_H__FD5B8DBD_3DD1_44D9_BBDC_F67E83C55977__INCLUDED_)
#define AFX_RIGHTLOGIN_H__FD5B8DBD_3DD1_44D9_BBDC_F67E83C55977__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// RightLogin.h : header file
//

#include "../net/channel_info.h"
#include "../net/ip_alias.h"
#include "../utils/TransButton.h"
#include "../utils/transgroup.h"
#include "../utils/transradio.h"
#include "../utils/filter_accel.h"
#include "../utils/HScrollListBox.h"
#include "../utils/Label.h"
#include "../utils/Separator.h"
#include "dlgfont.h"
#include "em_dlg.h"
#include "net.h"
#include "SHOWMAPIMAGE.h"

/////////////////////////////////////////////////////////////////////////////
// CRightLogin dialog

#include "list"
#include "../utils/update_data.h"
class video_channel;

class auto_open
{
public:
	CString addr;
	CString pass;
	std::vector<int> chnls;

	auto_open()
	{
	}
	auto_open(LPCTSTR _addr, LPCTSTR _pass, const std::vector<int>& _chnls)
	{
		addr = _addr;
		pass = _pass;
		chnls = _chnls;
	}
	auto_open(const auto_open& ref)
	{
		*this = ref;
	}
	auto_open& operator=(const auto_open& ref)
	{
		if( this == &ref )
			return *this;

		addr = ref.addr;
		pass = ref.pass;
		chnls = ref.chnls;
		return *this;
	}
};

struct alarm_information
{
	ULONG ip;
	USHORT port;
	TREC_ALARMINFO alarm_info;
};

struct alarm_id 
{
	ULONG	stationid;
	ULONG	signalid;
	int alarmtime;
};

struct alarm_output
{
	ULONG	ip;
	USHORT	port;
	int alarmtime;
};

struct reconnect_window
{
	int window;
	ULONG ip;
	USHORT port;
	int channel;
};

typedef std::vector<alarm_id> idvector;
typedef idvector::iterator vit;

typedef std::vector<alarm_output> outputvector;
typedef outputvector::iterator oit;

//##ModelId=3F90BAB00384
class CRightLogin : public em_dlg<accel_dlg<CDialog> >
{
	typedef std::list<auto_open> auto_open_list;
	typedef auto_open_list::iterator open_it;
	
	int  last_refresh;
	int  tcp_refresh;

	auto_open_list open_list;

	idvector id_list;

	outputvector outlist;

	void add_open_chnl(CString cmd);

	void parse_cmd_line();
	
	//##ModelId=3F90BAB00399
	NET_HANDLE net;
	
	//##ModelId=3F90BAB003A2
	void close_all();
	
	//##ModelId=3F90BAB003AC
	void login(LPCTSTR ipport, LPCTSTR dvrname, LPCTSTR user, LPCTSTR password, bool m_bool);
	//##ModelId=3F90BAB003CA
	void logout();

	bool openfile(CString m_name,CString m_pass);

	void openpopedom(CString m_name);

	void opensetting();

	void close_local_channel( int window);
	void close_remote_channel(int window);

	void channelopensetting(CString m_str);

	void open_channelvideo(const ip_port& ipp,int channel,int window,int nettyp);

	bool m_opensetbool[120],m_openping[120],m_loginagain[120],m_showpopedom[120];

	video_channel* choosewindow(LPARAM l);

	video_channel* choosewindowfree();

	void init_login_dvr_popedom(nt_cmd_login_ok* clo);

	int check_init_popedom(nt_cmd_login_ok* clo);

	int get_vod_window_open(ULONG ip, USHORT port);

	void open_log_file();

	void close_log_file();

	bool check_write_file();

	void open_log_alarm_file();

	void close_log_alarm_file();

	bool check_write_alarm_file();

	void set_directory();

	void set_window_poll(int window);

	void list_operation(int m_channels_count, int m_item);

	int find_position();

	bool find_scene_dvrname(CString dvrname,CString m_scene);

	void on_apart_alarm(ULONG ip, USHORT port, USHORT value, USHORT type, CString m_type_name);

	USHORT check_alarm_channel(USHORT m_old, USHORT m_new);

	int que_alarm_group(ULONG ip);

	void on_alarm_set(int group, USHORT m_value, USHORT m_type);

	void on_close_vod(video_channel *p);

	void close_channel_window(int window);

	void check_logout(ULONG ip, USHORT port);

	CString m_temstation[120];

	vit find_alarm_list(ULONG sid, ULONG sgid);

	oit find_output_list(ULONG ip, USHORT port);

	
	//##ModelId=3F90BAB003E1
	static CRightLogin* self;

	int m_machine_length;
	
	//##ModelId=3F90BAB10015
	MSG1(on_login);

	MSG1(on_login_again);

	MSG1(on_del_close);

	MSG1(kill_window_timer);

	MSG1(get_disk_info_ok);

	MSG1(on_login_update);
	//##ModelId=3F90BAB1001F
	MSG1(on_channel_opened);
	//##ModelId=3F90BAB1003D
	MSG1(on_channel_closed);
	//##ModelId=3F90BAB10051
	MSG1(on_alarm);

	MSG1(on_alarm_server);

	MSG1(on_req_failure);

	MSG1(on_new_version);

	MSG1(on_disconnect);

	MSG1(on_begin_talk);
	
    MSG1(on_fail_talk);	

	MSG1(get_zh_decstate);

	MSG1(ele_map_open_vedio);

	//virtual void on_login_success(IPPORT_TYPE, ULONG channel_count, int privilege);
	//virtual void on_logout_success(IPPORT_TYPE);

	//virtual void on_channel_opened(IPPORT_TYPE, ULONG mip, USHORT mport, ULONG channel);
	//virtual void on_channel_closed(IPPORT_TYPE, ULONG channel);
	
	// 从notif_channel通知
//	virtual bool on_close_chnl(int channel, channel_info& ref);
	
//	virtual bool on_open(int index, void* vc_new);
//	virtual bool on_close(int index);
	//##ModelId=3F90BAB201BB

	friend void send_alarm_output(ULONG ip, USHORT port, int output);

	friend bool get_station_state(CString m_station, int address);

	friend void write_log_file(CString m_string);

	friend void get_disk_info(ULONG ip, USHORT port);

	friend bool check_sel_channel(ULONG ip, USHORT port, int m_channel);

	friend PRIVILEGE get_priv(LPCTSTR alias);

	friend PRIVILEGE get_priv(ULONG ip, USHORT port);

	friend bool talk_status();

	friend bool check_version(ULONG ip, USHORT port, PRIVILEGE version);

	friend bool check_popedom(ULONG ip, USHORT port, int channel, int position);

	friend bool check_channel_postion_popedom(ULONG ip, USHORT port, int channel, int position);
	//##ModelId=3F90BAB201EC
	friend void fill_combo(CComboBox*);
	//##ModelId=3F90BAB20201
	friend void get_addr(LPCTSTR alias, ULONG& ip, USHORT& port);
	//##ModelId=3F90BAB2023D
	friend void set_net_opt(LPCTSTR alias, DWORD opt, void* stuff, OPT_SET_CALLEE cb);
	//##ModelId=3F90BAB2028D
	friend void get_net_opt(LPCTSTR alias, DWORD opt, int channel, OPT_GET_CALLEE cb);
	
	friend void get_net_opt_file(LPCTSTR alias, byte *m_byte, OPT_GET_CALLEE cb);
	friend void get_net_opt_backup_file(LPCTSTR alias, byte *m_byte, OPT_GET_CALLEE cb);
	//##ModelId=3F90BAB202DD
	friend int get_chnls(LPCTSTR alias);

	friend int get_chnls(CString dvrname);
	//##ModelId=3F90BAB202FB
	friend int get_chnls(ULONG ip, USHORT port);

	friend USHORT get_port(ULONG ip);
	//##ModelId=3F90BAB20323
	friend CString get_alias(const ip_port& ipp);
	friend CString get_dvrname(const ip_port& ipp);
	//##ModelId=3F90BAB20341

	friend bool start_talk();
	//##ModelId=3F90BAB2037D
	friend bool stop_talk();

	bool stop_talk(video_channel* p);

	friend void check_talk_condition(ULONG ip, USHORT port, bool m_bool);

	friend void start_bk(LPCTSTR alias, void* opt, BACKUP_CALLEE cb);
	//##ModelId=3F90BAB2037D
	friend void stop_bk(LPCTSTR alias);
	//##ModelId=3F90BAB20388
	friend video_channel* who_opened_it(LPCTSTR alias, int channel);

	friend bool there_is_d1();

	friend void clear_all_alarm(ULONG ip, USHORT port);

	void post_alarm_msg(ULONG ip, USHORT port, USHORT m_value, USHORT m_type);

	void ele_map_deal(ULONG ip, USHORT port, USHORT m_value, USHORT m_type);

	void open_alarm_channel( ip_port ipp, USHORT motion_alarm);

	void ball_alarm(ip_port ip, USHORT value, CString m_type);

	void open_alarm_channelctl();

	void open_window_poll(int window);

	bool check_poll();

	void * check_open_vedio();

	void * check_login();

	void open_channel_map_video(const ip_port& ipp,int channel);

	void show_map_dialog(const ip_port& ipp,int channel);
	
	//##ModelId=3F90BAB10065
	channel_mgr cmgr;	// 图像通道管理器
	//##ModelId=3F90BAB1006F
	ip_alias_mgr ipmgr;	// IP别名管理器

	int m_login_nub,m_open_vedio_nub;

	bool m_alarm_video_lock;

	BOOL m_boolopenalarm, m_boolmaxwindow;

	//##ModelId=3F90BAB10079
	CString alias(const channel_info& ci);
	//##ModelId=3F90BAB1008D
	ip_port current_sel_ipp();
	
	//##ModelId=3F90BAB100A1

	void update_list();

	void update_list(CString m_str,int m_station);

	video_channel* get_open_channel_window(ip_port ipp, int channel);

	BOOL check_open_channel_window_all(ip_port ipp, int channel);

	void  sperate_alarm_channels(ip_port ipp, USHORT motion_alarm);

	ip_port & parseloginname(CString m_loginname);

	void open_net_alarm(ULONG ip, USHORT port, int channel, int output );

	void close_net_alarm(ULONG ip, USHORT port, int channel, int output);

	bool find_station_channel(ULONG pstid, ULONG psgid, ULONG &ip, USHORT &port, int &channel, BOOL m_bool, int & output);

	/// @param ipp 主机
	/// @param channel 频道号
	//##ModelId=3F90BAB100AB
	void open_channel(const ip_port& ipp, int channel,int window);

	bool check_write_file_time(int year,int month, int day);
	
	//##ModelId=3F90BAB100C9
	LRESULT on_mute(WPARAM, LPARAM);

	friend int get_data_stream(int group, unsigned char * buf, int len, int type, DWORD d1, DWORD d2);

	friend void add_draw_image(HDC& phDc, DWORD d1, DWORD d2);

	LRESULT refresh_bitrate(WPARAM w, LPARAM l);

	void    user_logout(WPARAM w, LPARAM l);

// Construction
public:
	//##ModelId=3F90BAB100DE
	static  DWORD WINAPI reconnect(void * lpParam);

	int m_closewindow;
	
	CRightLogin(CWnd* pParent = NULL);   // standard constructor

	//##ModelId=3F90BAB100FB
	static CRightLogin* the_one();

	bool onloginfuc(CString m_name,CString m_pass);

	bool showpopedom(ip_port ipp, int position);

	bool checkloginip(ULONG ip, USHORT port);

	void write_alarm_logfile(ip_port ipp, USHORT alarm_channels, USHORT type, char * pdescrip);
	
	void close_map_image();
	
// Dialog Data
	//{{AFX_DATA(CRightLogin)
	enum { IDD = IDD_RIGHT_LOGIN };
	CComboBox m_list_scence;
	CTransButton	m_btn_rclose;
	CTransButton    m_btn_slow;
	CTransButton	m_btn_fast;
	CTransButton	m_btn_cnettype;
	CLabel	m_21;
	CLabel	m_22;
	CLabel  m_19;
	CLabel	m_10;
	CLabel	m_l3;
	CLabel	m_l2;
	CLabel	m_l1;
	CSeparator	m_s;
	CTransButton    m_user_logout;
	CTransButton    m_login_tem;
    CTransButton    m_logout_tem;
	CTransButton    m_pollup;
	CTransButton    m_pollnext;
	CTransButton	m_btn_close;
	CTransButton	m_btn_alias;
	//CTransButton	m_btn_logout;
	CTransButton	m_btn_login;
	CTransGroup m_grp4;
	//CTransGroup m_grp3;
	CTransGroup	m_grp2;
	CTransGroup m_grp1;
	CHScrollListBox	m_lstLogged;
	CEdit m_tem_ctl_login;

	CLabel m_static_ip;
    CLabel m_static_user;
	CLabel m_static_pass;

	CLabel	m_8;
	CTransRadio m_rd1;
	CTransRadio m_rd2;
	//CLabel	m_7;
//	CLabel	m_6;
//	CLabel	m_5;
	CLabel	m_3;
	CLabel	m_2;
	CString	m_loginip;
	CString	m_password;
	CString	m_strChannelIndex;
	CString	m_strChannelIP;
	CString	m_strVideoTitle;
	CString m_strChannelBitrate;
	CString m_strNetType;
	CString	m_priv;
	CString m_scene;
	BOOL	m_slow;
	CString m_login_temip;
	CString m_tem_password;
	CString m_login_temuser;
	CString	m_tem_login_scene;

	//}}AFX_DATA


// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CRightLogin)
	protected:
	//##ModelId=3F90BAB10336
	virtual BOOL PreTranslateMessage(MSG* pMSG);
	//##ModelId=3F90BAB10354
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:

	alarm_information alarm_inf[120];
	reconnect_window  reconnect_win[16];
    bool m_auto_poll;
	CSHOWMAPIMAGE *p_map_image;

	int  onfilemax(int window);
	//##ModelId=3F90BAB1037C
	void OnRightClickList();

	CString checkchannel(int m_nub);

	void onwindowpoll(int window);

	void window_poll_clear();
	//##ModelId=3F90BAB10386
	LRESULT OnConnect(WPARAM, LPARAM);

	//##ModelId=3F90BAB103AE
	LRESULT on_open_vod(WPARAM, LPARAM);
	//##ModelId=3F90BAB103D6
	LRESULT on_close_vod(WPARAM, LPARAM);
	//##ModelId=3F90BAB20016
	LRESULT on_set_vod_speed(WPARAM, LPARAM);
	//##ModelId=3F90BAB20034
	VOD_SPEED on_get_vod_speed(WPARAM, LPARAM);

	//##ModelId=3F90BAB20052
	LRESULT on_local_rec(WPARAM, LPARAM);
	//##ModelId=3F90BAB20084
	LRESULT on_get_local_rec(WPARAM, LPARAM);

	//##ModelId=3F90BAB200AC
	LRESULT on_snapshot(WPARAM, LPARAM);
	
	//##ModelId=3F90BAB200CA
	LRESULT on_video_wnd(WPARAM, LPARAM);
	//##ModelId=3F90BAB200F2
	LRESULT on_update_wnd(WPARAM, LPARAM);

	void on_show_menu(WPARAM, LPARAM);
	void on_menu_close(WPARAM, LPARAM);
	void menu_open_channel(WPARAM, LPARAM);
	// Generated message map functions
	//{{AFX_MSG(CRightLogin)
	afx_msg void OnSlow();
	afx_msg void OnFast();
	afx_msg void OnClose();
	afx_msg void OnChangeNetType();
	afx_msg void OnLogin();
	afx_msg void Onpollup();
	afx_msg void OnDestroy();
	afx_msg void Onpollnext();
	afx_msg void OnLogintemp();
	afx_msg void Onlogouttemp();
	afx_msg void OnDblclkList();
	afx_msg void Onuserlogout();
	virtual BOOL OnInitDialog();
	afx_msg void OnCloseRemote();
	afx_msg void OnChangetemip();
	afx_msg void OnSetfocusScene();
	afx_msg void OnSelchangeScene();
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg LRESULT OnUpdateData(WPARAM, LPARAM);
	afx_msg void OnMenuSelect(UINT nID);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

	void OnDbClkLogin(CString m_ip);
};
struct log_file
{
    char use[20];
	int  year;
	int  month;
	int  day;
	char time[10];
	char operation[100];
	void clear()
	{
	  year=0;
	  month=0;
      day=0;
      memset(use,'\0',20);
	  memset(time,'\0',10);
	  memset(operation,'\0',100);
	}
};

class log_alarmfile
{
public:
    char use[20];             //报警用户
	int year;
	int month;
	int day;
	
	char time[10];             //报警时间
    char ip[20];               //报警ip
	char dvrname[20];          //报警主机名
	USHORT	 port;             //报警端口
	USHORT  alarmchannel;      //报警信息
    USHORT  type;              //报警类型
	char description[100];     //报警描叙
   
       //( 如果是零,代表该中方式不报警)
	void clear()             //清除变量元素
	{
	  port=0;
	  alarmchannel=0;
      type = 0;
      memset(use,'\0',20);
	  memset(time,'\0',10);
	  memset(ip,'\0',20);
	  year=0;
	  month=0;
	  day=0;
	  memset(description,'\0',100);
	}

};



//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_RIGHTLOGIN_H__FD5B8DBD_3DD1_44D9_BBDC_F67E83C55977__INCLUDED_)

⌨️ 快捷键说明

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