sosBoolGet (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

All

Firmware version:

1.00.00


sosBoolGet will retrieve the current value of a boolean object.

 

Input:

key : STRING

The key for the object to retrieve.

 

Output:

value : BOOL

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

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  rc  : INT;
  ena : BOOL;
END_VAR;
BEGIN
  ...
  // Create boolean object
  rc := sosBoolCreate(key := "config.enable", value:=ON, desc := "Enable the configuration");
  DebugFmt(message:="sosBoolCreate=\1", v1:=rc);
  // Update boolean object
  rc:= sosBoolSet(key:="config.enable", value:=OFF);
  DebugFmt(message:="sosBoolSet=\1", v1:=rc);
 
  // Read boolean object
  rc:= sosBoolGet(key:="config.enable", value:=ena);
  DebugFmt(message:="sosBoolGet=\1 => \2", v1:=rc, v2:=ena);
  ...
END;
 
END_PROGRAM;