46 lines
934 B
C
46 lines
934 B
C
#ifndef WIFI_MANAGER_H
|
|
#define WIFI_MANAGER_H
|
|
|
|
#include <stdbool.h>
|
|
|
|
/**
|
|
* Initializes the WiFi hardware.
|
|
* Returns true on success.
|
|
*/
|
|
bool wifi_init();
|
|
|
|
/**
|
|
* Scans for available WiFi networks and prints them to stdout.
|
|
*/
|
|
void wifi_scan();
|
|
|
|
/**
|
|
* Connects to the specified WiFi network.
|
|
* Returns true if connected successfully.
|
|
*/
|
|
bool wifi_connect(const char* ssid, const char* password);
|
|
|
|
/**
|
|
* Saves the WiFi credentials to flash memory for auto-connect.
|
|
* Returns 0 (PICO_OK) on success, or an error code on failure.
|
|
*/
|
|
int wifi_save_credentials(const char* ssid, const char* password);
|
|
|
|
/**
|
|
* Attempts to connect using saved credentials.
|
|
* Returns true if connected.
|
|
*/
|
|
bool wifi_try_auto_connect();
|
|
|
|
/**
|
|
* Returns true if currently connected to WiFi.
|
|
*/
|
|
bool wifi_is_connected();
|
|
|
|
/**
|
|
* Returns the current IP address as a string, or "Disconnected".
|
|
*/
|
|
const char* wifi_get_ip();
|
|
|
|
#endif // WIFI_MANAGER_H
|