Skip to content

WiFiClient option #284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jnsbyr opened this issue Apr 9, 2016 · 6 comments
Closed

WiFiClient option #284

jnsbyr opened this issue Apr 9, 2016 · 6 comments

Comments

@jnsbyr
Copy link
Contributor

jnsbyr commented Apr 9, 2016

Currently StandardFirmataWiFi has no WiFiClient option and there was a request for contribution in #280 (comment).

I have compared the 3 versions of WiFiStream (WiFi, WiFi100 and ESP). They are nearly identical and they can easily be combined into a single WiFiStream class without changing the interface for WiFi and WiFi100 using defines for the ESP subset and making the appropriate changes to the StandardFirmataWiFi example. Reducing the variants first will help providing a WiFiClient option for all variants.

The new version of WiFiStream has been successfully compiled for an Arduino with WiFi and for an ESP8266. I could commit and push this intermediary solution for further discussion. It still needs testing though, because I have a host application that can only be a server.

For adding the WiFiClient there are at least two options:

  • adding a separate class WiFiClientStream using a copy of WiFiStream as a starting point
  • integrating the WiFiClient into WiFiStream by using separate constructors for client and server
@soundanalogous
Copy link
Member

Ideally the various WiFi streams would have been combined from the beginning. The issue is however that each needs to include a different WiFi library. Arduino precompiles libraries (in that everything in the Firmata library directory is compiled into object files when the Arduino IDE is opened and then the sketch is compiled later by the user) and thus there was no way to indicate from the sketch or wifiConfig.h file which specific Wi-Fi library should be included - even though that was the only difference between versions.

However since we moved the stream implementation from the .cpp to the .h file, this may have actually prevented pre compilation of the wifi stream classes and including the specific Wi-Fi library in wifiConfig.h may actually work (funny I never tried that). Is that what you have in mind?

@soundanalogous
Copy link
Member

Please submit a PR with what you have so far.

@soundanalogous
Copy link
Member

@jnsbyr FYI
ESP8266 support is merged into master. Only enables using the board as a Wi-Fi server so far. Tested Wi-Fi with Adafruit HUZZAH ESP8266, Arduino MKR1000 and Arduino WiFi Shield 101 with Arduino Zero. ESP8266 and MKR1000 don't require any user configuration if using DHCP since the respective WiFi libraries are included automatically.

For the next leg of work (ability to use Wi-Fi server or client), I've created a new topic branch named wifi-client.

Thanks for all of your work on this so far!!

@jnsbyr
Copy link
Contributor Author

jnsbyr commented Apr 11, 2016

No problem, I hope that it is useful for the project. I will checkout the new branch. Thanks for all the testing you needed to do, but currently I am limited to a Huzzah ESP8266.

@soundanalogous
Copy link
Member

I recommend the MKR1000 if you are looking into getting another WiFi board. It uses the WiFi101 library so it's a good test case.

@soundanalogous
Copy link
Member

done! #292

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants