mirror of
https://github.com/nodemcu/nodemcu-firmware.git
synced 2025-01-16 20:52:57 +08:00
5e9ab01523
Implement SDK event monitor Move wifi status event monitor code into seperate file (app/modules/wifi_eventmon.c) Modify wifi lua callback registration code. Add Functions wifi.ap.deauth and wifi.sta.getrssi Rework wifi event monitor to use tasking interface fix for Lua coroutine compatibility issue Made changes Suggested by TerryE Also, moved code that sets the default host name out of luaopen_wifi_init and into a separate function and added a post_task_low entry in it's place. Replaced some if test then return error lines with luaL_argcheck Add check for malloc null return in wifi.eventmon to catch out of memory errors
18 lines
430 B
C
18 lines
430 B
C
#include "wifi_common.h"
|
|
|
|
void wifi_add_int_field(lua_State* L, char* name, lua_Integer integer)
|
|
{
|
|
lua_pushinteger(L, integer);
|
|
lua_setfield(L, -2, name);
|
|
}
|
|
void wifi_add_sprintf_field(lua_State* L, char* name, char* string, ...)
|
|
{
|
|
char buffer[256];
|
|
va_list arglist;
|
|
va_start( arglist, string );
|
|
c_vsprintf( buffer, string, arglist );
|
|
va_end( arglist );
|
|
lua_pushstring(L, buffer);
|
|
lua_setfield(L, -2, name);
|
|
}
|