sosIntegerGetInt (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

All

Firmware version:

1.00.00


sosIntegerGetInt will retrieve the current value of an integer object as an INT.

 

Input:

key : STRING

The key for the object to retrieve.

 

Output:

value : INT

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 sosIntegerGetInt : INT;
VAR_INPUT
  key   : STRING;
  value : ACCESS INT;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  rc      : INT;
  timeout : INT;
END_VAR;
BEGIN
  ...
  // Create integer object
  rc := sosIntegerCreate(key := "config.timeout", value:=600, desc := "Timeout for the connection");
  DebugFmt(message:="sosIntegerCreate=\1", v1:=rc);
  // Update integer object
  rc:= sosIntegerSet(key:="config.timeout", value:=6000);
  DebugFmt(message:="sosIntegerSet=\1", v1:=rc);
 
  // Read integer object
  rc:= sosIntegerGetInt(key:="config.timeout", value:=timeout);
  DebugFmt(message:="sosIntegerGetInt=\1 => \2", v1:=rc, v2:=timeout);
  ...
END;
 
END_PROGRAM;