PutValue
This reference collection includes Vector documentation reproduced with permission. Snippets may require configuration-specific symbols and are not all standalone programs. Sources and validation limits.
Syntax
void putValue(EnvVarName, int val); // form 1
void putValue(EnvVarName, float val); // form 2
void putValue(EnvVarName, char val[]); // form 3
void putValue(EnvVarName, byte val[]); // form 4
void putValue(EnvVarName, byte val[], long vSize); // form 5
void putValue(char name[], int val); // form 6
void putValue(char name[], float val); // form 7
void putValue(char name[], char val[]); // form 8
void putValue(char name[], byte val[]); // form 9
void putValue(char name[], byte val[], long vSize); // form 10
Function
Assigns the valuevalto the environment variable with identifierEnvVarName/name. Integers are assigned to discrete environment variables (form 1 and 6), floating point numbers are assigned to continuous environment variables (form 2 and 7). The contents of a character string is assigned to character string environment variables (form 3 and 8). For data byte environment variables (form 4, 5, 9 and 10) the bytes of the data buffer are copied into the environment variable.
Parameters
EnvVarName Environment variable name (form 1-5).Must exist in the database.
name
Environment variable name (form 6-10)
val
New value of environment variable (form 1, 2, 6, 7) or buffer with new data (form 3, 4, 5, 8, 9, 10) and for form 5 and 10 the number of bytes to be copied.
Return Values
—
byte dataBuf[64] = {
0
};
// Example variables must exist; adapt these values to your test setup.
putValue(Switch, 0);
putValue(Temperature, 22.5);
putValue(NodeName, "Master");
putValue(DiagData, dataBuf, 64);
Related reference: getValue | getValueSize | Direct access to values from system variables