v1.3.0.0
WASimCommander::DataRequest Struct Reference

Structure for variable value subscription requests. More...

#include "WASimCommander.h"

Public Member Functions

 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 explanation of the homonymous parameters. More...
 
 DataRequest (uint32_t requestId, char variableType, const char *variableName, uint32_t valueSize, WASimCommander::Enums::UpdatePeriod period=WASimCommander::Enums::UpdatePeriod::Tick, uint32_t interval=0, float deltaEpsilon=0.0f)
 Constructs a request for a named variable (requestType = RequestType::Named) with optional update period, interval, and epsilon values. More...
 
 DataRequest (uint32_t requestId, const char *simVarName, const char *unitName, uint8_t simVarIndex, uint32_t valueSize, WASimCommander::Enums::UpdatePeriod period=WASimCommander::Enums::UpdatePeriod::Tick, uint32_t interval=0, float deltaEpsilon=0.0f)
 Constructs a request for a named Simulator Variable (requestType = RequestType::Named and ‘varTypePrefix = 'A’`) with optional update period, interval, and epsilon values. More...
 
 DataRequest (uint32_t requestId, WASimCommander::Enums::CalcResultType resultType, const char *calculatorCode, uint32_t valueSize, WASimCommander::Enums::UpdatePeriod period=WASimCommander::Enums::UpdatePeriod::Tick, uint32_t interval=0, float deltaEpsilon=0.0f)
 Constructs a calculator code request (requestType = RequestType::Calculated) with optional update period, interval, and epsilon values. More...
 
 DataRequest (uint32_t requestId, WASimCommander::Enums::CalcResultType resultType, const char *calculatorCode, WASimCommander::Enums::UpdatePeriod period=WASimCommander::Enums::UpdatePeriod::Tick, uint32_t interval=0, float deltaEpsilon=0.0f)
 Constructs a calculator code request (requestType = RequestType::Calculated) with optional update period, interval, and epsilon values.
This overload, w/out a valueSize argument automatically determines the size based on the resultType argument: More...
 
void setNameOrCode (const char *name)
 Set the nameOrCode member using a const char array. More...
 
void setUnitName (const char *name)
 Set the unitName member using a const char array. More...
 

Public Attributes

uint32_t requestId
 Unique ID for the request, subsequent use of this ID overwrites any previous request definition (but size may not grow). More...
 
uint32_t valueSize
 Byte size of stored value; can also be one of the predefined DATA_TYPE_* constants. More...
 
float deltaEpsilon
 Minimum change in numeric value required to trigger an update. The default of 0.0 is to send updates only if the value changes, but even on the smallest changes. Setting this to some positive value can be especially useful for high-precision floating-point numbers which may fluctuate within an insignificant range, but may be used with any numeric value (for integer value types, only the integer part of the epsilon value is considered). Conversely, to send data updates every time the value is read, and skip any comparison check altogether, set this to a negative value like -1.0. More...
 
uint32_t interval
 How many UpdatePeriod period's should elapse between checks. eg. 500ms or 10 ticks. Zero means to check at every period, 1 means every other period, etc. More...
 
WASimCommander::Enums::UpdatePeriod period
 How often to read/calculate this value. More...
 
WASimCommander::Enums::RequestType requestType
 Named variable or calculated value. More...
 
WASimCommander::Enums::CalcResultType calcResultType
 Expected calculator result type. More...
 
uint8_t simVarIndex
 Some SimVars require an index for access, default is 0. More...
 
char varTypePrefix
 Variable type prefix for named variables. Types: 'L' (local), 'A' (SimVar) and 'T' (Token, not an actual GaugeAPI prefix) are checked using respective GaugeAPI methods. More...
 
char nameOrCode [STRSZ_REQ] = {0}
 Variable name or full calculator string. More...
 
char unitName [STRSZ_UNIT] = {0}
 Unit name for named variables (optional to override variable's default units). Only 'L' and 'A' variable types support unit specifiers. More...
 

Detailed Description

Structure for variable value subscription requests.

See also
WASimCommander:CommandId::Subscribe command.

Definition at line 127 of file WASimCommander.h.

Constructor & Destructor Documentation

◆ DataRequest() [1/5]

WASimCommander::DataRequest::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 
)
inlineexplicit

Constructor with required request ID, all other parameters optional. See member documentation for explanation of the homonymous parameters.

Definition at line 148 of file WASimCommander.h.

◆ DataRequest() [2/5]

WASimCommander::DataRequest::DataRequest ( uint32_t  requestId,
char  variableType,
const char *  variableName,
uint32_t  valueSize,
WASimCommander::Enums::UpdatePeriod  period = WASimCommander::Enums::UpdatePeriod::Tick,
uint32_t  interval = 0,
float  deltaEpsilon = 0.0f 
)
inlineexplicit

Constructs a request for a named variable (requestType = RequestType::Named) with optional update period, interval, and epsilon values.

Definition at line 173 of file WASimCommander.h.

◆ DataRequest() [3/5]

WASimCommander::DataRequest::DataRequest ( uint32_t  requestId,
const char *  simVarName,
const char *  unitName,
uint8_t  simVarIndex,
uint32_t  valueSize,
WASimCommander::Enums::UpdatePeriod  period = WASimCommander::Enums::UpdatePeriod::Tick,
uint32_t  interval = 0,
float  deltaEpsilon = 0.0f 
)
inlineexplicit

Constructs a request for a named Simulator Variable (requestType = RequestType::Named and ‘varTypePrefix = 'A’`) with optional update period, interval, and epsilon values.

Definition at line 178 of file WASimCommander.h.

◆ DataRequest() [4/5]

WASimCommander::DataRequest::DataRequest ( uint32_t  requestId,
WASimCommander::Enums::CalcResultType  resultType,
const char *  calculatorCode,
uint32_t  valueSize,
WASimCommander::Enums::UpdatePeriod  period = WASimCommander::Enums::UpdatePeriod::Tick,
uint32_t  interval = 0,
float  deltaEpsilon = 0.0f 
)
inlineexplicit

Constructs a calculator code request (requestType = RequestType::Calculated) with optional update period, interval, and epsilon values.

Definition at line 183 of file WASimCommander.h.

◆ DataRequest() [5/5]

WASimCommander::DataRequest::DataRequest ( uint32_t  requestId,
WASimCommander::Enums::CalcResultType  resultType,
const char *  calculatorCode,
WASimCommander::Enums::UpdatePeriod  period = WASimCommander::Enums::UpdatePeriod::Tick,
uint32_t  interval = 0,
float  deltaEpsilon = 0.0f 
)
inlineexplicit

Constructs a calculator code request (requestType = RequestType::Calculated) with optional update period, interval, and epsilon values.
This overload, w/out a valueSize argument automatically determines the size based on the resultType argument:

Definition at line 192 of file WASimCommander.h.

Member Function Documentation

◆ setNameOrCode()

void WASimCommander::DataRequest::setNameOrCode ( const char *  name)
inline

Set the nameOrCode member using a const char array.

Definition at line 197 of file WASimCommander.h.

◆ setUnitName()

void WASimCommander::DataRequest::setUnitName ( const char *  name)
inline

Set the unitName member using a const char array.

Definition at line 198 of file WASimCommander.h.

Member Data Documentation

◆ requestId

uint32_t WASimCommander::DataRequest::requestId

Unique ID for the request, subsequent use of this ID overwrites any previous request definition (but size may not grow).

Definition at line 129 of file WASimCommander.h.

◆ valueSize

uint32_t WASimCommander::DataRequest::valueSize

Byte size of stored value; can also be one of the predefined DATA_TYPE_* constants.

See also
WASimCommander::DATA_TYPE_INT8, etc

Definition at line 130 of file WASimCommander.h.

◆ deltaEpsilon

float WASimCommander::DataRequest::deltaEpsilon

Minimum change in numeric value required to trigger an update. The default of 0.0 is to send updates only if the value changes, but even on the smallest changes. Setting this to some positive value can be especially useful for high-precision floating-point numbers which may fluctuate within an insignificant range, but may be used with any numeric value (for integer value types, only the integer part of the epsilon value is considered). Conversely, to send data updates every time the value is read, and skip any comparison check altogether, set this to a negative value like -1.0.

Note
For the positive epsilon settings to work, the valueSize must be set to one of the predefined DATA_TYPE_* constants.

Definition at line 131 of file WASimCommander.h.

◆ interval

uint32_t WASimCommander::DataRequest::interval

How many UpdatePeriod period's should elapse between checks. eg. 500ms or 10 ticks. Zero means to check at every period, 1 means every other period, etc.

Definition at line 136 of file WASimCommander.h.

◆ period

WASimCommander::Enums::UpdatePeriod WASimCommander::DataRequest::period

How often to read/calculate this value.

Definition at line 138 of file WASimCommander.h.

◆ requestType

WASimCommander::Enums::RequestType WASimCommander::DataRequest::requestType

Named variable or calculated value.

Definition at line 139 of file WASimCommander.h.

◆ calcResultType

WASimCommander::Enums::CalcResultType WASimCommander::DataRequest::calcResultType

Expected calculator result type.

Definition at line 140 of file WASimCommander.h.

◆ simVarIndex

uint8_t WASimCommander::DataRequest::simVarIndex

Some SimVars require an index for access, default is 0.

Definition at line 141 of file WASimCommander.h.

◆ varTypePrefix

char WASimCommander::DataRequest::varTypePrefix

Variable type prefix for named variables. Types: 'L' (local), 'A' (SimVar) and 'T' (Token, not an actual GaugeAPI prefix) are checked using respective GaugeAPI methods.

Definition at line 142 of file WASimCommander.h.

◆ nameOrCode

char WASimCommander::DataRequest::nameOrCode[STRSZ_REQ] = {0}

Variable name or full calculator string.

Definition at line 143 of file WASimCommander.h.

◆ unitName

char WASimCommander::DataRequest::unitName[STRSZ_UNIT] = {0}

Unit name for named variables (optional to override variable's default units). Only 'L' and 'A' variable types support unit specifiers.

Definition at line 144 of file WASimCommander.h.


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