v1.3.0.0
WASimCommander::Client::VariableRequest Struct Reference

Structure for using with WASimClient::getVariable() and WASimClient::setVariable() to specify information about the variable to set or get. Variables and Units can be specified by name or by numeric ID. Only some variable types have an associated numeric ID ('A', 'L', 'T' types) and only some variable types accept a Unit specifier ('A', 'C', 'E', 'L' types). Using numeric IDs, if already known, is more efficient on the server side since it saves the lookup step. More...

#include "structs.h"

Public Member Functions

 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 createLVar flag. More...
 
 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 index. More...
 
 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, and optional index parameter. More...
 
 VariableRequest (int simVarId, int unitId, uint8_t simVarIndex=0)
 Construct a variable request for a Simulator Variable ('A') using numeric variable and unit IDs, with optional index parameter. More...
 
 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 create the L var on the simulator if it doesn't exist yet (for "Get" as well as "Set" commands). An optional unit name can also be provided. More...
 
 VariableRequest (int localVarId)
 Construct a variable request for a Local variable ('L') with the given numeric ID. More...
 

Public Attributes

char variableType = 'L'
 A single character variable type identifier as documented in the MSFS SDK documentation (plus 'T' for Token vars). More...
 
std::string variableName {}
 Name of the variable. Ignored if variableId is greater than -1. More...
 
std::string unitName {}
 Unit name. For local ('L') and Sim ('A') variables the unit type will be resolved to an enum ID and, if successful, will be used in the relevant command ((get | set)_named_variable_typed_value()/aircraft_varget()). Otherwise, for 'L' vars the default units are used (Gauge API (get | set)_named_variable_value()) and for getting SimVars the behavior is undefined (-1 is passed to aircraft_varget() as the unit ID). For the other variable types which use units ('C', 'E', or when setting 'A'), this string will simply be included in the produced calculator code (eg. (E:SIMULATION TIME,seconds) or 50 (>A:COCKPIT CAMERA ZOOM,percent)). The unit name is ignored for all other variable types, and the unitId field is preferred if it is greater than -1. More...
 
int variableId = -1
 Numeric ID of the variable to get/set. Overrides the variableName field if greater than -1. Only 'A', 'L', 'T' variable types can be referenced by numeric IDs. More...
 
int unitId = -1
 Numeric ID of the Unit type to use in the get/set command. Overrides the unitName field if greater than -1. See usage notes for unitName about applicable variable types. More...
 
uint8_t simVarIndex = 0
 Optional index number for SimVars ('A') which require them. If using named variables, the index can also be included in the variable name string (after a colon :, as would be used in a calculator string). More...
 
bool createLVar = false
 This flag indicates that the L var should be created if it doesn't already exist in the simulator. This applies for both "Set" and "Get" commands. More...
 

Detailed Description

Structure for using with WASimClient::getVariable() and WASimClient::setVariable() to specify information about the variable to set or get. Variables and Units can be specified by name or by numeric ID. Only some variable types have an associated numeric ID ('A', 'L', 'T' types) and only some variable types accept a Unit specifier ('A', 'C', 'E', 'L' types). Using numeric IDs, if already known, is more efficient on the server side since it saves the lookup step.

Definition at line 109 of file structs.h.

Constructor & Destructor Documentation

◆ VariableRequest() [1/6]

WASimCommander::Client::VariableRequest::VariableRequest ( char  variableType = 'L',
const std::string &  variableName = std::string(),
const std::string &  unitName = std::string(),
uint8_t  simVarIndex = 0,
bool  createVariable = false 
)
inlineexplicit

Default constructor, with optional parameters for variable type, name, unit name, SimVar index and createLVar flag.

Definition at line 123 of file structs.h.

◆ VariableRequest() [2/6]

WASimCommander::Client::VariableRequest::VariableRequest ( char  variableType,
int  variableId,
int  unitId = -1,
uint8_t  simVarIndex = 0 
)
inlineexplicit

