Log excessively and use info to build parseConfig function

This commit is contained in:
mmcwilliams 2017-12-31 23:16:01 -05:00
parent 9896bf1ad5
commit 2c3b4408fb
2 changed files with 9 additions and 1 deletions

View File

@ -71,6 +71,8 @@ function onWifiWrite (data, offset, withoutResponse, callback) {
result = bleno.Characteristic.RESULT_UNLIKELY_ERROR
return callback(result)
}
console.log(hash)
console.log(plaintext)
return wifi.setNetwork(ssid, plaintext, hash, (err, data) => {
if (err) {
log.error('Error configuring wifi', err)
@ -89,7 +91,6 @@ function onWifiRead (offset, callback) {
const result = bleno.Characteristic.RESULT_SUCCESS
const wifiRes = {}
let data
log.info('Getting wifi data for onWifiRead')
wifi.list((err, list) => {
if (err) {
result = bleno.Characteristic.RESULT_UNLIKELY_ERROR

View File

@ -61,11 +61,15 @@ class Wifi {
console.error(err)
return _cb(err)
}
console.dir(data)
console.log(data.search(networkPattern))
console.log(_entry)
if (data.search(networkPattern) === -1) {
data += `\n${_entry}`
} else {
data = data.replace(networkPattern, _entry)
}
console.dir(data)
_entry = null
//fs.writeFile(filePath, data, 'utf8', this._writeConfigCb)
}
@ -112,6 +116,9 @@ class Wifi {
console.log('Wifi refreshed')
//this._callback(null, { ssid : ssid, pwd : pwd.length })
_cb = () => {}
}
_parseConfig () {
}
/**
* Create sanitized wpa_supplicant.conf stanza for