modifyUI.js
3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
var DemoUI = (function(e)
{
return {
setLoginDeviceIP:function(){},
getLoginDeviceIP:function(){},
removeDeviceInfo:function(ip){},
updateDeviceInfo:function(ip){},
setSvrPort:function(){},
getSvrPort:function(){},
setRtspPort:function(){},
getRtspPort:function(){},
setUsrName:function(){},
getUsrName:function(){},
setPassword:function(){},
getPassword:function(){},
addDeviceIP:function(){},
removeDeviceIP:function(){},
getCurDeviceIP:function(){},
modifyChannelList:function(){},
setCurChannel:function(){},
getCurChannel:function(){},
setCurStreamType:function(){},
getCurStreamType:function(){},
setCurProtocol:function(){},
getCurProtocol:function(){},
clearPresets:function(){}
};
})(this);
$(function () {
DemoUI.setLoginDeviceIP = function(ip){
$("#loginip").val(ip);
};
DemoUI.getLoginDeviceIP = function(){
return $("#loginip").val();
};
DemoUI.removeDeviceInfo = function(ip){
//将设备信息清除
DemoUI.removeDeviceIP();
//设置当前的设备信息
var selectDevice = DemoUI.getCurDeviceIP();
DemoUI.updateDeviceInfo(selectDevice);
}
DemoUI.updateDeviceInfo = function(ip){
var info = WebVideoCtrl.getDeviceInfo(ip);
if(typeof info != "undefined")
{
//更新选中设备的信息
DemoUI.setLoginDeviceIP(ip);
DemoUI.setUsrName(info.userName);
DemoUI.setPassword(info.password);
DemoUI.setRtspPort(info.rtspPort);
DemoUI.setSvrPort(info.port);
DemoUI.setCurProtocol(info.protocol);
$("#ips").val(ip);
//更新通道数据
DemoUI.modifyChannelList(info.channelNum);
}else{
//清理通道列表数据
DemoUI.modifyChannelList(0);
}
}
DemoUI.setSvrPort = function(port){
$("#port").val(port.toString());
};
DemoUI.getSvrPort = function(){
return ($("#port").val() - 0);
};
DemoUI.setRtspPort = function(port){
$("#rtspport").val(port.toString());
};
DemoUI.getRtspPort = function(){
return ($("#rtspport").val() - 0);
};
DemoUI.setUsrName = function(usrName){
$("#username").val(usrName);
};
DemoUI.getUsrName = function(){
return $("#username").val();
};
DemoUI.setPassword = function(password){
$("#password").val(password);
};
DemoUI.getPassword = function(){
return $("#password").val();
};
DemoUI.addDeviceIP = function(ip){
$("#ips").append("<option value='" + ip + "'>" + ip + "</option>");
$("#ips").val(ip)
};
DemoUI.removeDeviceIP = function(){
var selectDevice = $("#ips").find("option:selected").text();
$("#ips" + " option[value='" + selectDevice + "']").remove();
};
DemoUI.getCurDeviceIP = function(){
return $("#ips").find("option:selected").text();
};
DemoUI.modifyChannelList = function(num){
$("#channels").empty();
//更新通道列表信息
if(-1 != num)
{
var i = 1;
for(;i <= num;i ++)
{
var subNode = "<option value=" + i.toString() + ">" + i.toString() + "</option>"
$("#channels").append(subNode);
}
}
};
DemoUI.setCurChannel = function(chan){
$("#channels").val(chan.toString());
};
DemoUI.getCurChannel = function(){
return $("#channels").val();
};
DemoUI.setCurStreamType = function(type){
$("#streamtype").val(type.toString());
};
DemoUI.getCurStreamType = function(){
return $("#streamtype").val();
};
DemoUI.setCurProtocol = function(protocol){
$("#protocolType").val(protocol.toString());
};
DemoUI.getCurProtocol = function(){
return $("#protocolType").val();
};
DemoUI.clearPresets = function(){
$("#presetList").empty();
}
});