Start on SimConnect
This commit is contained in:
+20
-6
@@ -1,20 +1,34 @@
|
||||
#ifndef GERMANAIRLINESVA_GACONNECTOR_ESP_MAIN_H
|
||||
#define GERMANAIRLINESVA_GACONNECTOR_ESP_MAIN_H
|
||||
|
||||
#include "constants.h"
|
||||
|
||||
#include "windows.h"
|
||||
|
||||
#include "SimConnect.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <ctime>
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <mutex>
|
||||
#include <queue>
|
||||
#include <string>
|
||||
|
||||
#include "websocket.h"
|
||||
|
||||
#include <shlobj.h>
|
||||
#include <stdlib.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "config/config.hpp"
|
||||
#include "constants.h"
|
||||
#include "logbook/logbook.hpp"
|
||||
#include "recording/recording.hpp"
|
||||
#include "simconnect.h"
|
||||
#include "simdata/simDatabase.hpp"
|
||||
|
||||
WINBOOL addNotifyIcon(HWND hWnd);
|
||||
WINBOOL removeNotifyIcon(HWND hWnd);
|
||||
WINBOOL createMenu(HWND hWnd);
|
||||
void end(HWND hwnd);
|
||||
void serverWorker();
|
||||
void recordingWorker();
|
||||
void toLog(const std::string &message);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,125 @@
|
||||
#ifndef GERMANAIRLINESVA_GACONNECTOR_ESP_SIMCONNECT_H
|
||||
#define GERMANAIRLINESVA_GACONNECTOR_ESP_SIMCONNECT_H
|
||||
|
||||
#include <cmath>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
#include "websocket.h"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "SimConnect.h"
|
||||
|
||||
#include "config/config.hpp"
|
||||
#include "constants.h"
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(1)
|
||||
|
||||
struct data {
|
||||
double parkingBrake; // BRAKE PARKING INDICATOR
|
||||
double onGround; // SIM ON GROUND
|
||||
|
||||
double emptyWeight; // EMPTY WEIGHT
|
||||
double currentWeight; // TOTAL WEIGHT
|
||||
|
||||
double fuel; // FUEL TOTAL QUANTITY WEIGHT
|
||||
|
||||
double headingTrue; // PLANE HEADING DEGREES TRUE
|
||||
double headingMagnetic; // PLANE HEADING DEGREES Magnetic
|
||||
|
||||
double groundSpeed; // GROUND VELOCITY
|
||||
double indicatedAirspeed; // AIRSPEED INDICATED
|
||||
double barberPoleSpeed; // AIRSPEED BARBER POLE
|
||||
|
||||
double verticalVelocity; // VELOCITY WORLD Y
|
||||
double verticalSpeed; // VERTICAL SPEED
|
||||
double altitude; // PLANE ALTITUDE
|
||||
double altitudeAGL; // PLANE ALT ABOVE GROUND
|
||||
|
||||
double latitude; // PLANE LATITUDE
|
||||
double longitude; // PLANE LONGITUDE
|
||||
|
||||
double elapsedTime; // ABSOLUTE TIME
|
||||
|
||||
double fuelFlowEng1; // ENG FUEL FLOW PPH:1
|
||||
double fuelFlowEng2; // ENG FUEL FLOW PPH:2
|
||||
double fuelFlowEng3; // ENG FUEL FLOW PPH:3
|
||||
double fuelFlowEng4; // ENG FUEL FLOW PPH:4
|
||||
|
||||
int brakePos;
|
||||
int brakeParkPos;
|
||||
int brakeLeftPos;
|
||||
|
||||
double timeZulu; // ZULU TIME IN SECONDS
|
||||
|
||||
double gForce; // G FORCE IN G
|
||||
};
|
||||
|
||||
struct Port {
|
||||
double headingTrue; // PLANE HEADING DEGREES TRUE
|
||||
double latitude; // PLANE LATITUDE
|
||||
double longitude; // PLANE LONGITUDE
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
enum DEFINITIONS {
|
||||
D_DATA,
|
||||
D_PORT,
|
||||
};
|
||||
|
||||
enum REQUESTS {
|
||||
R_DATA,
|
||||
R_ACFT,
|
||||
R_DIALOG,
|
||||
R_PORT,
|
||||
};
|
||||
|
||||
enum EVENTS {
|
||||
E_PAUSE,
|
||||
E_STATUS,
|
||||
E_TEXT,
|
||||
E_TIMEMIN,
|
||||
E_TIMEHRS,
|
||||
E_TIMESEC,
|
||||
};
|
||||
|
||||
enum GROUPS {
|
||||
G_TIME,
|
||||
};
|
||||
|
||||
class SimConnect
|
||||
{
|
||||
private:
|
||||
HANDLE simConnect;
|
||||
bool connectedToSim;
|
||||
char version;
|
||||
std::string aircraftPath;
|
||||
bool pausedMenu;
|
||||
bool paused;
|
||||
std::mutex mutex;
|
||||
struct germanairlinesva::websocket::data simData;
|
||||
std::shared_ptr<germanairlinesva::file::config::Config> configuration;
|
||||
std::function<void(const std::string)> toLog;
|
||||
|
||||
void handleOpen(SIMCONNECT_RECV_OPEN *data);
|
||||
void handleSystemEvent(SIMCONNECT_RECV_SYSTEM_STATE *state);
|
||||
void handleEvent(SIMCONNECT_RECV_EVENT *event);
|
||||
void handleData(SIMCONNECT_RECV_SIMOBJECT_DATA *data);
|
||||
|
||||
public:
|
||||
SimConnect(
|
||||
HWND hWnd,
|
||||
std::function<void(const std::string)> toLog,
|
||||
std::shared_ptr<germanairlinesva::file::config::Config> &configuration);
|
||||
~SimConnect();
|
||||
bool isConnected() const;
|
||||
const std::string getVersion() const;
|
||||
void getData(struct germanairlinesva::websocket::data *data);
|
||||
void getStates() const;
|
||||
void handleMessage();
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user