-
Notifications
You must be signed in to change notification settings - Fork 5
/
test-landing.html
76 lines (66 loc) · 2.41 KB
/
test-landing.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!DOCTYPE HTML>
<html>
<head>
<title>VISIR HTML5 Test</title>
<link rel="stylesheet" href="instrumentframe/instrumentframe.css" />
<script type="text/javascript" src="jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="visir.js"></script>
<script>
function init()
{
function ReadCircuitFromUrl() {
console.log(location.search);
var match = /cir=([^&]+)/.exec(location.search);
if (!match) {
return null;
}
var circuit = match[1];
console.log(circuit);
var decoded = base64_decode(circuit);
console.log(decoded);
var asString = String.fromCharCode.apply(null, decoded) // map to fromCharCode
return asString
}
function MakeMeasurement()
{
reg.MakeRequest(transport);
}
trace("starting up..");
var transport = new visir.JSTransport(visir.SetWorking);
transport.onerror = function(err) { alert("Error: " + err); }
transport.Connect(visir.Config.Get("mesServer"), "fnord");
var extservice = new visir.ExtServices({ MakeMeasurement: MakeMeasurement });
var reg = new visir.InstrumentRegistry(extservice);
var frame = new visir.InstrumentFrame(reg, transport, $("#instrumentframe"));
var emptyexperiment = '<save version="2"><instruments htmlinstruments="Breadboard|FlukeMultimeter|HPFunctionGenerator|AgilentOscilloscope|TripleDC"></instruments><circuit></circuit></save>';
reg.LoadExperiment(emptyexperiment, frame.GetInstrumentContainer());
var urlCircuit = ReadCircuitFromUrl();
if (urlCircuit) {
reg.LoadExperiment(urlCircuit, frame.GetInstrumentContainer());
}
$(".measure").click( function() {
MakeMeasurement();
});
$("#showlog").click( function() {
$("#logwindow").css("display", "block");
});
$("#hidelog").click( function() {
$("#logwindow").css("display", "none");
});
}
$( function() { visir.Load(init); });
</script>
</head>
<body>
<!--[if lt IE 9]><p style="font-weight: bold; color: #CC2222">This experiment is not supported in your current browser. We strongly recommend you to update it or to get a new browser, such as <a href="http://chrome.google.com/" alt="Download Google Chrome">Google Chrome</a></p><![endif]-->
<div id="instrumentframe"></div>
<div>
Log window:
<button id="showlog">Show</button>
<button id="hidelog">Hide</button>
</div>
<div id="logwindow" style="border: 1px solid #000000; padding: 2px; height: 500px; width: 800px; overflow: scroll; display:none"></div>
<br/>
<br/>
</body>
</html>