Log excessively and use info to build parseConfig function
This commit is contained in:
parent
9896bf1ad5
commit
2c3b4408fb
|
@ -71,6 +71,8 @@ function onWifiWrite (data, offset, withoutResponse, callback) {
|
||||||
result = bleno.Characteristic.RESULT_UNLIKELY_ERROR
|
result = bleno.Characteristic.RESULT_UNLIKELY_ERROR
|
||||||
return callback(result)
|
return callback(result)
|
||||||
}
|
}
|
||||||
|
console.log(hash)
|
||||||
|
console.log(plaintext)
|
||||||
return wifi.setNetwork(ssid, plaintext, hash, (err, data) => {
|
return wifi.setNetwork(ssid, plaintext, hash, (err, data) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
log.error('Error configuring wifi', err)
|
log.error('Error configuring wifi', err)
|
||||||
|
@ -89,7 +91,6 @@ function onWifiRead (offset, callback) {
|
||||||
const result = bleno.Characteristic.RESULT_SUCCESS
|
const result = bleno.Characteristic.RESULT_SUCCESS
|
||||||
const wifiRes = {}
|
const wifiRes = {}
|
||||||
let data
|
let data
|
||||||
log.info('Getting wifi data for onWifiRead')
|
|
||||||
wifi.list((err, list) => {
|
wifi.list((err, list) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
result = bleno.Characteristic.RESULT_UNLIKELY_ERROR
|
result = bleno.Characteristic.RESULT_UNLIKELY_ERROR
|
||||||
|
|
|
@ -61,11 +61,15 @@ class Wifi {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
return _cb(err)
|
return _cb(err)
|
||||||
}
|
}
|
||||||
|
console.dir(data)
|
||||||
|
console.log(data.search(networkPattern))
|
||||||
|
console.log(_entry)
|
||||||
if (data.search(networkPattern) === -1) {
|
if (data.search(networkPattern) === -1) {
|
||||||
data += `\n${_entry}`
|
data += `\n${_entry}`
|
||||||
} else {
|
} else {
|
||||||
data = data.replace(networkPattern, _entry)
|
data = data.replace(networkPattern, _entry)
|
||||||
}
|
}
|
||||||
|
console.dir(data)
|
||||||
_entry = null
|
_entry = null
|
||||||
//fs.writeFile(filePath, data, 'utf8', this._writeConfigCb)
|
//fs.writeFile(filePath, data, 'utf8', this._writeConfigCb)
|
||||||
}
|
}
|
||||||
|
@ -112,6 +116,9 @@ class Wifi {
|
||||||
console.log('Wifi refreshed')
|
console.log('Wifi refreshed')
|
||||||
//this._callback(null, { ssid : ssid, pwd : pwd.length })
|
//this._callback(null, { ssid : ssid, pwd : pwd.length })
|
||||||
_cb = () => {}
|
_cb = () => {}
|
||||||
|
}
|
||||||
|
_parseConfig () {
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Create sanitized wpa_supplicant.conf stanza for
|
* Create sanitized wpa_supplicant.conf stanza for
|
||||||
|
|
Loading…
Reference in New Issue