1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

665 Commits

Author SHA1 Message Date
Holger Lembke
dc9abed8b9
ESP8266WiFiMulti - get number of APs in the list (#9082)
When having some more complex setups it might be helpful to know the number of APs already added to the list.
2024-03-18 00:04:44 +03:00
Max Prokhorov
2064d437a3
ESP8266WiFi - document event handler lifetime, add [[nodiscard]] (#9087)
* disallow not assigning wifieventhandler somewhere

* fix markdown syntax in rst

* mention lifetime in example and docs
2024-03-17 21:11:32 +03:00
Max Prokhorov
d7d50ffc6f
Prefer Serial1 logging in examples (#9079) 2024-02-09 20:22:49 +03:00
Max Prokhorov
e6df345584
CI - clang-format-15 (#9085)
Stop CI from pulling LLVM repos and using GNUPG keyservers,
ubuntu-latest already has clang-format-{13,14,15}

Fixes long-standing issue with -style=file:...
2024-02-09 17:39:38 +03:00
david gauchard
d5eb265f78
WiFi config(): warning for legacy idioms (#9050) 2023-12-12 00:57:57 +01:00
Juraj Andrássy
cb9734c97d
WiFi.h as alias to ESP8266WiFi.h (#9044) 2023-12-08 10:50:54 +01:00
Juraj Andrássy
9a4e17876e
WiFi - static IP auto gw,mask,dns as in Arduino libraries (#9031) 2023-11-24 10:10:27 +01:00
Juraj Andrássy
5e0ed3a38b
Revert "WiFiSTA - allow using DHCP again after disconnecting static IP (#9020)" (#9028)
This reverts commit 0c599ee0dcdd9b04f4f3082697992fe79b1e9ac6.
2023-11-13 00:26:16 +01:00
Juraj Andrássy
ee953737dd
WiFiServer - allow constructor without parameters (#9026) 2023-11-13 00:10:26 +01:00
Juraj Andrássy
7fc2caa72f
WiFiSTA - method setDNS as in WiFi libraries by Arduino (#9021)
https://www.arduino.cc/reference/en/libraries/wifi/wifi.setdns/
2023-11-10 15:30:31 +01:00
Juraj Andrássy
0c599ee0dc
WiFiSTA - allow using DHCP again after disconnecting static IP (#9020) 2023-11-10 10:54:17 +01:00
Juraj Andrássy
30c6df4639
WiFiServer - operator bool() and method end() (#8995) 2023-11-04 23:39:46 +01:00
Juraj Andrássy
497dacc78f
WiFi.BSSID and scan result BSSID with parameter as other WiFi libraries (#9008) 2023-11-04 23:29:06 +01:00
Luciano Martorella
1a4663fbe8
Add virtual beginMulticast(...) stub to UDP class (#8969)
* - Same UDP API of ESP32 core

* - PR review
2023-08-15 19:25:58 +03:00
reyfel
f2da54d3a2
Add softAPbroadcastIP (#8963) 2023-07-27 00:52:59 +02:00
Ahmed El-Sharnoby
90c4e3afc1
Change host from tls.mbed.org to api.my-ip.io (#8931)
https://tls.mbed.org/ host does not support MFLN and Also Redirects the Client.
https://api.my-ip.io/ip is a better alternative, supporting MFLN and allowing the user to get a simple text with a useful information.
2023-07-24 01:32:06 +02:00
Suwatchai K
e05656bd78
Add support WiFiClientSecure TCP KeepAlive (#8940)
* Add support WiFiClientSecure TCP KeepAlive
* Make TCP keepalive and related functions virtual.
* Make TCP keepalive and related functions override.

Fixes #8939
2023-06-11 11:11:38 -07:00
ilmanowar
ad9aaef8c8
Fix removing first certificate in certs-from-mozilla.py (#8907)
.pem list has no headers, that operation removes a real certificate.
2023-04-22 17:33:27 +03:00
david gauchard
97018a5bbf
various minor web fixes (#8885)
* httpclient: use refs - httpserver: add chunks in examples

* basic https client: update cert

* debug log: read() returning -1 is usual and means "nothing to read"

* emulation on host: SSL server has never been and is now working

* style

* move SSL server certs from examples into a single place with appropriate warnings

* web-hello-servers: make chunks bigger

* factorize template declaration

* http-client: add getString(pre-reservation)

* mock: add umm_info()

* style

* comment API in example

* style

* fix per review
2023-03-30 19:39:35 +02:00
david gauchard
210897ef83
Release 3.1.2 (#8893)
* release 3.1.2
2023-03-20 23:14:05 +01:00
Dirk O. Kaar
23036328a5
EspSoftwareSerial 8.0.1: onReceive bug fix and new namespace (#8869)
* Upcoming EspSoftwareSerial 7.0.1

* EspSoftwareSerial example: higher bitrates due to forcing half-duplex

* Adapt to SoftwareSerial's latest use of namespace.

* In EspSoftwareSerial, some renaming after review feedback.

* EspSoftwareSerial's use of a template class in order to permit users their own GPIO capabilities definitions.

* CI caught some warning.

* Stick to non-namespace EspSoftwareSerial class name for the moment.

* Delegate operator() is now nullptr-safe, good for use in ISRs.

* Pushed EspSoftwareSerial 8.0.1: Platformio picks up versions that aren't published in Github
2023-03-11 18:02:04 +03:00
Max Prokhorov
0e5d358c3c
Version 3.1.1 (#8806) 2023-01-15 02:01:02 +03:00
david gauchard
39080e317e
delay / esp_delay: transparently manage recurrent scheduled functions (#8802)
Recurrent scheduled functions will always be running in background.

esp_delay()'s interval (intvl_ms) is internally kept to its highest value allowing to honor recurrent scheduled functions requirements.

It transparently allows to keep with the arduino and nonos-sdk trivial programming way and still use background services or drivers running regularly.
2023-01-14 22:25:57 +01:00
david gauchard
8ae300d476
release 3.1.0 (#8788) 2023-01-06 22:06:06 +01:00
Max Prokhorov
f06710eb6e
hostByName timeout fixes (#8787)
* single impl
2023-01-05 14:29:14 +01:00
piotrcurious
3e357f32b1
Allow passing beacon interval to SoftAP config (#8695)
allow passing beacon_interval to the softAP
2023-01-05 09:54:05 +01:00
Max Prokhorov
204d2c93a7
NONOS SDK clean-up (#8770)
Remove nonos-sdk-v2.2.0-28-g89920dc aka 3v0, since we have a real v3
Remove 3.0.0...3.0.4 to reduce overhead in maintaining a bunch or binary patches
Update our docs and menu opts to mention 'experimental' status

Old versions still remains in git history, so anyone wanting to play around with 3.0.x could still make use of that work
2023-01-03 01:40:53 +03:00
Krzysiek S
b565b8686d
Optimize disconnect method in WiFiSTA class (#8760) 2022-12-16 14:22:26 +01:00
Max Prokhorov
9dce0764af
Don't return true with WiFiClientSecureBearSSL::connected() when really disconnected (#8330)
* Don't return `true` with WiFiClientSecureBearSSL::connected() when disconnected

Apply the same condition as with normal WiFiClient - we are not connected
when it's not possible to both write and read.

Implement separate methods for actual connection status and the internal
ssl engine status and update methods that were previously using available()
for this purpose

Update examples to check available() when the intent is to only read the
data and not interact with the client in any other way. Also, use connect()
as a way to notify errors, no need to check things twice
2022-12-16 12:12:58 +01:00
Krzysiek S
d3c8d272d7
Add eraseap option to WiFi disconnect method. (#8758)
Add eraseCredentials option to WiFi disconnect method (legacy default: true)
2022-12-15 10:30:29 +01:00
metarutaiga
93537f94a8
Added NONOS SDK 3.0.0 ~ 3.0.5 (again) (#8736)
* Added NONOS SDK 3.0.0 ~ 3.0.5

* Added user_pre_init

* rf_cal[0] !=0x05,is 0x00

* # Remove mem_manager.o from libmain.a to use custom heap implementation, and time.o to fix redefinition of time-related functions
# Rename `hostname` and `default_hostname` symbols

* user_rf_pre_init

* Add system_func1() called by system_restart_local()

* Add commit log text

* Fixed user_rf_pre_init

* Style

* pio sdks

Co-authored-by: TAiGA <>
Co-authored-by: Maxim Prokhorov <prokhorov.max@outlook.com>
2022-12-06 13:43:48 +03:00
RobertGnz
3c6db4ed9b
WiFiClient::abort() (#8738)
Api for saving heap when Client class is used by a Server (WiFiServer class): Client = Server.available().

Suppose the local end is the server and the remote end is the client, we will deal with heap memory at the local end.

When the local application (server) decides to close an active connection with a remote end it issues an Client.stop.
The stop() function calls the close() function of ClientContext class which in turn calls tcp_close.
The connexion is closed by tcp_close and the protocol control block (pcb) can be put in the following states depending on the requests sent by the remote: CLOSING, FIN_WAIT_1 and FIN_WAIT_2. In theses states pcbs are not freed, then consume some memory heap.
If an acknowledgment from the remote end is received, the pcb enter in TIME_WAIT state for some minutes but pcbs in TIME_WAIT state are not freed. Then consume some heap memory.
TIME_WAIT pcbs are automatically freed after some minutes or can be freed for instance issuing an tcp_kill_timewait()
in the local application which will free the oldest pcb in TIME_WAIT state.

If the connection is first closed from the remote end (the client), the local end (server) receive a connection termination request. It then acknowledge it and enter in CLOSE_WAIT state waiting for a connection termination request from the local application.
It then send a termination request and enter in LAST_ACK state until it receive an acknowledgment from the remote end.
After receiving the acknowledgment it enter in ClOSED state and the local pcb is freed leaving some room in the heap memory.

To summarize, when a connexion termination request is send by one end (remote or local), the local pcb is not freed immediatly.
This pcb can be in the following states: FIN_WAIT_1, FIN_WAIT_2, CLOSING, TIME_WAIT, CLOSE_WAIT, LAST_ACK.
As a consequence, some old pcbs from old closed connections are still consuming heap memory.

The local application can call tcp_kill_timewait hoping it will free some TIME_WAIT state pcbs. But if the server receive frequent connections requests and close them after sending whatever it has to send, there may be zero pcbs in TIME_WAIT state among all previously closed connections.

In case of insufficient memory to accept a new connection, lwip has developped a strategy: it successively tries to kill the oldest pcb in TIME_WAIT state, or in LAST_ACK state or in CLOSING state or the oldest active connection with lower priority than the new one.

As a matter of fact this "urgent" strategy is deployed only when very few heap memory remain available (less than some kb). In case of success, Client.available returns a valid Client but the local application will crash when sending or receiving data from the client (Client.read ou readuntil or available) because this need more heap memory and just some kb were freed in lwip to allocate the new pcb structure ans start the new connection.

The propose API is intended to avoid this drawback by calling the abort function of ClientContext which in turn calls tcp_abort which calls tcp_abandon. The connection is aborted and notified to the client with a RESET and the pcb and ressources associated are immediately released increasing the available heap memory.
2022-12-06 12:40:48 +03:00
seism0saurus
80bf716625
Only check the actual used lenght of the hash. (#8709) 2022-11-06 00:20:23 +03:00
Jiri Bilek
5f94a60d78
Changed / added virtual functions for returning connection information (#8693)
Fixes the incorrect behavior of WiFiClientSecure.remoteIP(), .remotePort(), .localIP(), .localPort().
2022-10-31 06:25:04 +03:00
M Hightower
3df5693697
Expand access to SDK's struct bss_info (#8683)
The NONOS SDK's `struct bss_info` in `user_interface.h` has grown since the
beginning of this project. The additional elements are not accessible.
Add a method for R/O access to full `struct bss_info`.

See #7965 (comment)
2022-10-10 15:56:44 +03:00
Max Prokhorov
a0c7a85649
Fix Updater non-zero _verify->length() once again (#8545)
Amends #8507
I took the liberty to also do some refactoring; specifically, fixing signed vs. unsigned mismatch in len, using pointer object vs. the original manual malloc & free, try to have named constants for certain addresses and lengths, plus localize printing of u8 arrays.

The suggested test to have a 'dummy' verifier works just fine. (...how it actually works and gets the hash to compare with is a whole other question, though)

Another issue noticed while testing, in the underlying bearssl api there's an actual limit for hash length.
6105635531/inc/bearssl_rsa.h (L257)
2022-09-13 15:57:42 +03:00
david gauchard
646bdfc060
SSL examples: updates (#8643)
Simplify SSL+ethernet example, reuse/include WiFi example
2022-07-28 00:47:10 +03:00
david gauchard
e149829802
update example certs (#8642)
* update certs
2022-07-19 12:21:35 +02:00
david gauchard
a8e3786d38
Fix hostname management (#8626)
* manage hostname with sdk string
2022-07-06 22:57:58 +02:00
Max Prokhorov
7e5520c23e
Fix DHCP server pbuf handling and allow to change netif address (#8602)
* Fix sending NACK, use helper function to fill pbuf

As noticed in https://github.com/esp8266/Arduino/pull/8582#issuecomment-1153331408
Plus, handle the case when `pbuf->len` is less than struct size

* Make sure to call SDK functions to start and stop DHCP server

As noticed in https://github.com/esp8266/Arduino/pull/8582#issuecomment-1153331408
Can't really use `server.begin()` and `server.end()` directly, only
default static IP is applied to the interface since DHCP server is
deemed 'running' (see `wifi_softap_dhcps_status()` return value)

* s

Co-authored-by: david gauchard <gauchard@laas.fr>
2022-06-27 03:26:05 +03:00
Max Prokhorov
0bff52fe55
Without autoreconnect, forcibly stop station connection manager (#8607) 2022-06-27 02:21:40 +03:00
Max Prokhorov
7935bed18f
Provide wl_tcp_state as tcp_state alias (#8609) 2022-06-24 15:41:51 +02:00
david gauchard
7d9abbb605
do not call tcp/udp ::stopAll() when it is not required to do so (#8598)
* do not call tcp/udp ::stopAll() when it is not required to to so
* remove stopAll also from ArduinoOTA
2022-06-23 22:14:19 +02:00
Max Prokhorov
b7c1cfbc45
DHCP custom option (#8582)
* works

* fixup! works

* back to callbacks

* names

* daisy chain

* seconds

* less inline

* fix dns setter

* might as well keep using initlist

/to d-a-v it has automatic storage, here it's the same stack based one
(just one less line for us)

* shift blame

* naming

* fix impl

* revert to ip4 dns

* merge fix

* restyle

* masking done wrong
2022-06-08 23:19:59 +02:00
Max Prokhorov
502d9469fa
Initialize SoftAP DhcpServer object on demand (#8546)
* Initialize SoftAP DhcpServer object on demand

Remove dependency on global ctor, and just construct the object when
someone asks us to do it. Only dependency right now is netif_git, which
is expected to be initialized by the lwip code some time before
dhcps_start happens.

Removing ip_info from begin(), since we never reference later on.
Also removing the specific check for netif id and simplify the ctors.

Update tests and recover old nonos-sdk dhcps functions that were not implemented.

* nonos helpers have a separate header

* wifi ap needs this anyway, simplify sketch includes

* missing example

* existing name :/

* trying to fix header dependency

* restyle

* not a c header

* no need to init

* move dhcp server getter to WiFi

more... arduino'ish? we ahve object as namespace, plus everything else
related to softAP is there
redundant includes, redundant mock impl (out-of-scope here to fix)

* ...move things back, still expose as WiFi method

* review fix

* include -nonos header in wifi lib though

* no more lwip include

* style

* need mock dhcpserver instance
2022-06-01 22:46:04 +02:00
david gauchard
80c0570620
Define lwIP's s32/u32 to int (#8560)
* Define lwIP's s32/u32 to int

s32/u32 were previously defined as long,
but long can be 64 bits in host mode,
so this commit reduces valgrind complaints and increase coherency.

* some lads like to use `unsigned long` for 32 bits IPv4 addresses

* fix lwIP's `sys_now()` return type

* fix C declarations

* merge upstream (lwip2) update on sys_now() definition

* matching lwIP api (2/2)

Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
2022-05-15 21:55:56 +02:00
Paulo Cabral Sanz
27827c8c6d
Delete operator=(Self&) when copy constructor is deleted (#8535) 2022-04-11 13:41:21 +03:00
Earle F. Philhower, III
d205a63309
Update sessions example to show speed difference (#8528)
Fixes #8505
2022-04-04 10:48:29 +02:00
Maxim Prokhorov
19b7a29720 Migrate from astyle to clang-format (#8464) 2022-03-04 02:28:47 +03:00
Juraj Andrássy
f401f08aba
WiFiServer - 'rename' available() to accept() (#8419)
* WiFiServer - 'rename' available() to accept()
* use server.accept() instead of available()
* WiFiServer.accept() and ArduinoWiFiServer class doc update
2022-01-03 14:32:02 +01:00