CloseJsonDocument

TwinCAT
Local File and directory access JSON reader

ns=2;s=DEPRAG Smart/Local/FileAndDirectoryAccess/Json/CloseJsonDocument

The command closes the JSON document and releases the index in the ActiveJsonDocuments list.

Parameters:

    Id
    Unique index to retrieve the JSON document in the ActiveJsonDocuments list.

Returns:

    CloseJsonDocument
    A variable of type OpcMethodReturnValueInt32. The Result property contains the command-specific return values.
      Result
      Unique index to retrieve the JSON document in the ActiveJsonDocuments list.

Examples:

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

Beckhoff parameter:

    bJsonOpenJsonDocument
    A boolean variable that can be used to trigger the execution of the CloseJsonDocument command.
    OutputDataJsonOpenJsonDocument
    An instance of the "ST_JsonDocumentOutputData" structure into which the return value of the CloseJsonDocument method is written.
    hrJsonOpenJsonDocument
    This can be used to monitor the execution of the command. Error codes have the type "HRESULT".
    fbJson
    An instance of the "FB_Json" function block supplied with the DEPRAG Smart library.
    nId
    A DINT variable that uniquely identifies the JSON document in the ActiveJsonDocuments list.
    ConnectionHandle
    "ConnectionHandle" received when establishing a connection between DEPRAG Smart Server and your OPC UA client.


VAR
   bJsonCloseJsonDocument   : BOOL;
   OutputDataJsonCloseJsonDocument   : ST_JsonDocumentOutputData;
   hrJsonCloseJsonDocument  : HRESULT;

   fbJson : FB_Json;
END_VAR

hrJsonCloseJsonDocument := fbJson.CloseJsonDocument(
         bExecute    := bJsonCloseJsonDocument,   
         ConnectionHandle := depragSmartConnection.ConnectionHandle, 
         nId     := 0,
         OutputData   => OutputDataJsonCloseJsonDocument);
IF hrJsonCloseJsonDocument <> S_FALSE THEN 
 bJsonCloseJsonDocument := 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".