Login
1 branch 0 tags
Ben (T14/NixOS) Minor Makefile cleanup 7080bfb 28 days ago 85 Commits
moon / src / network.h
#pragma once
#include <stdbool.h>

// Initialize network stack (call once at startup)
void network_init(void);

// Enable or disable network connectivity
// On ESP32: manages WiFi connection using config.toml credentials
// On SDL2: no-op (network always available)
bool network_set_enabled(bool enabled);

// Download a file from URL to local storage path
// Returns true on success
bool network_download_file(const char* url, const char* destination_path);

// Check if network is currently connected
bool network_is_connected(void);

// Get WiFi signal strength in dBm (ESP32 only, SDL stub returns 0)
int network_get_rssi(void);

// Download a URL and discard the content, returns true on success
bool network_test_url(const char* url);

// Scan for nearby WiFi networks
// Fills ssids with found network names (up to max_results)
// Returns number of networks found
int network_scan(char ssids[][33], int max_results);