diff --git a/lib/wifi/index.js b/lib/wifi/index.js index 34c76b2..de66af3 100644 --- a/lib/wifi/index.js +++ b/lib/wifi/index.js @@ -98,7 +98,7 @@ class Wifi { data += '\n\n' + _entry } _entry = null - fs.writeFile(filePath, data, 'utf8', this._writeConfigCb) + fs.writeFile(filePath, data, 'utf8', this._writeConfigCb.bind(this)) } /** * (internal function) Invoked after config file is written, @@ -111,7 +111,7 @@ class Wifi { console.error(err) return _cb(err) } - exec(reconfigure, this._reconfigureCb) + exec(reconfigure, this._reconfigureCb.bind(this)) } /** * (internal function) Invoked after reconfiguration command is complete @@ -126,7 +126,7 @@ class Wifi { return _cb(err) } console.log('Wifi reconfigured') - exec(refresh, this._refreshCb) + exec(refresh, this._refreshCb.bind(this)) } /** * (internal function) Invoked after wifi refresh command is complete @@ -141,7 +141,7 @@ class Wifi { return _cb(err) } console.log('Wifi refreshed') - //this._callback(null, { ssid : ssid, pwd : pwd.length }) + _cb(null, { ssid : ssid, pwd : pwd.length }) _cb = () => {} } /** @@ -186,7 +186,7 @@ class Wifi { _entry = `network={\n\tssid="${ssid}"\n\t#psk=${masked}\n\tpsk=${hash}\n}\n` _cb = callback _ssid = ssid - fs.readFile(filePath, 'utf8', this._readConfigCb) + fs.readFile(filePath, 'utf8', this._readConfigCb.bind(this)) } /** * Executes command which gets the currently connected network