Read

This method can be used to read the current configurations of the TwinCAT Database Server. Any temporary configurations that may be included are marked accordingly.

Syntax

METHOD Read : BOOL
VAR_INPUT    
    pDBConfig: POINTER TO ARRAY [1..MAX_CONFIGURATIONS] OF ST_ConfigDB;
    cbDBConfig: UDINT;
    pAutoLogGrpConfig: POINTER TO ARRAY[1..MAX_CONFIGURATIONS] OF 
ST_ConfigAutoLogGrp;
    cbAutoLogGrpConfig: UDINT;
    pDBCount: POINTER TO UDINT;
    pAutoLogGrpCount: POINTER TO UDINT;
END_VAR

Read 1: Inputs

Name

Type

Description

pDBConfig

POINTER TO ARRAY [1..MAX_CONFIGURATIONS] OF ST_ConfigDB

Pointer address of the array into which the database configurations are to be written.

cbDBConfig

UDINT

Length of the database configuration array

pAutoLogGrpConfig

POINTER TO ARRAY[1..MAX_CONFIGURATIONS] OF 
ST_ConfigAutoLogGrp

Pointer address of the array into which the AutoLogGrp configurations are to be written.

cbAutoLogGrpConfig

UDINT

Length of the AutoLogGrp configuration array

pDBCount

POINTER TO UDINT

Pointer address for storing the number of database configurations.

pAutoLogGrpCount

POINTER TO UDINT

Pointer address for storing the number of AutoLogGrp configurations.

Read 2: Return value

Name

Type

Description

Read

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);
    aDBConfig         : ARRAY[0..MAX_CONFIGURATIONS] OF ST_ConfigDB;
    aAutoGrpConfig    : ARRAY[0..MAX_CONFIGURATIONS] OF ST_ConfigAutoLogGrp;
    nDbCount          : UDINT;
    nAutoGrpCount     : UDINT;
    tcMessage         : I_TcMessage;
END_VAR
IF fbConfigTcDBSrv.Read(
    pDBConfig := ADR(aDBConfig), 
    cbDBConfig := SIZEOF(aDBConfig), 
    pAutologGrpConfig := ADR(aAutoGrpConfig),
    cbAutoLogGrpConfig := SIZEOF(aAutoGrpConfig),
    pDBCount := ADR(nDbCount),
    pAutoLogGrpCount := ADR(nAutoGrpCount))
 THEN
    IF fbConfigTcDBSrv.bError THEN
        tcMessage := fbConfigTcDBSrv.ipTcResult;
        nState := 255; 
    ELSE
        nState := 0; 
    END_IF    
END_IF