Skip to content
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

Add event callbacks to wifi.sta.config() and wifi.ap.config() and more #1903

Merged
merged 3 commits into from
May 21, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/en/modules/wifi.md
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,8 @@ Sets the WiFi station configuration.
- `save` Save station configuration to flash.
- `true` configuration **will** be retained through power cycle.
- `false` configuration **will not** be retained through power cycle. (Default).
- Event callbacks will only be available if `WIFI_SDK_EVENT_MONITOR_ENABLE` is enabled in `user_config.h`
- Event callbacks will only be available if `WIFI_SDK_EVENT_MONITOR_ENABLE` is uncommented in `user_config.h`
- Please note: To ensure all station events are handled at boot time, all relevant callbacks must be registered as early as possible in `init.lua` with either `wifi.sta.config()` or `wifi.eventmon.register()`.
- `connected_cb`: Callback to execute when station is connected to an access point. (Optional)
- Items returned in table :
- `SSID`: SSID of access point. (format: string)
Expand Down Expand Up @@ -1143,7 +1144,8 @@ Sets SSID and password in AP mode. Be sure to make the password at least 8 chara
- `save` save configuration to flash.
- `true` configuration **will** be retained through power cycle. (Default)
- `false` configuration **will not** be retained through power cycle.
- Event callbacks will only be available if `WIFI_SDK_EVENT_MONITOR_ENABLE` is enabled in `user_config.h`
- Event callbacks will only be available if `WIFI_SDK_EVENT_MONITOR_ENABLE` is uncommented in `user_config.h`
- Please note: To ensure all SoftAP events are handled at boot time, all relevant callbacks must be registered as early as possible in `init.lua` with either `wifi.ap.config()` or `wifi.eventmon.register()`.
Copy link
Collaborator

@TerryE TerryE Apr 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment about this. The way this reads, the cb's are optional, which they are technically, but I feel that we should add a caveat to the effect that:

Application developers​ should not assume that the WiFi is connected at any time during initialization start-up. This should be validated either by using a wifi event callback or by polling the status on a timer.

Or words to that effect.

- `staconnected_cb`: Callback executed when a new client has connected to the access point. (Optional)
- Items returned in table :
- `MAC`: MAC address of client that has connected.
Expand Down