Set counter via ble
This commit is contained in:
parent
2818bd1180
commit
52194e0b41
15
index.js
15
index.js
|
@ -49,6 +49,7 @@ function createBLE () {
|
||||||
ble.on('dir', bDir)
|
ble.on('dir', bDir)
|
||||||
ble.on('exposure', bExposure)
|
ble.on('exposure', bExposure)
|
||||||
ble.on('delay', bDelay)
|
ble.on('delay', bDelay)
|
||||||
|
ble.on('counter', bCounter)
|
||||||
}
|
}
|
||||||
|
|
||||||
//Restify functions
|
//Restify functions
|
||||||
|
@ -364,6 +365,20 @@ function bDelay (obj, cb) {
|
||||||
return cb()
|
return cb()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function bCounter (obj, cb) {
|
||||||
|
let counter = 0
|
||||||
|
if (typeof obj.counter !== 'undefined') {
|
||||||
|
if (typeof obj.counter !== 'string') {
|
||||||
|
counter = parseInt(obj.counter)
|
||||||
|
} else {
|
||||||
|
counter = obj.counter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intval.setCounter(counter)
|
||||||
|
log.info('counter', { method : 'ble', counter : counter })
|
||||||
|
return cb()
|
||||||
|
}
|
||||||
|
|
||||||
function index (req, res, next) {
|
function index (req, res, next) {
|
||||||
fs.readFile(INDEXPATH, 'utf8', (err, data) => {
|
fs.readFile(INDEXPATH, 'utf8', (err, data) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
Loading…
Reference in New Issue