Create
This method creates new entries in the XML configuration file for the TwinCAT Database Server. Optionally the TwinCAT Database Server can use a new entry on a temporary basis. In this case no data is written to the XML file.
Syntax
METHOD Create : BOOL
VAR_INPUT
pTcDBSrvConfig: POINTER TO BYTE;
cbTcDBSrvConfig: UDINT;
bTemporary: BOOL := TRUE;
pConfigID: POINTER TO UDINT;
END_VAR
Inputs
Name | Type | Description |
---|---|---|
pTcDBSrvConfig | POINTER TO BYTE | Pointer of the configuration structure to be created. |
cbTcDBSrvConfig | UDINT | Length of the configuration structure |
bTemporary | BOOL | Indicates whether the configuration is to be stored in the XML file. |
pConfigID | POINTER TO UDINT | Return pointer of the configuration ID (hDBID or hAutoLogGrpID) |
![]() | Creating AutoLog groups is currently not supported. |
Return value
Name | Type | Description |
---|---|---|
Create | BOOL | Displays the status of the method. Returns TRUE as soon as the method execution is finished, even in the event of an error. |
Sample
VAR
fbConfigTcDBSrv : FB_ConfigTcDBSrvEvt(sNetId := '', tTimeout:=T#5S);
myConfigHandle : INT;
// Any other ConfigType can be used here
stConfigDB : T_DBConfig_MsCompactSQL;
tcMessage : I_TcMessage;
END_VAR
stConfigDB.bAuthentification := FALSE;
stConfigDB.sServer := 'C:\Recipes.sdf';
IF fbConfigTcDBSrv.Create(
pTcDBSrvConfig:= ADR(stConfigDB),
cbTcDBSrvConfig:= SIZEOF(stConfigDB),
bTemporary:= TRUE,
pConfigID:= ADR(myConfigHandle))
THEN
IF fbConfigTcDBSrv.bError THEN
tcMessage := fbConfigTcDBSrv.ipTcResult;
nState := 255;
ELSE
nState := 0;
END_IF
END_IF