Changelog
1.2.0
- Added:
wifi_connect()takesBaremetal\Wifi\PowerSave $power_save = PowerSave::Minimum, how much the station's radio sleeps while associated: the new enumBaremetal\Wifi\PowerSavehasNone(none, the radio stays on),Minimum(minimum, the platform's default) andMaximum(maximum). It is set before the connect starts and kept until the nextwifi_connect(). With the default nothing changes. Anything but aPowerSavecase is a\TypeError; a mode the platform refuses (on ESP32,Nonewhile Bluetooth shares the radio) makeswifi_connect()returnfalsewithout connecting.Nonekeeps HTTP steady on a weak access point, where modem sleep can stall it. - Changed: requires
php-baremetal/wifi-hal^1.2 (bm_wifi_hal_sta_set_power_save(); esp32-wifi-hal 1.2.0). - Changed: the module version is
1.2.0.
1.1.0
- Added: ide/ext-wifi.stub, the PHP declarations of the package for IDEs (conductor copies it into vendor/php-baremetal/ide-stubs/).
- Added: Wi-Fi events on the event bus of ext-events, after
wifi_events(), which returns aBaremetal\Wifi\Events(aBaremetal\Source:stop(),start(),running()). Ninefinalclasses extending the abstractBaremetal\Wifi\Event:StateChanged($state,$previous,$ssid),Online($ip,$ssid),ConnectFailed($reason,$code,$ssid),Disconnected($reason,$code,$retrying),ScanDone($networks),ApStarted($ssid,$ip),ApStopped($clients),ClientJoinedandClientLeft($mac,$clients). Nothing is emitted before the first call;wifi_events()throws in theweb-serverruntime like the other sources. - Added: the enums
Baremetal\Wifi\State(Idle,Connecting,Connected,Online) andBaremetal\Wifi\Reason(WrongPassword,NotFound,Lost,ByUser,Other). - Added:
wifi_connect()takesbool $wait = true(falsestarts the connect and returns at once; the outcome comes asOnlineorConnectFailed) andint $retries = 10(automatic retries after a failed or dropped association, refilled at every IP;0none,-1forever; below-1a\ValueError). Two password refusals in a row before the first IP give up at once withReason::WrongPassword, whatever$retriesis (-1included); a single refusal is retried. A connect while another is in progress cancels it. With the defaults nothing else changes: a password refused twice in a row now fails at once, where 1.0.2 retried it up to 10 times. - Added:
wifi_scan(bool $wait = true):falsestarts a scan and returns whether it started; the list comes inScanDone. - Added:
wifi_state(): Baremetal\Wifi\State,wifi_ssid(): ?string(the network asked for or in use,nullinIdle) andwifi_ap_active(): bool. - Changed: requires
php-baremetal/ext-events^1.1 (the event bus;bm_events_set_zval()for the fillers),php-baremetal/events-hal^1.3 (the lock of the station state) andphp-baremetal/wifi-hal^1.1 (driver events,bm_wifi_hal_sta_connect_ex(), the asynchronous scan,bm_wifi_hal_sta_ssid(),bm_wifi_hal_ap_active(); esp32-wifi-hal 1.1.0). The functions still work in every runtime. - Changed: the module version is
1.1.0(was1.0).
1.0.2
- Changed: the default
$timeout_msofwifi_connect()is 30000 (was 15000), and a value of 0 or less also means 30000. Joining a WPA3 network with a weak radio could take longer than 15 s. - Fixed:
wifi_available()always returnedtrue. It now says whether the radio comes up (with an ESP32-C6 companion that did not start,false). - Fixed: SSIDs and passwords were not checked.
wifi_connect()andwifi_ap_start()throw\ValueErrorfor an SSID that is not 1 to 32 bytes, a password over 64 bytes, and a NUL byte in either (a password starting with NUL opened the access point); a 32-byte SSID now works (with esp32-wifi-hal 1.0.2). - Fixed: Reflection reported the optional parameters of
wifi_connect()andwifi_ap_start()without their defaults (null,30000,1,4).
1.0.1
- Changed: the author's contact email.
- Docs: projects use
"sdk": "esp32@^2.0".
1.0.0
Initial release.