From 9f336953131e149c160bebcc5334232d4d139df5 Mon Sep 17 00:00:00 2001 From: Joe Pasqua Date: Fri, 18 Dec 2020 10:46:02 -0800 Subject: [PATCH 1/2] Add AP start/stop events The client can now be notified when the library goes into station mode. This is useful if it wants to display some indication to the user. The client will also be notified when station mode is turned off. --- .gitignore | 1 + include/wifi_config.h | 2 ++ src/wifi_config.c | 4 ++++ 3 files changed, 7 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/include/wifi_config.h b/include/wifi_config.h index 969ba6f..a458ce5 100644 --- a/include/wifi_config.h +++ b/include/wifi_config.h @@ -3,6 +3,8 @@ typedef enum { WIFI_CONFIG_CONNECTED = 1, WIFI_CONFIG_DISCONNECTED = 2, + WIFI_CONFIG_AP_START = 3, + WIFI_CONFIG_AP_STOP = 4 } wifi_config_event_t; void wifi_config_init(const char *ssid_prefix, const char *password, void (*on_wifi_ready)()); diff --git a/src/wifi_config.c b/src/wifi_config.c index f9cf93a..1a4304b 100644 --- a/src/wifi_config.c +++ b/src/wifi_config.c @@ -682,6 +682,8 @@ static void wifi_config_softap_start() { dns_start(); http_start(); + if (context->on_event) + context->on_event(WIFI_CONFIG_AP_START); } @@ -690,6 +692,8 @@ static void wifi_config_softap_stop() { dns_stop(); http_stop(); sdk_wifi_set_opmode(STATION_MODE); + if (context->on_event) + context->on_event(WIFI_CONFIG_AP_STOP); } From 342dd2fde2a0cc08dbb319fe66e0fc9462364ac6 Mon Sep 17 00:00:00 2001 From: Joe Pasqua Date: Sat, 19 Dec 2020 15:56:18 -0800 Subject: [PATCH 2/2] Delete .gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .gitignore diff --git a/.gitignore b/.gitignore deleted file mode 100644 index e43b0f9..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.DS_Store