function camSetGet cam_id return this cams cam_id function camSetSet c

 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
function camSetGet (cam_id) {
return this.cams[cam_id];
}
function camSetSet (cam_id, enabled) {
this.cams[cam_id] = enabled;
}
function camSetIntval (value) {
if(value != undefined) {
for(var i = 0; i < 16; i++) {
this.cams[i] = false;
}
for(var i = this.masks.lenght - 1; i > -1; i--) {
if(value - this.masks[i] >= 0) {
this.cams[i] = true;
value = value - this.masks[i];
}
}
}else {
var mask = 0;
for(var i in this.cams) {
if(this.cams[i] == true) {
mask = mask + this.masks[i];
}
}
return mask;
}
return true;
}
function camSet () {
this.masks = new Array(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768);
this.cams = new Array();
for(var i = 0; i < 16; i++) {
this.cams[i] = false;
}
this.set = camSetSet;
this.get = camSetGet;
this.intval = camSetIntval;
}