sosIntegerSet will update the value of an existing integer object.
Input:
key : STRING
The key for the object to update.
value : DINT default 0
The new value for the object.
Returns: INT
0
|
- The object is updated.
|
-1
|
- Generic error.
|
-2
|
- Invalid parameter.
|
-10
|
- Object not found.
|
-11
|
- Object has the wrong type.
|
Declaration:
FUNCTION sosIntegerSet : INT;
VAR_INPUT
key : STRING;
value : DINT := 0;
END_VAR;
Example:
INCLUDE rtcu.inc
PROGRAM test;
VAR
rc : INT;
timeout : INT;
END_VAR;
BEGIN
...
rc := sosIntegerCreate(key := "config.timeout", value:=600, desc := "Timeout for the connection");
DebugFmt(message:="sosIntegerCreate=\1", v1:=rc);
rc:= sosIntegerSet(key:="config.timeout", value:=6000);
DebugFmt(message:="sosIntegerSet=\1", v1:=rc);
rc:= sosIntegerGetInt(key:="config.timeout", value:=timeout);
DebugFmt(message:="sosIntegerGetInt=\1 => \2", v1:=rc, v2:=timeout);
...
END;
END_PROGRAM;
|