Thanks - I reckon it's important to design things to be flexible enough that they can cope with different forms of WiFi/Ethernet in the future - also that functionality can be added without breaking existing code in the future.
Some of the names are choices because I'm trying to break existing code as little as possible. I try hard not to piss off existing users by making non-backwards-compatible changes. Sometimes that means some things aren't perfect though.
Just looking at createAP makes me think it should take an object, where all but the AP name is pretty much optional.
We need a function to set the wifi mode
Good plan - much nicer than setPower
Why does wifi.getAPs(function(err, aps) { ... }); need a callback as opposed to just returning the info?
Because it's something that takes time, and function calls shouldn't really block? As you suggested above, this is really a scan. Maybe it could be changed, but it is a function that exists now and which is in use by existing Espruino users.
Being able to set the IP address and associated network parameters (gateway and mask) is needed.
Yep, that's where setIP comes in. We could add the ability to set hostname in that as well
We need calls to disconnect and to shut down the AP.
Is this not just setMode you described above?
Connect at boot
Yes, it could look at what's in the variables even before the interpreter starts. USB HID does that at the moment.
Personally I'd say the user should connect themselves in onInit - but having the ability to program the device by WiFi without any of that being involved seems like it's worth it :)
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.
Thanks - I reckon it's important to design things to be flexible enough that they can cope with different forms of WiFi/Ethernet in the future - also that functionality can be added without breaking existing code in the future.
Some of the names are choices because I'm trying to break existing code as little as possible. I try hard not to piss off existing users by making non-backwards-compatible changes. Sometimes that means some things aren't perfect though.
Just looking at
createAP
makes me think it should take an object, where all but the AP name is pretty much optional.Good plan - much nicer than
setPower
Because it's something that takes time, and function calls shouldn't really block? As you suggested above, this is really a
scan
. Maybe it could be changed, but it is a function that exists now and which is in use by existing Espruino users.Yep, that's where
setIP
comes in. We could add the ability to set hostname in that as wellIs this not just
setMode
you described above?Yes, it could look at what's in the variables even before the interpreter starts. USB HID does that at the moment.
Personally I'd say the user should connect themselves in
onInit
- but having the ability to program the device by WiFi without any of that being involved seems like it's worth it :)But let's discuss on the Wiki