Start on SimConnect

This commit is contained in:
2022-10-03 02:05:06 +02:00
parent 997586b8aa
commit 23db85c2a5
22 changed files with 1209 additions and 116 deletions
+16 -16
View File
@@ -1,21 +1,5 @@
#ifndef GERMANAIRLINESVA_GACONNECTOR_XPLUGIN_MAIN_H
#define GERMANAIRLINESVA_GACONNECTOR_XPLUGIN_MAIN_H
#include "config/config.hpp"
#include "constants.h"
#include "logbook/logbook.hpp"
#include "recording/recording.hpp"
#include "simdata/simDatabase.hpp"
#include "util.hpp"
#include "websocket.h"
#include "XPLM/XPLMDataAccess.h"
#include "XPLM/XPLMGraphics.h"
#include "XPLM/XPLMPlanes.h"
#include "XPLM/XPLMPlugin.h"
#include "XPLM/XPLMProcessing.h"
#include "XPLM/XPLMUtilities.h"
#include <atomic>
#include <chrono>
#include <cstdint>
@@ -27,6 +11,22 @@
#include <string>
#include <thread>
#include "websocket.h"
#include "config/config.hpp"
#include "constants.h"
#include "logbook/logbook.hpp"
#include "recording/recording.hpp"
#include "simdata/simDatabase.hpp"
#include "util.hpp"
#include "XPLM/XPLMDataAccess.h"
#include "XPLM/XPLMGraphics.h"
#include "XPLM/XPLMPlanes.h"
#include "XPLM/XPLMPlugin.h"
#include "XPLM/XPLMProcessing.h"
#include "XPLM/XPLMUtilities.h"
float flightLoop(float elapsedMe, float elapsedSim, int counter, void *refcon);
void serverWorker();
void recordingWorker();
+2 -7
View File
@@ -10,7 +10,7 @@ std::thread serverThread;
std::thread recordingThread;
std::atomic<bool> wantsExit;
std::unique_ptr<germanairlinesva::file::config::Config> configuration;
std::shared_ptr<germanairlinesva::file::config::Config> configuration;
std::unique_ptr<germanairlinesva::file::simdata::SimDatabase> database;
std::unique_ptr<germanairlinesva::websocket::Websocket> connector;
int xplaneVersion;
@@ -142,7 +142,6 @@ PLUGIN_API int XPluginStart(char *outName, char *outSig, char *outDesc)
auto ap2 = (*database)["XXXX"];
ap2.first.size() == 0 ? toLog(" SUCCESS") : toLog(" ERROR");
// Thread for sending data to websocket
serverThread = std::thread(&serverWorker);
recordingThread = std::thread(&recordingWorker);
@@ -194,10 +193,6 @@ PLUGIN_API void XPluginStop(void)
serverThread.join();
recordingThread.join();
delete connector.release();
delete database.release();
delete configuration.release();
p.toFile("flight.rec");
toLog("Plugin stopped");
@@ -288,7 +283,7 @@ void recordingWorker()
auto rwys = ap.second;
while (!wantsExit) {
germanairlinesva::websocket::data copy;
struct germanairlinesva::websocket::data copy;
{
const std::lock_guard<std::mutex> lock(mutex);