From 2c3b4408fb0bd24199f1e8468afd2d6fb0061438 Mon Sep 17 00:00:00 2001 From: mmcwilliams Date: Sun, 31 Dec 2017 23:16:01 -0500 Subject: [PATCH] Log excessively and use info to build parseConfig function --- lib/ble/index.js | 3 ++- lib/wifi/index.js | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/ble/index.js b/lib/ble/index.js index b902854..41d9e12 100644 --- a/lib/ble/index.js +++ b/lib/ble/index.js @@ -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 diff --git a/lib/wifi/index.js b/lib/wifi/index.js index 96d282c..5ddb54a 100644 --- a/lib/wifi/index.js +++ b/lib/wifi/index.js @@ -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