-
Notifications
You must be signed in to change notification settings - Fork 13
/
index.html
51 lines (42 loc) · 1.29 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
<!DOCTYPE HTML>
<html>
<head>
<title>JETSONJS - TEST FINAL APP</title>
<meta charset='utf-8' />
<script>
function connect(){
var jetsonIP=document.getElementById('JetsonIP').value;
var socket=new WebSocket('ws://'+jetsonIP+':8888') //port hould be server.serviceExtWSPort in settings.js
// Connection opened
socket.addEventListener('open', function (event) {
console.log('Connected!')
});
// Listen for messages
var domLogs=document.getElementById('logs');
domLogs.value='';
socket.addEventListener('message', function (event) {
var dataParsed=JSON.parse(event.data);
var typeLabel=dataParsed.t;
var data=dataParsed.m;
switch(typeLabel){
case 'VAL':
domLogs.value+=JSON.stringify(data)+'\n'
break;
}
});
} //end connect()
function clean(){
console.log('Clear!');
document.getElementById('logs').value='';
}
</script>
</head>
<body style='background-color: silver'>
<h1>JETSONJS - TEST FINAL APP</h1>
Jetson IP address : <input id='JetsonIP' value='127.0.0.1'/><button onclick='connect()'>CONNECT</button>
<br/><br/>
values received : <button onclick='clean()' style='margin-left: 20px'>CLEAR</button><br/>
<textarea id='logs' style='width: 80vw; height: 80vh'>
</textarea>
</body>
</html>