This repository has been archived by the owner on Mar 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
62 lines (54 loc) · 2.23 KB
/
index.html
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
<head>
<script src='lib/signature_parser.js'></script>
<script src='lib/TypesBaseDatatypes.js'></script>
<script src='lib/TypesManagementDatatypes.js'></script>
<script src='lib/TypesFrameworkDatatypes.js'></script>
<script src='lib/TypesAgentDatatypes.js'></script>
<script src='lib/TypesBlockandMatrixDatatypes.js'></script>
<script src='lib/TypesEvent&SubscriptionDatatypes.js'></script>
<script src='lib/TypesWorkerDatatypes.js'></script>
<script src='lib/TypesLibraryDatatypes.js'></script>
<script src='lib/TypesNetworkDatatypes.js'></script>
<script src='lib/TypesSamplingDatatypes.js'></script>
<script src='lib/RemoteControlClasses.js'></script>
<script src='lib/OCA.js'></script>
<script src='lib/WebSocket.js'></script>
<script>
var ws = new WebSocket('ws://'+document.location.host);
function dump() {
var a = [ "Promise returned:" ];
var tmp, i;
for (i = 0; i < arguments.length; i++) {
tmp = arguments[i];
if (typeof(tmp) === "object" && tmp.is_enum) {
a.push(tmp.toString());
} else {
a.push(tmp);
}
}
console.log.apply(console, a);
}
function msg(text) {
document.getElementById('messages').textContent += text;
}
ws.onopen = function() {
window.device = new OCA.RemoteDevice(new OCA.WebSocketConnection(ws));
device.discover_all().then(function (res) {
window.objects = res;
var text = 'Found '+objects.length+' Objects: \n';
for (var i = 0; i < res.length; i++) {
text += res[i].ClassName + ' with ObjectNumber ' + res[i].ObjectNumber + '\n';
res[i].GetRole().then(function(ono, role) {
msg("Object number "+ono+" has role: "+role+"\n");
}.bind(this, res[i].ObjectNumber));
}
msg(text);
}).catch(function(res) { console.error(res); });
};
</script>
<body>
Please open your javascript console.
<pre id='messages'>
</pre>
</body>
</head>