Construct a variable request using numeric variable and (optionally) unit IDs, and optional SimVar index.

Definition at line 126 of file structs.h.

◆ VariableRequest() [3/6]

WASimCommander::Client::VariableRequest::VariableRequest ( const std::string &  simVarName,
const std::string &  unitName,
uint8_t  simVarIndex = 0 
)
inlineexplicit

Construct a variable request for a Simulator Variable (SimVar) with given name, unit, and optional index parameter.

Definition at line 129 of file structs.h.

◆ VariableRequest() [4/6]

WASimCommander::Client::VariableRequest::VariableRequest ( int  simVarId,
int  unitId,
uint8_t  simVarIndex = 0 
)
inlineexplicit

Construct a variable request for a Simulator Variable ('A') using numeric variable and unit IDs, with optional index parameter.

Definition at line 132 of file structs.h.

◆ VariableRequest() [5/6]

WASimCommander::Client::VariableRequest::VariableRequest ( const std::string &  localVarName,
bool  createVariable = false,
const std::string &  unitName = std::string() 
)
inlineexplicit

Construct a variable request for a Local variable ('L') with the given name. createVariable will create the L var on the simulator if it doesn't exist yet (for "Get" as well as "Set" commands). An optional unit name can also be provided.

Definition at line 136 of file structs.h.

◆ VariableRequest() [6/6]

WASimCommander::Client::VariableRequest::VariableRequest ( int  localVarId)
inlineexplicit

Construct a variable request for a Local variable ('L') with the given numeric ID.

Definition at line 139 of file structs.h.

Member Data Documentation

◆ variableType

char WASimCommander::Client::VariableRequest::variableType = 'L'

A single character variable type identifier as documented in the MSFS SDK documentation (plus 'T' for Token vars).

Definition at line 111 of file structs.h.

◆ variableName

std::string WASimCommander::Client::VariableRequest::variableName {}

Name of the variable. Ignored if variableId is greater than -1.

Definition at line 112 of file structs.h.

◆ unitName

std::string WASimCommander::Client::VariableRequest::unitName {}

Unit name. For local ('L') and Sim ('A') variables the unit type will be resolved to an enum ID and, if successful, will be used in the relevant command ((get | set)_named_variable_typed_value()/aircraft_varget()). Otherwise, for 'L' vars the default units are used (Gauge API (get | set)_named_variable_value()) and for getting SimVars the behavior is undefined (-1 is passed to aircraft_varget() as the unit ID). For the other variable types which use units ('C', 'E', or when setting 'A'), this string will simply be included in the produced calculator code (eg. (E:SIMULATION TIME,seconds) or 50 (>A:COCKPIT CAMERA ZOOM,percent)). The unit name is ignored for all other variable types, and the unitId field is preferred if it is greater than -1.

Definition at line 113 of file structs.h.

◆ variableId

int WASimCommander::Client::VariableRequest::variableId = -1

Numeric ID of the variable to get/set. Overrides the variableName field if greater than -1. Only 'A', 'L', 'T' variable types can be referenced by numeric IDs.

Definition at line 117 of file structs.h.

◆ unitId

int WASimCommander::Client::VariableRequest::unitId = -1

Numeric ID of the Unit type to use in the get/set command. Overrides the unitName field if greater than -1. See usage notes for unitName about applicable variable types.

Definition at line 118 of file structs.h.

◆ simVarIndex

uint8_t WASimCommander::Client::VariableRequest::simVarIndex = 0

Optional index number for SimVars ('A') which require them. If using named variables, the index can also be included in the variable name string (after a colon :, as would be used in a calculator string).

Definition at line 119 of file structs.h.

◆ createLVar

bool WASimCommander::Client::VariableRequest::createLVar = false

This flag indicates that the L var should be created if it doesn't already exist in the simulator. This applies for both "Set" and "Get" commands.

Definition at line 120 of file structs.h.


The documentation for this struct was generated from the following file: