initial commit
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
#pragma once
|
||||
|
||||
#include "page.h"
|
||||
#include "network/nm_types.h"
|
||||
#include "text_cache.h"
|
||||
#include <SDL3_ttf/SDL_ttf.h>
|
||||
#include <atomic>
|
||||
#include <future>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class WiFiSetupPage : public Page {
|
||||
public:
|
||||
enum class InputMode {
|
||||
Normal,
|
||||
PasswordEntry,
|
||||
Connecting
|
||||
};
|
||||
|
||||
void onPush(AppState& state) override;
|
||||
void onResume(AppState& state) override;
|
||||
void onPause(AppState& state) override;
|
||||
void onPop(AppState& state) override;
|
||||
void handleEvent(const SDL_Event& event) override;
|
||||
void update(float dt) override;
|
||||
void render(SDL_Renderer* renderer) override;
|
||||
|
||||
private:
|
||||
void refreshNetworkState();
|
||||
void triggerScan();
|
||||
void startConnectAsync(const std::string& ssid, const std::string& password);
|
||||
void exitPage(AppState& state);
|
||||
void createFonts();
|
||||
void destroyFonts();
|
||||
void destroyTextures();
|
||||
|
||||
AppState* state_ = nullptr;
|
||||
InputMode inputMode_ = InputMode::Normal;
|
||||
int selectedIndex_ = 0;
|
||||
|
||||
std::string passwordInput_ = "";
|
||||
std::string statusMessage_ = "Press F5 to scan for available networks";
|
||||
|
||||
std::vector<radiantwave::network::NetworkInfo> networks_;
|
||||
std::vector<std::string> savedSsids_;
|
||||
std::string connectedSsid_ = "";
|
||||
bool isConnected_ = false;
|
||||
bool hasInternet_ = false;
|
||||
|
||||
float refreshTimer_ = 0.0f;
|
||||
float returnTimer_ = -1.0f; // >0 = countdown before auto-advancing the walkthrough
|
||||
|
||||
// Async connection tracking
|
||||
std::future<radiantwave::network::ConnectResult> connectFuture_;
|
||||
bool connectInProgress_ = false;
|
||||
|
||||
TTF_Font* fontTitle_ = nullptr;
|
||||
TTF_Font* fontHeader_ = nullptr;
|
||||
TTF_Font* fontBody_ = nullptr;
|
||||
TTF_Font* fontSmall_ = nullptr;
|
||||
|
||||
CachedText titleText_;
|
||||
CachedText wifiStatusText_;
|
||||
CachedText networkText_;
|
||||
CachedText internetText_;
|
||||
CachedText statusMsgText_;
|
||||
CachedText emptyText_;
|
||||
std::vector<CachedText> ssidRows_;
|
||||
std::vector<CachedText> secBadges_;
|
||||
std::vector<CachedText> sigTexts_;
|
||||
|
||||
CachedText passwordPromptText_;
|
||||
CachedText passwordValueText_;
|
||||
CachedText passwordHintText_;
|
||||
CachedText footerText_;
|
||||
};
|
||||
Reference in New Issue
Block a user