AddDevice

TwinCAT
Devices Multi-vendor devices Open Protocol devices

ns=2;s=DEPRAG Smart/Devices/General/OpenProtocol/AddDevice

Adds a new device to the "OpenProtocolDevices" list.

Returns:

    AddDevice
    A variable of type OpcMethodReturnValueInt32. The Result property contains the command-specific return values.
      Result
      Unique list index to retrieve the device in the OpenProtocolDevices list.

Examples:

In addition to the parameters already explained, the following variables must be created / transferred for the implementation in TwinCAT 3:

Beckhoff parameter:

    bOpenProtocolAddDevice
    A boolean variable that can be used to trigger the execution of the AddDevice command.
    OutputDataOpenProtocolAddDevice
    An instance of the "ST_Int32OutputData" structure into which the return value of the AddDevice method is written.
    hrOpenProtocolAddDevice
    This can be used to monitor the execution of the command. Error codes have the type "HRESULT".
    fbOpenProtocol
    An instance of the "FB_OpenProtocol" function block supplied with the DEPRAG Smart library.
    ConnectionHandle
    "ConnectionHandle" received when establishing a connection between DEPRAG Smart Server and your OPC UA client.


VAR
       bOpenProtocolAddDevice   : BOOL;
       OutputDataOpenProtocolAddDevice : ST_Int32OutputData;
       hrOpenProtocolAddDevice   : HRESULT;

       fbOpenProtocol   : FB_OpenProtocol;
END_VAR

hrOpenProtocolAddDevice := fbOpenProtocol.AddDevice(
       bExecute    := bOpenProtocolAddDevice,
       ConnectionHandle := depragSmartConnection.ConnectionHandle,
       OutputData   => OutputDataOpenProtocolAddDevice);
IF hrOpenProtocolAddDevice <> S_FALSE THEN 
       bOpenProtocolAddDevice := FALSE;
END_IF
                                                    

For examples and explanations regarding the calls of nodes via Siemens TIA Portal please refer to the sub-menu "Siemens TIA Portal" in section "Getting Started".