Initial start on Recorder
This commit is contained in:
@@ -1,6 +1,19 @@
|
||||
#ifndef GERMANAIRLINESVA_GACONNECTOR_RECORDER_RECORDER_H
|
||||
#define GERMANAIRLINESVA_GACONNECTOR_RECORDER_RECORDER_H
|
||||
|
||||
#include <atomic>
|
||||
#include <functional>
|
||||
#include <mutex>
|
||||
#include <queue>
|
||||
#include <thread>
|
||||
|
||||
#include "websocket.h"
|
||||
|
||||
#include "config/config.hpp"
|
||||
#include "logbook/logbook.hpp"
|
||||
#include "recording/recording.hpp"
|
||||
#include "simdata/simDatabase.hpp"
|
||||
|
||||
namespace germanairlinesva
|
||||
{
|
||||
namespace gaconnector
|
||||
@@ -9,6 +22,38 @@ namespace gaconnector
|
||||
{
|
||||
class Recorder
|
||||
{
|
||||
private:
|
||||
std::function<void(const std::string)> toLog;
|
||||
|
||||
std::mutex mutex;
|
||||
std::thread serverThread;
|
||||
std::thread recordingThread;
|
||||
std::atomic<bool> wantsExit{false};
|
||||
|
||||
std::shared_ptr<file::config::Config> configuration;
|
||||
std::unique_ptr<file::simdata::SimDatabase> database;
|
||||
std::unique_ptr<websocket::Websocket> connector;
|
||||
|
||||
websocket::data toSend;
|
||||
|
||||
std::queue<std::function<void()>> &messageQueue()
|
||||
{
|
||||
static std::queue<std::function<void()>> _messageQueue;
|
||||
return _messageQueue;
|
||||
}
|
||||
|
||||
void serverWorker();
|
||||
void recordingWorker();
|
||||
|
||||
// For Testing
|
||||
void test() const;
|
||||
|
||||
public:
|
||||
Recorder(int simVersion, std::function<void(const std::string)> toLog);
|
||||
~Recorder();
|
||||
|
||||
void setData(websocket::data &data);
|
||||
void handleMessages();
|
||||
};
|
||||
} // namespace recorder
|
||||
} // namespace gaconnector
|
||||
|
||||
Reference in New Issue
Block a user