Skip to content

Commit

Permalink
Add AP start/stop events
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jpasqua committed Dec 19, 2020
1 parent 22509d4 commit 9f33695
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
2 changes: 2 additions & 0 deletions include/wifi_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)());
Expand Down
4 changes: 4 additions & 0 deletions src/wifi_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}


Expand All @@ -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);
}


Expand Down

0 comments on commit 9f33695

Please sign in to comment.