fsVarsAVarGet

The fsVarsAVarGet function can be used to get the value of a specific AVar.

 

Syntax
FsVarError fsVarsAVarGet(
    FsAVarId aVarId,
    FsUnitId unitId,
    FsVarParamArray param,
    double* result,
    FsObjectId target
);

 

Parameters
Parameters Description
aVarId

The ID of an AVar (found using fsVarsGetAVarId).

unitId The ID of a unit (found using fsVarsGetUnitId).
param The parameter which might be mandatory to access the AVar (in the case of an indexed AVar, for example). Elements in param can be FsCrc, String or index.
result The variable that will receive the value of the AVar if other parameters are correct.
target

The ID of the object from which the variable is being retrieved.

Possible targets are:

  1. FS_OBJECT_ID_USER_AIRCRAFT
  2. FS_OBJECT_ID_USER_AVATAR
  3. FS_OBJECT_ID_USER_CURRENT

Default: FS_OBJECT_ID_USER_AIRCRAFT.

 

Return Values

This function returns FsVarError, where 0 means there is no error (in which case, the value of the AVar has been set in result).

 

Example
FsUnitId unitId = fsVarsGetUnitId("DEGREES");
FsAVarId aVarId = fsVarsGetAVarId("ATTITUDE INDICATOR PITCH DEGREES");
FsVarParamArray param = FsCreateParamArray("i", 0);
double result = 0;
if (fsVarsAVarGet(aVarId, unitId, param, &result, FS_OBJECT_ID_USER_AIRCRAFT) == FS_VAR_ERROR_NONE)
{
    // valid
}
else
{
    // error
}