Initial commit
This commit is contained in:
36
main/wifi_manager.h
Normal file
36
main/wifi_manager.h
Normal file
@ -0,0 +1,36 @@
|
||||
#ifndef WIFI_MANAGER_H
|
||||
#define WIFI_MANAGER_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "esp_err.h"
|
||||
|
||||
// WiFi configuration
|
||||
#define WIFI_MAXIMUM_RETRY 10
|
||||
#define WIFI_CONNECTED_BIT BIT0
|
||||
#define WIFI_FAIL_BIT BIT1
|
||||
|
||||
// WiFi manager states
|
||||
typedef enum {
|
||||
WIFI_STATE_DISCONNECTED,
|
||||
WIFI_STATE_CONNECTING,
|
||||
WIFI_STATE_CONNECTED,
|
||||
WIFI_STATE_ERROR
|
||||
} wifi_state_t;
|
||||
|
||||
// WiFi event callback
|
||||
typedef void (*wifi_event_callback_t)(wifi_state_t state);
|
||||
|
||||
// WiFi manager functions
|
||||
esp_err_t wifi_manager_init(void);
|
||||
esp_err_t wifi_manager_start(void);
|
||||
esp_err_t wifi_manager_stop(void);
|
||||
bool wifi_manager_is_connected(void);
|
||||
wifi_state_t wifi_manager_get_state(void);
|
||||
void wifi_manager_register_callback(wifi_event_callback_t callback);
|
||||
|
||||
// Configuration functions
|
||||
esp_err_t wifi_manager_set_credentials(const char* ssid, const char* password);
|
||||
esp_err_t wifi_manager_get_credentials(char* ssid, size_t ssid_len, char* password, size_t pass_len);
|
||||
esp_err_t wifi_manager_clear_credentials(void);
|
||||
|
||||
#endif // WIFI_MANAGER_H
|
||||
Reference in New Issue
Block a user