-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmb.js
More file actions
61 lines (53 loc) · 1.22 KB
/
Copy pathmb.js
File metadata and controls
61 lines (53 loc) · 1.22 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
function mbCfgUpd(j) {
let i;
try {
cS("mbEn", j.Enable);
cS("mbIPv4", j.EnIPv4);
cS("mbIPv6", j.EnIPv6);
vS("mbPort", j.Port);
} catch(e) {
console.log(e);
}
}
async function mbCfgGet() {
let rq = {Cmd:"MbCfgGet", SessionId:sIdG()};
return await rqp(rq, mbCfgUpd);
}
async function mbCfgSet() {
let rq = {Cmd:"MbCfgSet", SessionId:sIdG(),
Port:vG("mbPort"),
Enable:cG("mbEn"),
EnIPv4:cG("mbIPv4"),
EnIPv6:cG("mbIPv6")};
return await rqp(rq, null);
}
function mbStateUpd(j) {
try {
hS("mbStSvc", j.SvcState);
hS("mbStMod", j.ModState);
hS("mbStRst", j.Reset);
} catch(e) {
console.log(e);
}
}
async function mbStateGet() {
let rq = {Cmd:"MbStateGet", SessionId:sIdG()};
return await rqp(rq, mbStateUpd);
}
async function mbInit() {
btnEvAdd("mbBtCfg", async() => {
await mbCfgSet().then(() => {
}).catch((m) => {
alert(m);
})
});
return new Promise(async(res, rej) => {
await mbStateGet()
.then(async() => {await mbCfgGet()})
.then(() => {
res();
}).catch((m) => {
rej(m);
})
});
}