Arduino networking API guide for networking library developers

100 views
Skip to first unread message

Juraj Andrássy

unread,
Oct 17, 2023, 3:39:10 AM10/17/23
to Developers
Hello

I wrote a Arduino networking API guide for networking library developers. As part of the research I analyzed  dozen of significant networking libraries for Arduino.

Both documents are in a GitHub repository in md format so it is possible to use Issues, Pull Requests and Discussions to collaborate on the API documentation, clarifications and design decisions.


Juraj Andrassy

Alessandro Ranellucci

unread,
Oct 17, 2023, 5:03:44 AM10/17/23
to devel...@arduino.cc
Juraj - that is fantastic work!

We very much need to work on aligning the networking API across different cores, and on the Arduino side we're open to support this as much as we can.
An idea we were considering lately was to add documentation for WiFi in the language reference website:
https://www.arduino.cc/reference/en/
but that requires of course that at least a subset of the API is standard.

Ideally, #include <WiFi.h> shall work out of the box on any platform (just like SPI or Wire) instead of having all the various WiFiNINA.h, ESP8266WiFi.h etc.

Also, a few months ago I generated this comparison of WiFi API which complements your work:
Who's in? :)

 - Alessandro
--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+...@arduino.cc.


Privacy and Confidentiality Notice: This email and all attachments are confidential and for the designated recipient(s) only. They may also be privileged. If you are not the intended recipient or among the intended recipients, you may not use, read, retransmit, disseminate, store/copy the information in any medium or take any action in reliance upon it. Please notify the sender that you have received it in error and immediately delete the entire communication, including any attachments.

kpe...@blinksoft.com

unread,
Oct 17, 2023, 6:39:32 AM10/17/23
to devel...@arduino.cc

Juraj Andrássy

unread,
Oct 17, 2023, 7:30:30 AM10/17/23
to devel...@arduino.cc
Alessandro, Hello. 

your repository is private.

To unify the API I already made more than 25 PR and wrote some issues and opened some discussions in GitHub repositories . They are all linked in the library comparison tables in ArduinoNetAPILibs.md. A few are already merged or solved.

JA


Juraj Andrássy

unread,
Oct 17, 2023, 7:32:10 AM10/17/23
to devel...@arduino.cc
sorry the repository works. the link was wrong

Juraj Andrássy

unread,
Oct 18, 2023, 8:59:51 AM10/18/23
to Developers, Juraj Andrássy

Dátum: utorok 17. októbra 2023, čas: 13:32:10 UTC+2, odosielateľ: Juraj Andrássy

Tom Igoe

unread,
Oct 30, 2023, 1:37:40 PM10/30/23
to devel...@arduino.cc, Juraj Andrássy
Sorry to be so long in replying to this. 

This is a good analysis, thank you. In general it seems very faithful to the original Ethernet and WiFi cores, which I think is a good thing. I am particularly glad to see the inclusion of getTime(), which I think is one of the best additions to the WiFi core and very useful in many applications. Also, the use of Printable and Stream in these libraries can simplify a lot, so I'm glad to see those mentioned too. 

For what it's worth, I have a bunch of examples I've written on the WiFi101/WiFiNINA cores that I use as tests on new variations in this repo: https://tigoe.github.io/Wifi_examples/. I also have some MQTT examples here: https://tigoe.github.io/mqtt-examples/ Some of them may be useful as tests for a general core.

Tom

Juraj Andrássy

unread,
Nov 10, 2023, 6:59:22 AM11/10/23
to Developers, t.igoe, Juraj Andrássy
Hello Mr. Igoe

sorry, I am only reading your message now. I guess I missed the notification.

I wrote my own tests last week and run them on many libraries, on versions with all my pull requests merged.

It is still work in progress as library maintainers merge my PR and I make new PR. We are slowly getting to compatible libraries.

Would it be possible for Arduino to allocate some time for developers in  Martino Facchin's team to look at my PR in Arduino networking libraries repositories. At least for the new libraries in the Renesas Core.  And the documentation for the new WiFi libraries would be good to have. (Unified WiFi documentation would be ideal.)
  

Juraj
Dátum: pondelok 30. októbra 2023, čas: 18:37:40 UTC+1, odosielateľ: t.igoe

Tom Igoe

