Browse Source

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()`
dnc40085 7 years ago
parent
commit
50a5c02119
2 changed files with 9 additions and 0 deletions
  1. 2 0
      app/modules/wifi_eventmon.c
  2. 7 0
      docs/en/modules/wifi.md

+ 2 - 0
app/modules/wifi_eventmon.c

@@ -63,6 +63,8 @@ static void wifi_status_cb(int arg)
 // wifi.sta.eventMonReg()
 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);
   if ((id > 5)) // verify user specified a valid wifi status
   {

+ 7 - 0
docs/en/modules/wifi.md

@@ -398,6 +398,9 @@ none
 
 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
 - `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()
 
 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
 wifi.eventmon.register(Event[, function(T)])