Set exposure with bluetooth app

This commit is contained in:
mmcwilliams 2017-12-13 16:04:24 -05:00
parent ae03b97f96
commit 7fc84a3f14
1 changed files with 21 additions and 2 deletions

View File

@ -47,6 +47,7 @@ function createBLE () {
}) })
ble.on('frame', bFrame) ble.on('frame', bFrame)
ble.on('dir', bDir) ble.on('dir', bDir)
ble.on('exposure', bExposure)
} }
//Restify functions //Restify functions
@ -300,8 +301,12 @@ function bFrame (obj, cb) {
dir = obj.dir dir = obj.dir
} }
} }
if (typeof obj.dir !== 'undefined') { if (typeof obj.exposure !== 'undefined') {
exposure if (typeof obj.exposure === 'string') {
exposure = parseInt(obj.exposure)
} else {
exposure = obj.exposure
}
} }
log.info('frame', { method : 'ble', dir : dir, exposure : exposure }) log.info('frame', { method : 'ble', dir : dir, exposure : exposure })
/*intval.frame(dir, exposure, (len) => { /*intval.frame(dir, exposure, (len) => {
@ -325,6 +330,20 @@ function bDir (obj, cb) {
cb() cb()
} }
function bExposure (obj, cb) {
let exposure = 0
if (typeof obj.exposure !== 'undefined') {
if (typeof obj.exposure === 'string') {
exposure = parseInt(obj.exposure)
} else {
exposure = req.body.exposure
}
}
intval.setExposure(exposure)
log.info('exposure', { method: 'ble', exposure : exposure })
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) {