unread,
Nov 10, 2023, 7:22:40 AM11/10/23
to Juraj Andrássy, Martino Facchin, Developers
I'll defer to Martino on the PRs (hi Martino), but looking over your latest report, the changes in WiFi101, WIFiNINA, and WIFiS3 all seem like useful changes to me, so I'd endorse them. The ordering of the addresses, in particular, seems like it should be standardized.  

I can't comment on the other libraries as knowledgeably, because I haven't used them as much as the three I mentioned. But I'd suspect that the ESP-based libraries are more of a challenge, if we want to maintain compatibility with ESP's libraries. It might be a question for the maintainers of those libraries. Martino and the Pro team can probably say more there. 

Juraj Andrássy

unread,
Nov 10, 2023, 7:42:41 AM11/10/23
to Developers, t.igoe, Developers, Juraj Andrássy, facchinm
the esp8266 and esp32 maintainers a cooperative. I have already multiple PR merged or at least approved there this week.

In esp8266 the ordering of addresses in `config` is OK. Their detection of the ordering based on the location of the network mask works good. 
Later I want to try to forward that solution to esp32 WiFi library.



Dátum: piatok 10. novembra 2023, čas: 13:22:40 UTC+1, odosielateľ: t.igoe

Juraj Andrássy

unread,
Nov 10, 2023, 10:33:55 AM11/10/23
to Developers, Juraj Andrássy, t.igoe, Developers, facchinm
you meant the reverse ordering of the bytes in `macAddress` and both `BSSID` in Arduino WiFi libraries?
yes, that is a problem.
if I had to say how to solve it, I would recommend to change it to normal ordering in all Arduino WiFi libraries and their examples. 
or at least as soon as possible in the very new libraries WiFiS3 and WiFiC3 in the Renesas core.

Dátum: piatok 10. novembra 2023, čas: 13:42:41 UTC+1, odosielateľ: Juraj Andrássy

Juraj Andrássy

unread,
Sep 23, 2024, 8:29:35 AMSep 23
to Developers, Juraj Andrássy, t.igoe, Developers, facchinm
Hello. Here is a short report on one year progress in networking API unification in existing libraries:

• In ESP32 WiFi library in WiFi.config  we have now parameters in Arduino’s ordering (with parameters ordering automatic detection)
• Added support for automatic values  for static IP configuration's optional parameters in Mbed WiFi, ESP32 WiFi, ESP8266 (WiFi and Ethernet).  For WiFi101 and WiFiNINA pull requests are not merged yet.
• Unified DNS setter and getter name setDNS and dnsIP for many WiFi and Ethernet libraries. For WiFi101 and WiFiNINA, Ethernet and C33 Ethernet pull requests are not merged yet.
• Added legacy Ethernet methods setDnsServerIP and dnsServerIP to esp8266, RP2040 and STM32 platforms Ethernet libraries
• Added BSSID(n) for scanNetworks results in ESP32 and esp8266
• Changed method MACAddress from setter to getter in EthernetSTM32 library
• For ESP32 they did not accept the PR with a compatibility layer for the platform bundled Ethernet library, so my new EthernetESP32 library wraps ESP32 networking with  the standard Arduino Ethernet API.
• For Server implementations clearing confusion about available() implementation and unimplemented print-to-all-clients in ESP32, esp8266 and RP2040 networking. In Mbed core the PR is not merged yet.
• Server.accept was added in WiFiS3.  For WiFi101 and WiFiNINA the PR are not merged yet. In Mbed Core the PR with a rename of available() to accept() is not merged yet.
• Pull requests for Server modernization are not yet merged in Ethernet, WiFi101, WiFiNINA and Mbed Core. (Server modernization adds constructor without parameters, begin(port), end() and bool().)

In the process, many imperfections in implementations were found and fixed.

Dátum: piatok 10. novembra 2023, čas: 16:33:55 UTC+1, odosielateľ: Juraj Andrássy

Alessandro Ranellucci

unread,
Sep 26, 2024, 8:40:17 AMSep 26
to devel...@arduino.cc, Juraj Andrássy
Juraj,
thank you for the effort you're putting into this! That's precious work. The pending PRs on the libraries maintained by Arduino are under the radar of the team - they told me some tricky changes are needed to avoid side effects so they'll get back to you.
When we manage to merge most of them it would be nice to write a blog post on the Arduino website describing all this work.

Best :)

Alessandro



Reply all
Reply to author
Forward
0 new messages