From 42580c46b94af260f2fed1bb5686f6061622dd71 Mon Sep 17 00:00:00 2001 From: mmcwilliams Date: Wed, 7 Feb 2018 18:38:19 -0500 Subject: [PATCH] Sequence feature for bluetooth control does NOT need to be split (yet) into start and stop. intval.mobile.js was using the incorrect callback on the sequence characteristic and should be tested before changes are made. --- app/www/static/js/intval.mobile.js | 10 +++++++--- index.js | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/www/static/js/intval.mobile.js b/app/www/static/js/intval.mobile.js index ef002e1..b7f33e5 100644 --- a/app/www/static/js/intval.mobile.js +++ b/app/www/static/js/intval.mobile.js @@ -279,16 +279,19 @@ mobile.sequence = function () { const opts = { type : 'sequence' }; + const elem = document.getElementById('seq'); if (!mobile.ble.connected) { - return alert('Not connected to an INTVAL device.'); + return alert('Not connected to an INTVAL3 device.'); } ble.write(mobile.ble.device.id, mobile.ble.SERVICE_ID, mobile.ble.CHAR_ID, stringToBytes(JSON.stringify(opts)), //check length? - mobile.frameSuccess, + mobile.sequenceSuccess, mobile.ble.onError); - document.getElementById('seq').classList.add('focus'); + if (!elem.classList.contains('focus')) { + elem.classList.add('focus'); + } mobile.ble.active = true; }; @@ -306,6 +309,7 @@ mobile.sequenceSuccess = function () { }, 20); }; + //retreive object with list of available Wifi APs, //and state of current connection, if available mobile.getWifi = function () { diff --git a/index.js b/index.js index 9abde59..2ac5532 100644 --- a/index.js +++ b/index.js @@ -37,6 +37,7 @@ function createServer () { app.post('/frame', rFrame) app.get( '/sequence', rSequence) app.post('/sequence', rSequence) + app.post('/reset', rReset) app.get( '/status', rStatus) app.listen(PORT, () => { @@ -54,7 +55,6 @@ function createBLE () { ble.on('delay', bDelay) ble.on('counter', bCounter) ble.on('sequence', bSequence) - ble.on('stop', bSequenceStop) ble.on('reset', bReset) }