sosBoolSet (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

All

Firmware version:

1.00.00


sosBoolSet will update the value of an existing boolean object.

 

Input:

key : STRING

The key for the object to update.

 

value : BOOL default FALSE

The new value for the object.

 

Returns: INT

0

- The object is updated.

-1

- Generic error.

-10

- Object not found.

-11

- Object has the wrong type.

 

 

Declaration:

FUNCTION sosBoolSet : INT;
VAR_INPUT
  key   : STRING;
  value : BOOL := FALSE;
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;