sosIntegerGetSint (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

All

Firmware version:

1.00.00


sosIntegerGetSint will retrieve the current value of an integer object as a SINT.

 

Input:

key : STRING

The key for the object to retrieve.

 

Output:

value : SINT

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

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  rc    : INT;
  count : SINT;
END_VAR;
BEGIN
  ...
  // Create integer object
  rc := sosIntegerCreate(key := "config.count", value:=10, desc := "Number of things");
  DebugFmt(message:="sosIntegerCreate=\1", v1:=rc);
  // Update integer object
  rc:= sosIntegerSet(key:="config.count", value:=9);
  DebugFmt(message:="sosIntegerSet=\1", v1:=rc);
 
  // Read integer object
  rc:= sosIntegerGetSint(key:="config.count", value:=count);
  DebugFmt(message:="sosIntegerGetSint=\1 => \2", v1:=rc, v2:=count);
  ...
END;
 
END_PROGRAM;