JSONByteArrayWriter (FB) ¶ FUNCTION_BLOCK JSONByteArrayWriter EXTENDS CBM.ETrig Function block for writing of JSON data arrays. InOut: Scope Name Type Initial Comment Inherited from Input xExecute BOOL Rising edge: Action starts Falling edge: Resets outputs If a falling edge occurs before the function block has completed its action, the outputs operate in the usual manner and are only reset if either the action is completed or in the event of an error. In this case, the corresponding output values ( xDone , xError ) are present at the outputs for exactly one cycle. ETrig Output xDone BOOL TRUE : Action successfully completed ETrig xBusy BOOL TRUE : Function block active ETrig xError BOOL TRUE : Error occurred, function block aborts action FALSE : No error ETrig Input pwData POINTER TO WORD Pointer to the target array udiSize UDINT Size of the target array in bytes. xAsyncMode BOOL TRUE If true, writer runs in asynchronous mode wsLinebreak WSTRING(2) “$R$N” Line break character for the JSON writer. Use “” to disable formatting and get a compact format. Default: $R$N Inout jsonData JSONData JSONData object Output eError ERROR
JSONData (FB) ¶ FUNCTION_BLOCK JSONData EXTENDS FBF.InstanceBase implements IJSONData This function block contains the JSON data and provides methods to access and set data. Methods: Clear FindAllElementsByKey FindFirstElementByKey FindFirstValueByKey GetChildren GetElementByIndex SetArray SetBool SetEmpty SetKey SetLReal SetLRealRounded SetLint SetNull SetObject SetString Structure: Clear (Method) FindAllElementsByKey (Method) FindFirstElementByKey (Method) FindFirstValueByKey (Method) GetChildren (Method) GetElementByIndex (Method) SetArray (Method) SetBool (Method) SetEmpty (Method) SetKey (Method) SetLReal (Method) SetLRealRounded (Method) SetLint (Method) SetNull (Method) SetObject (Method) SetString (Method)
JSONDataFactory (FB) ¶ FUNCTION_BLOCK JSONDataFactory EXTENDS FBF.FactoryBase Factory with a heap based extendable memory pool. InOut: Scope Name Type Initial Comment Input Const uxiInstCount CAA.COUNT 2 Factor for the size of the initial memory pool of JSONData objects. Should be equal to the maximum number of created JSONData objects. Set to 1 and use a single instance of JSONData to reduce memory usage. Methods: Create Structure: Create (Method)
JSONFileReader (FB) ¶ FUNCTION_BLOCK JSONFileReader EXTENDS CBM.ETrig Function block for reading JSON files. InOut: Scope Name Type Initial Comment Inherited from Input xExecute BOOL Rising edge: Action starts Falling edge: Resets outputs If a falling edge occurs before the function block has completed its action, the outputs operate in the usual manner and are only reset if either the action is completed or in the event of an error. In this case, the corresponding output values ( xDone , xError ) are present at the outputs for exactly one cycle. ETrig Output xDone BOOL TRUE : Action successfully completed ETrig xBusy BOOL TRUE : Function block active ETrig xError BOOL TRUE : Error occurred, function block aborts action FALSE : No error ETrig Input sFileName STRING(255) Path to a JSON file xIgnoreValueStringLength BOOL If True, the error is ignored and the value is shortened and xValueTrunked will be TRUE xAsyncMode BOOL TRUE If true, reader runs in asynchronous mode Inout jsonData JSONData JSONData object Output eError ERROR xValueTruncated BOOL minimum one String value was > GParams.g_diMaxStringSize
JSONFileWriter (FB) ¶ FUNCTION_BLOCK JSONFileWriter EXTENDS CBM.ETrig Function block for writing of JSON files. InOut: Scope Name Type Initial Comment Inherited from Input xExecute BOOL Rising edge: Action starts Falling edge: Resets outputs If a falling edge occurs before the function block has completed its action, the outputs operate in the usual manner and are only reset if either the action is completed or in the event of an error. In this case, the corresponding output values ( xDone , xError ) are present at the outputs for exactly one cycle. ETrig Output xDone BOOL TRUE : Action successfully completed ETrig xBusy BOOL TRUE : Function block active ETrig xError BOOL TRUE : Error occurred, function block aborts action FALSE : No error ETrig Input sFileName STRING(255) Path to the JSON file eEncoding Encoding Encoding.UTF_8 File encoding xAsyncMode BOOL TRUE If true, writer runs in asynchronous mode wsLinebreak WSTRING(2) “$R$N” Line break character for the JSON writer. Use “” to disable formatting and get a compact format. Default: $R$N Inout jsonData JSONData JSONData object Output eError ERROR
Functions ¶ JSONElementToString (Function)
File and Project Information ¶ Scope Name Type Content FileHeader creationDateTime date 11.09.2023, 10:38:03 companyName string 3S-Smart Software Solutions GmbH libraryFile INI File Utility SL.library primaryProject True productName CODESYS productProfile CODESYS V3.5 SP16 Patch 3 contentFile INI File Utility SL.clean.json version version 2.0.0.0 ProjectInformation ActivateDongleLicensing bool False Depends on PS False Depends on RTS False OnlineHelp True Released True LastModificationDateTime date 11.09.2023, 10:38:01 FirmCode int 101597 ProductCode 8714 LibraryCategories library-category-list Application|Utils ActivationMail string support@codesys.com ActivationUrl http://license.codesys.com AlternativeFirmCodes 5000304 Author CODESYS Development GmbH Company CODESYS CompiledLibraryCompatibilityVersion CODESYS V3.5 SP15 Patch 2 DefaultNamespace INI_UTIL Description See: Description DocFormat reStructuredText DocLanguages en,de LanguageModelAttribute qualified-access-only Placeholder INI_File_Utility_SL Project INI File Utility SL Title INI File Utility SL SpecVersion version 3.0.0.0 Version 1.9.0.0
Library Reference ¶ This is a dictionary of all referenced libraries and their name spaces. 3SLicense ¶ Library Identification ¶ Placeholder: 3SLicense Default Resolution: 3SLicense, * (3S - Smart Software Solutions GmbH) Namespace: _3S_LICENSE Library Properties ¶ LinkAllContent: False Optional: False QualifiedOnly: False SystemLibrary: False Key: 3SLicense CAA Behaviour Model ¶ Library Identification ¶ Placeholder: CAA Behaviour Model Default Resolution: CAA Behaviour Model, * (CAA Technical Workgroup) Namespace: CBM Library Properties ¶ LinkAllContent: False Optional: False QualifiedOnly: True SystemLibrary: False Key: CAA Behaviour Model CAA Types Extern ¶ Library Identification ¶ Placeholder: CAA Types Default Resolution: CAA Types Extern, * (CAA Technical Workgroup) Namespace: CAA Library Properties ¶ LinkAllContent: False Optional: False QualifiedOnly: True SystemLibrary: False Key: CAA Types CmpErrors2 Interfaces ¶ Library Identification ¶ Name: CmpErrors2 Interfaces Version: newest Company: System Namespace: CmpErrors Library Properties ¶ LinkAllContent: False Optional: False QualifiedOnly: False SystemLibrary: False Key: CmpErrors2 Interfaces, * (System) CmpLog ¶ Library Identification ¶ Placeholder: CmpLog Default Resolution: CmpLog, * (System) Namespace: CmpLog Library Properties ¶ LinkAllContent: False Optional: False QualifiedOnly: False SystemLibrary: False Key: CmpLog Component Manager ¶ Library Identification ¶ Placeholder: Component Manager Default Resolution: Component Manager, * (System) Namespace: Component_Manager Library Properties ¶ LinkAllContent: False Optional: False QualifiedOnly: False SystemLibrary: False Key: Component Manager SysFile ¶ Library Identification ¶ Placeholder: SysFile Default Resolution: SysFile, * (System) Namespace: SysFile Library Properties ¶ LinkAllContent: False Optional: False QualifiedOnly: False SystemLibrary: False Key: SysFile SysMem ¶ Library Identification ¶ Placeholder: SysMem Default Resolution: SysMem, * (System) Namespace: SysMem Library Properties ¶ LinkAllContent: False Optional: False QualifiedOnly: False SystemLibrary: False Key: SysMem SysTypes2 Interfaces ¶ Library Identification ¶ Name: SysTypes2 Interfaces Version: newest Company: System Namespace: SysTypes Library Properties ¶ LinkAllContent: False Optional: False QualifiedOnly: False SystemLibrary: False Key: SysTypes2 Interfaces, * (System)
JSON Utilities SL Library Documentation ¶ Company : CODESYS Title : JSON Utilities SL Version : 1.11.0.0 Categories : Application|Utils Namespace : JSON Author : CODESYS Development GmbH Placeholder : JSON_Utilities_SL Description [ 1 ] ¶ With the “JSON Utilities SL” library, data can be read and written in JSON format from a CODESYS controller. The ‘JSON Utilities SL’ library provides the following functionalities: Read JSON files (UTF-8 and UTF-16) Read JSON byte arrays Write JSON files (UTF-8 and UTF-16) Read JSON byte arrays Search for keys, values, and child and parent elements The data is stored in an array of structures. Data access and element search is performed by means of methods from the JSONData function block. The simple creation of a JSON-File can be realized with funcion block JSONBuilder . The function blocks JSONByteArrayReader and JSONFileReader read data in JSON format and save the values in the JSONData function block. Writing files and byte arrays is performed by means of the function blocks JSONFileWriter and JSONByteArrayWriter . The package ‘IIoT Libraries SL’ contains the library “JSON Utilities SL”, the sample project “JSON Utilities SL Example.project”, and a description of the programming interface in CHM format. You can find the sample project and the CHM file here: C:\Users\USERNAME\JSON Utilities SL\VERSION Note To test the examples on a CODESYS Control Win the files “test_utf16.json” and “test.json” can be copied from the target directory of the installation into the directory “c:\temp”. The sample project provides three applications to demonstrate how to use the library. Application: JSONArrayExample In this example, a JSON byte array is read and written. The data is displayed in a visualization. Application: JSONFileExample In this example, a JSON file is read and written. The data is displayed in a visualization. Application: JSONFindValueExample This example demonstrates how to search for values within a JSON file. Application: JSONDataExample This example demonstrates how to generate a JSON string based on two different examples. Contents: ¶ JSON Utilities SL Common Indices and tables ¶ [ 1 ] Based on JSON Utilities SL.library, last modified 14.08.2024, 09:21:18. LibDoc 4.5.0.0 The content file JSON Utilities SL.clean.json was generated with CODESYS V3.5 SP16 Patch 3 on 14.08.2024, 09:21:21.
JSON Utilities SL ¶ Common Enums ERROR (Enum) Encoding (Enum) JSONType (Enum) Function Blocks FindFirstValueByKey (FunctionBlock) JSONBuilder (FunctionBlock) Reset (Method) SetKey (Method) SetKeyWithArray (Method) SetKeyWithObject (Method) SetKeyWithValue (Method) SetKeyWithValueNull (Method) SetObject (Method) SetValue (Method) JSONByteArrayReader (FunctionBlock) JSONByteArrayWriter (FunctionBlock) JSONData (FunctionBlock) Clear (Method) FindAllElementsByKey (Method) FindFirstElementByKey (Method) FindFirstValueByKey (Method) GetChildren (Method) GetElementByIndex (Method) SetArray (Method) SetBool (Method) SetEmpty (Method) SetKey (Method) SetLReal (Method) SetLRealRounded (Method) SetLint (Method) SetNull (Method) SetObject (Method) SetString (Method) JSONDataFactory (FunctionBlock) Create (Method) JSONFileReader (FunctionBlock) JSONFileWriter (FunctionBlock) Functions JSONElementToString (Function) Interfaces IJSONData (Interface) Clear (Method) FindAllElementsByKey (Method) FindFirstElementByKey (Method) FindFirstValueByKey (Method) GetChildren (Method) GetElementByIndex (Method) SetArray (Method) SetBool (Method) SetKey (Method) SetLReal (Method) SetLRealRounded (Method) SetLint (Method) SetNull (Method) SetObject (Method) SetString (Method) Params GParams (ParamList) Structs JSONElement (Struct) JSONValue (Union)