#Tessel wifi
This is a wrapper lib around the wifi-cc3000
lib that Tessel provides.
This lib aggressively tries to connect and will power cycle the wifi chip if it still doesn't connect.
##Usage
var tesselWifi = require('tessel-wifi');
var options = {
ssid: 'network',
password: 'abc123',
}
var wifi = new tesselWifi(options);
wifi.on('connect', function(err, data){
console.log("Connected to", options.ssid);
})
.on('disconnect', function(err, data){
console.log("WARN: No longer connected to", options.ssid);
})
.on('error', function(err){
console.log("ERROR:", err);
wifi.reconnect();
});
##Details
Here's what this lib attempts to do:
- Tries to connect to wifi as soon as its initialized
- Sets a timeout of 30 seconds to try to reconnect if wifi doesn't connect
- At every disconnect/timeout event, auto attempts to reconnect. If there's 3 disconnect/timeout events in a row, will power cycle the chip & attempt a reconnect.
- After 3 error events will power cycle and attempt a reconnect.