Files
kidsbox/device/main/Networking.cpp
T
Claude bf9852c345 Implement full NFC-URL streaming architecture
- rc522: add NDEF URL reading via WUPA+cascade anticoll+SELECT+TLV parse
- AudioPlayer: route http:// URIs to esp_player_http_music_play()
- CacheManager: download URLs async to /sdcard/cache/{hash}.{ext}
- TagPlayerControl: NDEF URL → cache-or-stream; fallback to UID local mapping
- RFIDInterface: wire ndef_callback, expose combined uid+url callback
- WebInterface: add /api/info, /api/storage, /api/playback, /api/bluetooth
- BluetoothInterface: stub for A2DP speaker mode
- Networking: WiFi connect with 30s timeout instead of blocking forever
- main.cpp: re-enable WiFi + web server, fix init order, add CacheManager
- www/: full SPA — playback controls, device info, storage, BT pairing
- .gitmodules: switch rc522 submodule URL to HTTPS

https://claude.ai/code/session_01MhAnh68DPNnTjcKqjNYDmk
2026-06-12 19:44:54 +00:00

27 lines
767 B
C++

#include "Networking.hpp"
#include "WiFi.h"
#include <esp_log.h>
static const char* TAG = "Networking";
static constexpr int WIFI_TIMEOUT_MS = 30000;
static constexpr int WIFI_POLL_MS = 500;
void Networking::connectWifi() {
WiFi.begin(CONFIG_ESP_WIFI_SSID, CONFIG_ESP_WIFI_PASSWORD);
int elapsed = 0;
while(WiFi.status() != WL_CONNECTED && elapsed < WIFI_TIMEOUT_MS) {
vTaskDelay(WIFI_POLL_MS / portTICK_PERIOD_MS);
elapsed += WIFI_POLL_MS;
ESP_LOGI(TAG, "Waiting for WiFi... (%d ms)", elapsed);
}
if(WiFi.status() == WL_CONNECTED) {
ESP_LOGI(TAG, "Connected. IP: %s", WiFi.localIP().toString().c_str());
} else {
ESP_LOGW(TAG, "WiFi connection timed out — running without network");
}
}