-
Notifications
You must be signed in to change notification settings - Fork 7.3k
drivers: wifi: esp32: Add WiFi event information for station connect and disconnect #88519
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
base: main
Are you sure you want to change the base?
drivers: wifi: esp32: Add WiFi event information for station connect and disconnect #88519
Conversation
Hello @chirambaht, and thank you very much for your first pull request to the Zephyr project! |
b911bdc
to
f8d1d35
Compare
9d673d5
to
84f731d
Compare
84f731d
to
5dc7d84
Compare
} | ||
|
||
LOG_DBG("Disconnect reason: %d", event->reason); | ||
wifi_mgmt_raise_disconnect_result_event(esp32_wifi_iface, WIFI_REASON_DISCONN_SUCCESS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps you could return the disconnect event value from both calls you created and have this single call here with that value.
In current approach:
wifi_mgmt_raise_disconnect_result_event
is being called 2x.- You have multiple calls to
wifi_mgmt_raise_disconnect_result_event
when you could use a single one.
Would you mind analyzing if the above suggestion is acceptable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback.
There are two different events being made depending on weather iface is connected to an AP or not. If not connected, the event is a connect
event and if it is connected, it's a disconnect
event With that in mind, I think two functions could work, but I do agree that there are a lot of wifi_mgmt_raise_disconnect_result_event
and wifi_mgmt_raise_connect_result_event
calls. I will reduce those.
Would that be a workable solution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sylvioalves I have updated the code to reflect this idea
Added events for when the station iface is used to connect and disconnect. These events will feed the NET_EVENT_WIFI_CONNECT_RESULT and NET_EVENT_WIFI_DISCONNECT_RESULT events to send information to applications making use of them Signed-off-by: Humphrey Chiramba <[email protected]>
5dc7d84
to
cb66c24
Compare
The ESP32's WiFi event information system has now been linked with the Zephyr WiFi events system for station related operations. This allows users of the ESP32 wifi driver to obtain more precise WiFi connection related event information such as incorrect passwords, timeouts and more.
The work presented here was guided by the ESP32's WiFi event documentation provided here: https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/wifi.html#event-handling.
In order to validate this, I ran the wifi_shell example with the appropriate logging levels for WiFi and passed in various different network credentials to see if the appropriate events were raised with the correct information.