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
This commit is contained in:
Claude committed 2026-06-12 19:44:54 +00:00
1 parent 98872d75df
commit bf9852c345
19 files changed
+1172 -318

No files matched your search

+47 -12
View File
@@ -1,24 +1,40 @@
#include "AudioPlayer.hpp"
#include <iostream>
#include <esp_player_wrapper.h>
#include "audio_setup.h"
#include <string>
#include <esp_log.h>
static const char* TAG = "AudioPlayer";
AudioPlayer::AudioPlayer() {
playerHandle = setup_player(NULL, NULL);
esp_player_init(playerHandle);
esp_audio_vol_set(playerHandle, 50);
esp_player_init((esp_audio_handle_t)playerHandle);
esp_audio_vol_set((esp_audio_handle_t)playerHandle, 50);
}
void AudioPlayer::play(std::string uri) {
if (isLastUri(uri)) {
bool AudioPlayer::isHttpUri(const std::string& uri) const {
return uri.rfind("http://", 0) == 0 || uri.rfind("https://", 0) == 0;
}
bool AudioPlayer::isLastUri(const std::string& uri) const {
return lastUri == uri;
}
void AudioPlayer::play(const std::string& uri) {
if(isLastUri(uri)) {
esp_player_music_resume();
return;
}
esp_player_music_stop();
lastUri = uri;
if(isHttpUri(uri)) {
ESP_LOGI(TAG, "Streaming: %s", uri.c_str());
esp_player_http_music_play(uri.c_str(), 0);
} else {
esp_player_music_stop();
ESP_LOGI(TAG, "Playing local: %s", uri.c_str());
esp_player_sdcard_music_play(uri.c_str(), 0);
lastUri = std::string(uri);
}
}
@@ -26,6 +42,25 @@ void AudioPlayer::pause() {
esp_player_music_pause();
}
bool AudioPlayer::isLastUri(std::string uri) {
return lastUri == uri;
}
void AudioPlayer::stop() {
esp_player_music_stop();
lastUri.clear();
}
int AudioPlayer::getVolume() {
int vol = 0;
esp_player_vol_get(&vol);
return vol;
}
void AudioPlayer::setVolume(int vol) {
if(vol < 0) vol = 0;
if(vol > 100) vol = 100;
esp_audio_vol_set((esp_audio_handle_t)playerHandle, vol);
}
bool AudioPlayer::isPlaying() const {
esp_audio_state_t state;
if(esp_player_state_get(&state) != ESP_OK) return false;
return state.status == AUDIO_STATUS_RUNNING;
}