Commit 4b8c4d6e authored by Arnaud WATLET's avatar Arnaud WATLET
Browse files

renames start and stop commands to run_sequence and interrupt in http interface

Showing with 14 additions and 14 deletions
+14 -14
......@@ -91,12 +91,12 @@ class MyServer(SimpleHTTPRequestHandler):
# global ohmpiThread, status, run
dic = json.loads(self.rfile.read(int(self.headers['Content-Length'])))
rdic = {} # response dictionary
if dic['cmd'] == 'start':
payload = json.dumps({'cmd_id': cmd_id, 'cmd': 'start'})
if dic['cmd'] == 'run_sequence':
payload = json.dumps({'cmd_id': cmd_id, 'cmd': 'run_sequence'})
publish.single(payload=payload, **publisher_config)
elif dic['cmd'] == 'stop':
elif dic['cmd'] == 'interrupt':
# ohmpi.stop()
payload = json.dumps({'cmd_id': cmd_id, 'cmd': 'stop'})
payload = json.dumps({'cmd_id': cmd_id, 'cmd': 'interrupt'})
publish.single(payload=payload, **publisher_config)
elif dic['cmd'] == 'getData':
# get all .csv file in data folder
......
......@@ -18,15 +18,15 @@
<h1>OhmPi Acquisition Board</h1>
<!-- nb stacks, on-time -->
<button id="update_settingsBtn" type="button" class="btn btn-secondary" data-toggle="modal" data-target="#exampleModal">Settings</button>
<button id='startBtn' type="button" class="btn btn-primary">Start</button>
<button id='stopBtn' type="button" class="btn btn-warning">Stop</button>
<button id='runBtn' type="button" class="btn btn-primary">Run</button>
<button id='stopBtn' type="button" class="btn btn-warning">Interrupt</button>
<!-- upload button for csv which display the table ABMN -->
<button id="removeDataBtn" type="button" class="btn btn-danger">Clear data</button>
<button id="getDataBtn" type="button" class="btn btn-info">Get data</button>
<div class="form-check">
<input id="dataRetrievalCheck" class="form-check-input" type="checkbox" value="">
<label class="form-check-label" for="dataRetrievalCheck">
Automaticaly get data every 1 second
Automaticaly get data every 1 secondStart
</label>
</div>
<div id='output'>Status: idle</div>
......@@ -161,21 +161,21 @@
xhr.send(query)
}
// start button
function startBtnFunc() {
sendCommand('{"cmd": "start"}', function(x) {
// run button
function runBtnFunc() {
sendCommand('{"cmd": "run_sequence"}', function(x) {
console.log(x['status'])
if (x['status'] == 'running') {
output.innerHTML = 'Status: measuring...'
}
})
}
let startBtn = document.getElementById('startBtn')
startBtn.addEventListener('click', startBtnFunc)
let runBtn = document.getElementById('runBtn')
runBtn.addEventListener('click', runBtnFunc)
// stop button
// interrupt button
function stopBtnFunc() {
sendCommand('{"cmd": "stop"}', function(x) {
sendCommand('{"cmd": "interrupt"}', function(x) {
output.innerHTML = 'Status: ' + x['status']
clearInterval(interv)
getData()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment