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
ParametersDescription
aVarId

The ID of an AVar (found using fsVarsGetAVarId).

unitIdThe ID of a unit (found using fsVarsGetUnitId).
paramThe 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.
resultThe 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.

 

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
}