Limited time to test so far. Only thing that jumped out tonight is that the "got_IP" event does not seem to fire - despite fact i can connect and use the "getIP" method.
Also of interest (to me) the "probe_recv" event seems to fire (repeatedly) despite not being connected as AP or as Station - maybe this is expected behaviour? Interesting to think that other devices, simply by being, in range can trigger this event (just thinking out loud).
Re the docs, it may be worth pointing out that all the callbacks receive an object literal as a single argument. People will try to access the vars direct otherwise and then wonder why they get an object and then undefined - I did :)
Tests done so far:
var wifi = require("Wifi");
wifi.scan(function(params){
console.log("params:" + JSON.stringify(params)); // Tested OK
});
// Connect
wifi.connect(SSID, {password: pwd}, function(){
// Log IP address
wifi.getIP(function(params){
console.log("params:" + JSON.stringify(params)); // Tested OK
});
// Get Status
wifi.getStatus(function(params){
console.log("params:" + JSON.stringify(params)); // Tested OK
});
// Get Details
wifi.getDetails(function(params){
console.log("params:" + JSON.stringify(params)); // Tested OK
});
// Get IP address of host
wifi.getHostByName("bbc.co.uk", function(params){
console.log("params:" + JSON.stringify(params)); // Tested OK
});
// Wait 60 seconds
setTimeout(function(){
// Disconnnect
wifi.disconnect(); // Tested OK
}, 60000);
});
// Event tests
wifi.on("connected", function(){
console.log("Event fired: connected"); // Tested OK
});
wifi.on("disconnected", function(){
console.log("Event fired: disconnected"); // Tested OK
});
wifi.on("got_ip", function(params) {
console.log("Event fired: got_ip");
console.log("params:" + JSON.stringify(params)); // Does not fire
});
wifi.on('probe_recv', function(params) {
console.log("Event fired: probe_recv");
console.log("params:" + JSON.stringify(params)); // Tested OK
});
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Limited time to test so far. Only thing that jumped out tonight is that the "got_IP" event does not seem to fire - despite fact i can connect and use the "getIP" method.
Also of interest (to me) the "probe_recv" event seems to fire (repeatedly) despite not being connected as AP or as Station - maybe this is expected behaviour? Interesting to think that other devices, simply by being, in range can trigger this event (just thinking out loud).
Re the docs, it may be worth pointing out that all the callbacks receive an object literal as a single argument. People will try to access the vars direct otherwise and then wonder why they get an object and then undefined - I did :)
Tests done so far: