FB_JsonSaxWriter

FB_JsonSaxWriter 1:
FB_JsonSaxWriter 2:

Strings in UTF-8 format

The variables of type STRING used here are based on the UTF-8 format. This STRING formatting is common for MQTT communication as well as for JSON documents.

In order to be able to receive special characters and texts from a wide range of languages, the character set in the Tc3_IotBase and Tc3_JsonXml libraries is not limited to the typical character set of the data type STRING. Instead, the Unicode character set in UTF-8 format is used in conjunction with the data type STRING.

If the ASCII character set is used, there is no difference between the typical formatting of a STRING and the UTF-8 formatting of a STRING.

Further information on the UTF-8 STRING format and available display and conversion options can be found in the documentation for the Tc2_Utilities PLC library.

Syntax

FUNCTION_BLOCK FB_JsonSaxWriter
VAR_OUTPUT
  initStatus     : HRESULT;
END_VAR

FB_JsonSaxWriter 3: Outputs

Name

Type

initStatus

HRESULT

FB_JsonSaxWriter 4: Methods

Name

Description

AddBase64

Adds a value of the data type Base64 to a property.

AddBool

Adds a value of the data type BOOL to a property.

AddDateTime

Adds a value of the data type DATE_AND_TIME to a property.

AddDcTime

Adds a value of the data type DCTIME to a property.

AddDint

Adds a value of the data type DINT to a property.

AddFileTime

Adds a value of the data type FILETIME to a property.

AddHexBinary

Adds a HexBinary value to a property.

AddKey

Adds a new property key at the current position of the SAX Writer.

AddKeyBool

Creates a new property key and at the same time a value of the data type BOOL.

AddKeyDateTime

Creates a new property key and at the same time a value of the data type DATE_AND_TIME.

AddKeyDcTime

Creates a new property key and at the same time a value of the data type DCTIME.

AddKeyFileTime

Creates a new property key and at the same time a value of the data type FILETIME.

AddKeyLreal

Creates a new property key and at the same time a value of the data type LREAL.

AddKeyNull

Creates a new property key and initializes its value with null.

AddKeyNumber

Creates a new property key and at the same time a value of the data type DINT.

AddKeyString

Creates a new property key and at the same time a value of the data type STRING.

AddLint

Adds a value of the data type LINT to a property.

AddLreal

Adds a value of the data type LREAL to a property.

AddNull

Adds the value null to a property.

AddRawArray

Adds a valid JSON array to a given property as a value.

AddRawObject

Adds a valid JSON object to a given property as a value.

AddReal

Adds a value of the data type REAL to a property.

AddString

Adds a value of the data type STRING to a property.

AddUdint

Adds a value of the data type UDINT to a property.

AddUlint

Adds a value of the data type ULINT to a property.

CopyDocument

Copies the contents of the JSON object currently created with the SAX Writer into a target variable of the data type STRING.

EndArray

Creates the end of a started JSON array and inserts it at the current position of the SAX Writer.

EndObject

Creates the end of a started JSON object and inserts it at the current position of the SAX Writer.

GetDocument

Returns the content of the JSON object that is currently created with the SAX Writer and returns it as data type STRING(255).

GetDocumentLength

Returns the length of the JSON object that is currently created with the SAX Writer and returns it as data type UDINT.

GetMaxDecimalPlaces

 

IsComplete

 

ResetDocument

Resets the JSON object currently created with the SAX Writer.

SetMaxDecimalPlaces

 

StartArray

Creates the start of a new JSON array and inserts it at the current position of the SAX Writer.

StartObject

Creates the start of a new JSON object and inserts it at the current position of the SAX Writer.

Requirements

TwinCAT version

Hardware

Libraries to be integrated

TwinCAT 3.1, Build 4022

x86, x64, ARM

Tc3_JsonXml