Massive changes. Added a quite nice webinterface with live data using WebSockets. Removed the FTP server (wasn't that useful anyways). JSON creating using ArduinoJson instead of String concatenation. Ans, and, and.
This commit is contained in:
@ -1,11 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <ESPAsyncWebServer.h>
|
||||
#include "config.h"
|
||||
|
||||
class Controller;
|
||||
|
||||
#include "player.h"
|
||||
#include "playlist.h"
|
||||
#include "playlist_manager.h"
|
||||
#include "mqtt_client.h"
|
||||
#include "http_server.h"
|
||||
#include <MFRC522.h>
|
||||
|
||||
enum ControllerState { NORMAL, LOCKING, LOCKED };
|
||||
@ -14,6 +19,7 @@ class Controller {
|
||||
private:
|
||||
MFRC522* _rfid;
|
||||
MQTTClient* _mqtt_client;
|
||||
HTTPServer* _http_server;
|
||||
PlaylistManager* _pm;
|
||||
ControllerState _state = NORMAL;
|
||||
bool _rfid_enabled = true;
|
||||
@ -24,12 +30,13 @@ private:
|
||||
uint32_t _get_rfid_card_uid();
|
||||
String _read_rfid_data();
|
||||
bool _rfid_present = false;
|
||||
uint32_t _last_rfid_card_uid = 0;
|
||||
uint8_t _no_rfid_card_count = 0;
|
||||
String _last_rfid_uid = "";
|
||||
String _last_rfid_data = "";
|
||||
Player* _player;
|
||||
unsigned long _last_rfid_scan_at = 0;
|
||||
unsigned long _last_position_info_at = 0;
|
||||
String _serial_buffer = String();
|
||||
void _execute_serial_command(String cmd);
|
||||
String _cmd_queue = "";
|
||||
void _execute_command_ls(String path);
|
||||
void _execute_command_ids();
|
||||
void _execute_command_help();
|
||||
@ -40,6 +47,13 @@ private:
|
||||
public:
|
||||
Controller(Player* p, PlaylistManager* pm);
|
||||
void set_mqtt_client(MQTTClient* m);
|
||||
String get_status_json();
|
||||
void register_http_server(HTTPServer* h);
|
||||
void loop();
|
||||
void send_player_status();
|
||||
void send_playlist_manager_status();
|
||||
void send_position();
|
||||
void inform_new_client(AsyncWebSocketClient* client);
|
||||
String json();
|
||||
bool process_message(String m);
|
||||
void queue_command(String cmd);
|
||||
};
|
||||
|
Reference in New Issue
Block a user