-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDCCpp.h
65 lines (58 loc) · 2.04 KB
/
DCCpp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//
// Created by Mathieu Andrade on 23/05/2021.
//
#ifndef DDGI_DCCPP_H
#define DDGI_DCCPP_H
#include <ws2tcpip.h>
#include <websockets/wsclient.h>
#include <cassert>
#include <sstream>
#include <string>
#include <vector>
#include "DDGI_Generic_def.h"
class DCCpp
{
private:
static HANDLE virtualThread;
static DWORD virtualThreadId;
public:
static HWND wnd;
static HINSTANCE instance;
static WebSocket::pointer ws;
static char comNumber[];
static char ipAddress[];
static char accessoryCmdType[];
static HANDLE comPort;
static std::string version;
static bool usbMode;
static bool powerOn;
static bool emulation;
static unsigned int commandStationStatus;
static std::string detectorStates;
static int detectorsModuleCount;
static FEEDBACK_MSG_VECTOR listOfFeedbackMsg;
static FEEDBACK_MSG_VECTOR listOfUnexpectedFbMsg;
static LOCO_INFOS_VECTOR listOfLocoInfos;
static int cmdTimer;
static bool start(DGI_SERVER_PARAMS params);
static void stop();
[[noreturn]] static DWORD WINAPI loop(void *);
static bool connect();
static bool connectToWebSocketServer();
static bool disconnect();
static void closeAnyConnection();
static void initS88();
// static bool sendLocoInfo(pDGI_GENERIC_DATA genericData);
static bool setLocoSpeed(pDGI_GENERIC_DATA genericData);
static bool setLocoFunction(pDGI_GENERIC_DATA genericData, unsigned int funcMask);
static void emergencyStopAllLocos();
static void restartAllLocos();
static void handleStandaloneCommands(STANDALONE_CMD_TYPE cmdType, int feedbackMsgIndex);
static void handleCommandStationFb(CMD_STATION_FB_TYPE cmdType, int feedbackMsgIndex);
static void handleCommandStationStatus(int state);
static void handleCommandStationVersion(std::string &command);
static void handleDetectorUpdate(std::string &command);
static void handleAccessoryEvent(std::string &command);
static void handleLocoEvent(std::string &command, CMD_STATION_FB_TYPE fbCmdType);
};
#endif // DDGI_DCCPP_H