pyro = 0
battery = 0
+# global to keep track of whether user wants system armed
+armreq = "disarm"
+
ctx = iio.LocalContext()
ctrl = ctx.find_device('ads8688')
# configuration for each channel on ADS8688
) as request:
value = request.get_value(12)
if value == Value.ACTIVE:
- return 'armed'
+ if armreq == "arm":
+ return 'armed'
+ else:
+ return 'remote'
else:
- return 'safe'
+ return armreq
+ #return 'safe'
path = os.path.abspath(os.path.dirname(__file__))
config = {
else:
return "Method not allowed", 405
+ # end point for arming the system
+ @cherrypy.expose
+ @cherrypy.tools.json_in()
+ def armsystem(self):
+ global armreq
+ if cherrypy.request.method == 'POST':
+ jsondata = cherrypy.request.json
+ cherrypy.log(jsondata["request"].strip())
+ armreq = jsondata["request"]
+ return "state requested: " + armreq
+ else:
+ return "Method not allowed", 405
+
# end point for starting a test
@cherrypy.expose
def starttest(self):
</script>
<script>
+ // change system armed state
+ function armSystem() {
+ const jsonString = '{"request": "arm"}';
+ const fetchOptions = {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ Accept: "application/json",
+ },
+ body: jsonString,
+ };
+ const response = fetch("/armsystem", fetchOptions);
+ }
+
// start current test by just hitting an endpoint
function startTest() {
const fetchOptions = {