21#include "client/enums.h"
72 std::vector<uint8_t>
data {};
78 std::enable_if_t<std::is_trivially_copyable_v<T>,
bool> =
true,
79 std::enable_if_t<std::is_default_constructible_v<T>,
bool> =
true>
80 inline operator T()
const {
90 template<
typename T, std::enable_if_t<std::is_trivially_copyable_v<T>,
bool> = true>
93 if ((ret =
data.size() ==
sizeof(T)))
94 memcpy(&result,
data.data(),
sizeof(T));
100 using DataRequest::operator=;
136 explicit VariableRequest(
const std::string &localVarName,
bool createVariable =
false,
const std::string &
unitName = std::string()) :
160 RegisteredEvent(uint32_t eventId = -1,
const std::string &code =
"",
const std::string &name =
"");
WASimCommander::Client namespace. Defines/declares everything needed to interact with the WASimComman...
HRESULT result
Execution result, one of: S_OK, E_FAIL, E_TIMEOUT
WASimCommander::Enums::LookupItemType listType
the type of items being listed
ClientEventType eventType
The type of event. See enum docs for details.
std::string message
A short message about the event (eg. "Server Connected")
listResult_t list
Mapping of numeric item IDs to name strings.
ClientStatus status
Current status flag(s). See enum docs for details.
ClientEventType
Client event type enumeration.
std::vector< std::pair< int, std::string > > listResult_t
A mapping of IDs to names.
ClientStatus
Client status flags.
Client Event data, delivered via callback.
Structure for delivering list results, eg. of local variables sent from Server.
LookupItemType
Types of things to look up or list.
@ DataRequest
Saved value subscription for current Client, indexed by requestId and nameOrCode values....
DataRequestRecord inherits and extends WASimCommander::DataRequest with data pertinent for use by a d...
DataRequestRecord()
< Inherits DataRequest assignment operators.
bool tryConvert(T &result) const
Tries to populate a pre-initialized value reference of the desired type and returns true or false dep...
time_t lastUpdate
Timestamp of last data update in ms since epoch.
DataRequest(uint32_t requestId, uint32_t valueSize=sizeof(double), WASimCommander::Enums::RequestType requestType=WASimCommander::Enums::RequestType::Calculated, WASimCommander::Enums::CalcResultType calcResultType=WASimCommander::Enums::CalcResultType::Double, WASimCommander::Enums::UpdatePeriod period=WASimCommander::Enums::UpdatePeriod::Tick, const char *nameOrCode=nullptr, const char *unitName=nullptr, char varTypePrefix='L', float deltaEpsilon=0.0f, uint8_t interval=0, uint8_t simVarIndex=0)
Constructor with required request ID, all other parameters optional. See member documentation for exp...
std::vector< uint8_t > data
Value data array.
Structure to hold data for registered (reusable) calculator events. Used to submit events with WASimC...
std::string name
Optional custom name for this event. The name is for use with SimConnect_MapClientEventToSimEvent(id,...
std::string code
The calculator code string to execute as the event action. The code is pre-compiled and stored on the...
RegisteredEvent(uint32_t eventId=-1, const std::string &code="", const std::string &name="")
Default implicit constructor.
uint32_t eventId
A unique ID for this event. The ID can later be used to modify, trigger, or remove this event.
int unitId
Numeric ID of the Unit type to use in the get/set command. Overrides the unitName field if greater th...
int variableId
Numeric ID of the variable to get/set. Overrides the variableName field if greater than -1....
bool createLVar
This flag indicates that the L var should be created if it doesn't already exist in the simulator....
VariableRequest(const std::string &localVarName, bool createVariable=false, const std::string &unitName=std::string())
Construct a variable request for a Local variable ('L') with the given name. createVariable will crea...
char variableType
A single character variable type identifier as documented in the MSFS SDK documentation (plus 'T' for...
VariableRequest(char variableType, int variableId, int unitId=-1, uint8_t simVarIndex=0)
Construct a variable request using numeric variable and (optionally) unit IDs, and optional SimVar in...
VariableRequest(char variableType='L', const std::string &variableName=std::string(), const std::string &unitName=std::string(), uint8_t simVarIndex=0, bool createVariable=false)
Default constructor, with optional parameters for variable type, name, unit name, SimVar index and cr...
VariableRequest(int simVarId, int unitId, uint8_t simVarIndex=0)
Construct a variable request for a Simulator Variable ('A') using numeric variable and unit IDs,...
VariableRequest(const std::string &simVarName, const std::string &unitName, uint8_t simVarIndex=0)
Construct a variable request for a Simulator Variable (SimVar) with given name, unit,...
std::string variableName
Name of the variable. Ignored if variableId is greater than -1.
VariableRequest(int localVarId)
Construct a variable request for a Local variable ('L') with the given numeric ID.
uint8_t simVarIndex
Optional index number for SimVars ('A') which require them. If using named variables,...
std::string unitName
Unit name. For local ('L') and Sim ('A') variables the unit type will be resolved to an enum ID and,...
DataRequest(uint32_t requestId, uint32_t valueSize=sizeof(double), WASimCommander::Enums::RequestType requestType=WASimCommander::Enums::RequestType::Calculated, WASimCommander::Enums::CalcResultType calcResultType=WASimCommander::Enums::CalcResultType::Double, WASimCommander::Enums::UpdatePeriod period=WASimCommander::Enums::UpdatePeriod::Tick, const char *nameOrCode=nullptr, const char *unitName=nullptr, char varTypePrefix='L', float deltaEpsilon=0.0f, uint8_t interval=0, uint8_t simVarIndex=0)
Constructor with required request ID, all other parameters optional. See member documentation for exp...