sosDoubleGet (Function)

Top  Previous  Next

Architecture:

NX32L

Firmware version:

1.52.00


sosDoubleGet will retrieve the current value of a DOUBLE object.

Please note that when using this function in a non-NX32L project, math.inc must be explicitly included by the application.

 

Input:

key : STRING

The key for the object to retrieve.

Note: Starting with runtime firmware V2.40.00, the key can be prefixed with "!" to access system objects.

 

Output:

value : DOUBLE

The value of the object.

 

Returns: INT

0

- The value has been retrieved.

-1

- Generic error.

-10

- Object not found.

-11

- Object has the wrong type.

-12

- Content has invalid size.

 

 

Declaration:

FUNCTION sosDoubleGet : INT;
VAR_INPUT
   key   : STRING;
   value : ACCESS DOUBLE;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
INCLUDE math.inc
 
PROGRAM test;
VAR
   rc   : INT;
   temp : DOUBLE;
END_VAR;
BEGIN
   ...
   // Create double object
   rc := sosDoubleCreate(key := "config.max_temperature", value:=24.5desc := "Largest temperature measured");
   DebugFmt(message:="sosDoubleCreate=\1", v1:=rc);
   // Update double object
   rc:= sosDoubleSet(key:="config.max_temperature", value:=26.7);
   DebugFmt(message:="sosDoubleSet=\1", v1:=rc);
   
   // Read double object
   rc:= sosDoubleGet(key:="config.max_temperature", value:=temp);
   DebugFmt(message:="sosDoubleGet=\1 => " + doubleToStr(v:=temp), v1:=rc);
   ...
END;
 
END_PROGRAM;