Force example frame before evaluating query and body of post for parameters

This commit is contained in:
mmcw-dev 2017-10-21 12:10:16 -04:00
parent 0848d5bfc0
commit 9302cf1b21
3 changed files with 39 additions and 39 deletions

View File

@ -120,8 +120,9 @@ function rDelay (req, res, next) {
} }
function rFrame (req, res, next) { function rFrame (req, res, next) {
intval.frame(cb=()=>{ log.info('/frame', { method : req.method })
log.info('happened') intval.frame(true, 0, () => {
log.info('frame stopped')
}) })
res.send({}) res.send({})
return next() return next()

View File

@ -11,7 +11,7 @@ function capitalize (s) {
class Blootstrap { class Blootstrap {
constructor () { constructor () {
this._onData = () => {} this._onData = () => {}
try { ipc.config.maxRetries = 0
ipc.connectTo('blootstrap_ble', () => { ipc.connectTo('blootstrap_ble', () => {
ipc.of.blootstrap_ble.on('connect', () => { ipc.of.blootstrap_ble.on('connect', () => {
log.info('connect', `Connected to the blootstrap_ble service`) log.info('connect', `Connected to the blootstrap_ble service`)
@ -33,9 +33,6 @@ class Blootstrap {
} }
}) })
}) })
} catch (e) {
log.error('connectTo', { error : e })
}
} }
/** /**
* Binds functions to events that are triggered by BLE messages * Binds functions to events that are triggered by BLE messages

View File

@ -13,12 +13,14 @@ const log = require('../log')('wifi')
const exec = require('child_process').exec const exec = require('child_process').exec
const fs = require('fs') const fs = require('fs')
let _entry = null
let _ssid = null
let _cb = null
/** Class representing the wifi features */ /** Class representing the wifi features */
class Wifi { class Wifi {
constructor () { constructor () {
this._callback = () => {}
this._entry = null
this._ssid = null
} }
/** /**
* List available wifi access points * List available wifi access points
@ -54,14 +56,14 @@ class Wifi {
_readConfigCb (err, data) { _readConfigCb (err, data) {
if (err) { if (err) {
console.error(err) console.error(err)
return this._callback(err) return _cb(err)
} }
if (data.search(networkPattern) === -1) { if (data.search(networkPattern) === -1) {
data += `\n${this._entry}` data += `\n${_entry}`
} else { } else {
data = data.replace(networkPattern, this._entry) data = data.replace(networkPattern, _entry)
} }
this._entry = null _entry = null
fs.writeFile(filePath, data, 'utf8', this._writeConfigCb) fs.writeFile(filePath, data, 'utf8', this._writeConfigCb)
} }
/** /**
@ -73,7 +75,7 @@ class Wifi {
_writeConfigCb (err) { _writeConfigCb (err) {
if (err) { if (err) {
console.error(err) console.error(err)
return this._callback(err) return _cb(err)
} }
exec(reconfigure, this._reconfigureCb) exec(reconfigure, this._reconfigureCb)
} }
@ -87,7 +89,7 @@ class Wifi {
_reconfigureCb (err, stdout, stderr) { _reconfigureCb (err, stdout, stderr) {
if (err) { if (err) {
console.error(err) console.error(err)
return this._callback(err) return _cb(err)
} }
console.log('Wifi reconfigured') console.log('Wifi reconfigured')
exec(refresh, this._refreshCb) exec(refresh, this._refreshCb)
@ -102,11 +104,11 @@ class Wifi {
_refreshCb (err, stdout, stderr) { _refreshCb (err, stdout, stderr) {
if (err) { if (err) {
console.error(err) console.error(err)
return this._callback(err) return _cb(err)
} }
console.log('Wifi refreshed') console.log('Wifi refreshed')
//this._callback(null, { ssid : ssid, pwd : pwd.length }) //this._callback(null, { ssid : ssid, pwd : pwd.length })
this._callback = () => {} _cb = () => {}
} }
/** /**
* Function which initializes the processes for adding a wifi access point authentication * Function which initializes the processes for adding a wifi access point authentication
@ -116,9 +118,9 @@ class Wifi {
* @param {function} callback Function invoked after process is complete, or fails * @param {function} callback Function invoked after process is complete, or fails
*/ */
setNetwork (ssid, pwd, callback) { setNetwork (ssid, pwd, callback) {
this._entry = `network={\n\tssid="${ssid}"\n\tpsk="${pwd}"\n}\n` _entry = `network={\n\tssid="${ssid}"\n\tpsk="${pwd}"\n}\n`
this._callback = callback _cb = callback
this._ssid = ssid _ssid = ssid
fs.readFile(filePath, 'utf8', this._readConfigCb) fs.readFile(filePath, 'utf8', this._readConfigCb)
} }
/** /**