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
...
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;
|