sosDoubleGet (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

All

Firmware version:

1.52.00


sosDoubleGet will retrieve the current value of a DOUBLE object.

 

Input:

key : STRING

The key for the object to retrieve.

 

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.5, desc := "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;