wificfg: add shutdown hooks, and add support to wait until connected.

Remove the wificfg_got_sta_connect() function and replace it with
wificfg_wait_until_sta_connected(). This replaces a probe function with a wait
function, and this better fits the wifi layer using an event model - the wait
function can wait on a station connection event before returning.

The shutdown hooks are call when the wificfg restart function is used. It can
be used to implement a cleaner restart, for example blocking further i2c and
flash operations.
This commit is contained in:
Our Air Quality 2018-06-17 16:04:34 +10:00
parent d9c5f2eaa2
commit 5fb2e94fed
2 changed files with 48 additions and 5 deletions

View file

@ -121,11 +121,11 @@ ssize_t wificfg_write_chunk_end(int s);
/* Write a html title meta data, using the hostname or AP SSI. */
int wificfg_write_html_title(int s, char *buf, size_t len, const char *str);
/* Callback to notify the wificfg logic that a station connection has been
* successfully established. It might use this to disable the AP interface after
* a restart.
*/
void wificfg_got_sta_connect(void);
/* Wait until the station interface has connected to an access point,
* and obtained an IP address. */
void wificfg_wait_until_sta_connected(void);
bool wificfg_add_shutdown_hook(void (*fn)(void *), void *arg);
#ifdef __cplusplus
}