Deprecate wifi.sta.eventMonReg (#1889)

* Update wifi event monitor documentation

Added a note to `wifi.eventmon.register()` and `wifi.sta.eventmonreg()`
* Add deprecation note to `wifi.sta.eventMonReg()`
This commit is contained in:
dnc40085 2017-03-31 00:48:04 -07:00 committed by Marcel Stör
parent fc887e9f9f
commit 50a5c02119
2 changed files with 9 additions and 0 deletions

View File

@ -63,6 +63,8 @@ static void wifi_status_cb(int arg)
// wifi.sta.eventMonReg() // wifi.sta.eventMonReg()
int wifi_station_event_mon_reg(lua_State* L) int wifi_station_event_mon_reg(lua_State* L)
{ {
platform_print_deprecation_note("wifi.sta.eventmonreg() is replaced by wifi.eventmon.register()", "in the next version");
uint8 id=(uint8)luaL_checknumber(L, 1); uint8 id=(uint8)luaL_checknumber(L, 1);
if ((id > 5)) // verify user specified a valid wifi status if ((id > 5)) // verify user specified a valid wifi status
{ {

View File

@ -398,6 +398,9 @@ none
Registers callbacks for WiFi station status events. Registers callbacks for WiFi station status events.
!!! note
Please update your program to use the [`wifi.eventmon`](#wifieventmon-module) API, as the `wifi.sta.eventmon___()` API is deprecated.
#### Syntax #### Syntax
- `wifi.sta.eventMonReg(wifi_status[, function([previous_state])])` - `wifi.sta.eventMonReg(wifi_status[, function([previous_state])])`
@ -1371,6 +1374,10 @@ Note: The functions `wifi.sta.eventMon___()` and `wifi.eventmon.___()` are compl
## wifi.eventmon.register() ## wifi.eventmon.register()
Register/unregister callbacks for WiFi event monitor. Register/unregister callbacks for WiFi event monitor.
- After a callback is registered, this function may be called to update a callback's function at any time
!!! note
To ensure all WiFi events are caught, the Wifi event monitor callbacks should be registered as early as possible in `init.lua`. Any events that occur before callbacks are registered will be discarded!
#### Syntax #### Syntax
wifi.eventmon.register(Event[, function(T)]) wifi.eventmon.register(Event[, function(T)])