function MonitorPresetPoint(){
	//websocket连接对象
	MonitorPresetPoint.serverConnection=null;
	
	//登录配置信息
	MonitorPresetPoint.loginConfig=null;
	
	//预置点数据列表
	MonitorPresetPoint.queryprepointlist=null;
	
	//预置点调用是否成功  true:预置点恢复成功,flase:预置点恢复失败,null::预置点方法未调用
	MonitorPresetPoint.isCallPrepoint=null;
}
MonitorPresetPoint.init=function(){
	MonitorPresetPoint();
	WebRtcServer.connectServer&&WebRtcServer.connectServer();
	(window !== top.WebRtcServer.reqPage) && top.WebRtcServer.setReqPage(window);
	//websocket连接对象
	MonitorPresetPoint.serverConnection=serverConnection;
	$.ajax({
		 type:'post',
		 dataType : 'json',
		 url:'menuConfigAction!getDacLoginInfo.do',
		 success:function(m){
			 MonitorPresetPoint.loginConfig={serverIP:m.serverIP,serverPort:m.serverPort,yhzh:m.yhzh,yhmm:m.yhmm};
		 }
	});
};

MonitorPresetPoint.handleResponse=function(event){
	
	if(event.data&&JSON.parse(event.data)){
		
				if(JSON.parse(event.data)['queryprepointlist']){
						MonitorPresetPoint.queryprepointlist=JSON.parse(event.data)['queryprepointlist'];
				}else if(JSON.parse(event.data)['callprepoint']){
						var returnData=JSON.parse(event.data)['callprepoint'];
						if(returnData['result']&&returnData['result'].trim()=='ok')
							MonitorPresetPoint.isCallPrepoint=true;
						else
							MonitorPresetPoint.isCallPrepoint=false;
				}
	}
	console.log('返回的数据',event.data);
};
//查询预置点
MonitorPresetPoint.queryPrepoint=function(obj) {
	if(MonitorPresetPoint.loginConfig){
		var uuidSend = $.uniqueId();
		var channelId = obj.tdbh ;
		if(channelId > 0){
			channelId = channelId - 1;
		}
		//MonitorPresetPoint.serverConnection.send(JSON.stringify({'login': {'ip':'192.168.5.190', 'port':8886, 'user':'imps', 'password':'7070'}, 'uuid': uuidSend}));
	    //MonitorPresetPoint.serverConnection.send(JSON.stringify({'login': {'ip':MonitorPresetPoint.loginConfig.serverIP, 'port':parseInt(MonitorPresetPoint.loginConfig.serverPort), 'user':'imps', 'password':'7070'}, 'uuid': uuidSend}));
		MonitorPresetPoint.serverConnection.send(JSON.stringify({'queryprepointlist': {'fdid': obj.sbbh, 'channelid':channelId},'uuid': uuidSend}));
	}else{
		setTimeout(function(){
			MonitorPresetPoint.queryPrepoint(obj);
		},1000);
	}
};


//添加预置点
MonitorPresetPoint.addPrepoint=function(data) {
	//var data=JSON.stringify({'addprepoint': {'fdid':'201808091236525951', 'channelid':0, 'predefineid':1, 'predefinename':'binkang'}});
	MonitorPresetPoint.serverConnection.send(data);
};
//删除预置点
MonitorPresetPoint.delPrepoint=function(data)  {
	//var data=JSON.stringify({'delprepoint': {'fdid':'201808091236525951', 'channelid':0, 'predefineid':1}});
	MonitorPresetPoint.serverConnection.send(data);
};
//调用预置点
MonitorPresetPoint.callPrepoint=function(obj)  {
	var uuidSend = $.uniqueId();
	var channelId = obj.tdbh ;
	if(channelId > 0){
		channelId = channelId - 1;
	}
	//MonitorPresetPoint.serverConnection.send(JSON.stringify({'login': {'ip':'192.168.5.190', 'port':8886, 'user':'imps', 'password':'7070'}, 'uuid': uuidSend}));
	var data=JSON.stringify({'callprepoint': {'fdid': obj.sbbh, 'channelid': channelId, 'predefineid': obj.presetNum }, 'uuid': uuidSend});
	MonitorPresetPoint.serverConnection.send(data);
};
//关闭websocket连接
MonitorPresetPoint.closeConnection=function(){
	MonitorPresetPoint.serverConnection=null;
};
MonitorPresetPoint.init();
