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
...
rc := sosBoolCreate(key := "config.enable", value:=ON, desc := "Enable the configuration");
DebugFmt(message:="sosBoolCreate=\1", v1:=rc);
rc:= sosBoolSet(key:="config.enable", value:=OFF);
DebugFmt(message:="sosBoolSet=\1", v1:=rc);
rc:= sosBoolGet(key:="config.enable", value:=ena);
DebugFmt(message:="sosBoolGet=\1 => \2", v1:=rc, v2:=ena);
...
END;
END_PROGRAM;
|