Play a configured file when rfid-tag is placed on the reader.

This commit is contained in:
Simon Weidacher
2021-12-26 14:00:30 +01:00
parent dffa2e6205
commit 5007de4456
8 changed files with 84 additions and 9 deletions

View File

@@ -4,6 +4,9 @@
#include "WebInterface.hpp"
#include "RFIDInterface.hpp"
#include "AudioPlayer.hpp"
#include "TagPlayerControl.hpp"
#include <iostream>
extern "C" {
void app_main();
@@ -16,14 +19,21 @@ RFIDInterface rfid;
void app_main(void) {
initArduino();
networking.connectWifi();
webInterface.initSD();
/* networking.connectWifi();
webInterface.start();
rfid.registerWebResources(&webInterface);
webInterface.finishResourceRegistrations();
*/
AudioPlayer audioPlayer; // initialize here, because the ctor does init stuff that fails when executed before `app_main()`
audioPlayer.play("file://sdcard/howcanwehangontoadream.mp3");
rfid.start();
TagPlayerControl tagPlayerControl(&audioPlayer);
rfid.registerTagChangeCallback([&tagPlayerControl](char* tagId) {
tagPlayerControl.onTagChanged(tagId);
});
}