Add a "sequence stop" endpoint

This commit is contained in:
mmcwilliams 2018-02-06 17:42:50 -05:00
parent 9a698f6bd6
commit 8ec1694b02
1 changed files with 9 additions and 1 deletions

View File

@ -54,6 +54,7 @@ function createBLE () {
ble.on('delay', bDelay) ble.on('delay', bDelay)
ble.on('counter', bCounter) ble.on('counter', bCounter)
ble.on('sequence', bSequence) ble.on('sequence', bSequence)
ble.on('stop', bSequenceStop)
ble.on('reset', bReset) ble.on('reset', bReset)
} }
@ -465,6 +466,7 @@ function bSequence (obj, cb) {
} }
} }
if (intval._state.sequence && sequence._state.active) { if (intval._state.sequence && sequence._state.active) {
//should not occur with single client
sequence.setStop() sequence.setStop()
intval._state.sequence = false intval._state.sequence = false
log.info('sequence stop', { method : 'ble' }) log.info('sequence stop', { method : 'ble' })
@ -493,7 +495,13 @@ function bSequence (obj, cb) {
} }
function bSequenceStop (obj, cb) { function bSequenceStop (obj, cb) {
//
if (intval._state.sequence && sequence._state.active) {
sequence.setStop()
intval._state.sequence = false
log.info('sequence stop', { method : 'ble' })
return cb()
}
} }
function bReset (obj, cb) { function bReset (obj, cb) {