from gpiod.line import Direction, Value
import iio
import json
+import shutil
import signal
import sys
import time
else:
return "Method not allowed", 405
+ # end point for starting a test
+ @cherrypy.expose
+ def starttest(self):
+ if cherrypy.request.method == 'GET':
+ # create a directory name for this test
+ t = time.localtime()
+ test_time = time.strftime("%Y:%m:%d_%H:%M:%S", t)
+ test_path = DATAPATH + test_time
+ # create a directory for this test
+ if not os.path.isdir(test_path):
+ os.makedirs(test_path)
+ # copy metadata into test directory
+ metadata_path = DATAPATH + "metadata.json"
+ shutil.copy(metadata_path, test_path)
+ return "Test " + test_path + " started"
+ else:
+ return "Method not allowed", 405
+
# end point for handling AJAX requests for current status
@cherrypy.expose
@cherrypy.tools.json_out()
setInterval(updateContent, 1000);
</script>
+ <script>
+ // start current test by just hitting an endpoint
+ function startTest() {
+ const fetchOptions = {
+ method: "GET",
+ };
+ const response = fetch("/starttest", fetchOptions);
+ }
+ </script>
</head>
<body>
<!-- HEADER -->
<section class="test">
<div class="w3-container w3-center">
<button onclick="document.getElementById('start-metadata').style.display='block'"
- class="w3-button w3-round-large w3-black w3-hover-orange w3-large w3-opacity">Prepare to Test</button>
+ class="w3-button w3-round-large w3-black w3-hover-orange w3-large w3-opacity">
+ Configure Test</button>
+ </div>
+ <div class="w3-container w3-center">
+ <button onclick="armSystem()"
+ class="w3-button w3-round-large w3-black w3-hover-red w3-large w3-opacity w3-left">
+ Arm</button>
+ <button onclick="startTest()"
+ class="w3-button w3-round-large w3-black w3-hover-red w3-large w3-opacity w3-right">
+ Start Test</button>
+ </a>
</div>
</section>