CAPL Script

GetValue

Syntax

int getValue(EnvVarName); // form 1

float getValue(EnvVarName); // form 2

long getValue(EnvVarName, char buffer[]); // form 3

long getValue(EnvVarName, byte buffer[]); // form 4

long getValue(EnvVarName, byte buffer[], long offset); // form 5

float getValue(char name[]); // form 6

long getValue(char name[], char buffer[]); // form 7

long getValue(char name[], byte buffer[]); // form 8

long getValue(char name[], byte buffer[], long offset); // form 9

Function

Determines the value of the environment variable with identifier EnvVarName/name. The type of the return value is based on the type of environment variable (int for discrete (form 1), float for continuous environment variables (form 2 and 6)). For character string environment variables (form 3 and 7) and environment variables with data bytes (form 4, 5, 8 and 9) the active value is saved to a buffer which you identify in the function call.

Parameters

EnvVarName Environment variable name.Must exist in the database.

buffer

Return buffer (form 3, 4 and 5)

offset

Offset of the first data byte copied (form 5)

Return Values

Form 1 and 2 Active value of the environment variable.

Form 3, 4 and 5

Number of bytes copied.

int val;float fval;char cBuf[25];byte bBuf[64];long copiedBytes;...// Assign to val the value of the environment variable Switchval = getValue(Switch);// Assign to fval the value of the environment variable Temperatureval = getValue(Temperature);// Read the value of environment variable NodeNamecopiedBytes = getValue(NodeName, cBuf);// Read the value of environment variable DiagDatacopiedBytes = getValue(DiagData, bBuf);// Read the value of environment variable DiagData starting at position 32copiedBytes = getValue(DiagData, bBuf, 32);...

getValueSize | putValue | Direct access to values from system variables