Skip to main content
Version: 2.4

Introduction

HumanOS.UHAL.FileReader plugin is part of the HumanOS® Runtime. It allows to read content of files into the smart industrial machining platform or to write content from the platform into files. This document explicitly describes the Driver. For common description on HumanOS® Runtime, software design and device information files, see the "Operation Manual".

Plugin Configuration

The plugin configuration file is named "settings.json" and located in: $(InstallDirectory)\Config\HumanOS.UHAL.FileReader\. Actually, only the "Disabled" Property can be specified here. For more information, see the "Operation Manual".

Device Configuration

Address

The plugin is designed so that one device info file must be created for each monitoring file. Any text based files are supported. The address of the device equals the path of the monitoring file.

Absolute or relative paths can be used, where relative paths refer to the AppConfig:CommonAppPath setting in appsettings.json. Environment variables are also resolved.

Examples:

TypeExampleResolved path
AbsoluteC:\Temp\FileToRead.jsonC:\Temp\FileToRead.json
Relative.\Files\FileToRead.json${AppConfig:CommonAppPath}\Files\FileToRead.json
Environment variable%userprofile%\Files\FileToRead.jsonfor windows typically C:\Users\${username}\Files\FileToRead.json

Properties

The property "Encoding" allows to specify the file encoding. If the property is not specified, the standard encoding of the operating system is used.

Following values are possible for the property "Encoding":

Property ValueDescription
ASCIIUS-ASCII encoding
UnicodeUnicode (UTF-16)
BigEndianUnicodeUnicode (Big endian)
UTF7UTF-7 encoding
UTF8UTF-8 encoding
UTF32Unicode (UTF-32)
Latin1Western European (iso-8859-1)

Following example shows a device info file for the HumanOS.UHAL.FileReader plugin:

{
"Id": "50CC3DA6-5874-40F8-9A5B-820F1F445365",
"Name": "My Device Name",
"DriverId": "94CAFEC2-7910-41F6-8185-C35CA768FABA",
"Address": "C:\\Projects\\HumanOS\\FileToRead.xml",
"Properties": [
{
"Name": "Encoding",
"Value": "UTF8"
}
],
"DataNodes": []
}

Data Access

Each data access node must contain one of the following address types:

Content ModelStarts withType
WholeTextWholeTextConstant String
XML/X-Path Language
JSON$.JSONPath notation

Each address must start with the specified string. The plugin navigates dependent on the data address through the content model of the file and reads the text under this address. Each Address supports read, write and receive access. In write mode, the plugin overwrites the file with the appropriately changed value.

The following address examples explain the behavior.

Whole Text Address

Data node example:

{
"Id": "{F784EEF0-BA9C-4DEA-ABD5-B2061DC86B19}",
"Name": "Whole Content of the file",
"DataClass": "Event",
"DataType": "System.String",
"Address": "WholeText",
"Access": {
"Read": true,
"Receive": true
},
"Properties": []
}

Content of the file and the value of the data node are identical.

Example:

<?xml version="1.0" encoding="utf-8"?>
<File>
<Data id="1">
<Value>125</Value>
</Data>
</File>

XML Address

Data node example:

{
"Id": "{D16D3ED7-BC14-4D5D-9B55-DC25F8C6EF96}",
"Name": "Data Value 1",
"DataClass": "Event",
"DataType": "System.Int32",
"Address": "/File/Data[@id='2']/Value",
"Access": {
"Read": true,
"Receive": true
},
"Properties": []
}

Content of the file:

<?xml version="1.0" encoding="utf-8"?>
<File>
<Data id="1">
<Value>125</Value>
</Data>
<Data id="2">
<Value>14</Value>
</Data>
<Data id="3">
<Value>-114</Value>
</Data>
<Data id="4">
<Value>99.82</Value>
</Data>
</File>

Value of the Int32 data node = '14'

JSON Address

Data node example:

{
"Id": "{59A602FA-6002-4276-A21C-540349F238AA}",
"Name": "Data Value 1",
"DataClass": "Event",
"DataType": "System.String",
"Address": "$.DataItems[0].Value",
"Access": {
"Read": true,
"Receive": true
},
"Properties": []
}

Content of the file:

{
"DataItems": [
{
"DataType": "System.String",
"Value": "Hello World"
},
{
"DataType": "System.Int32",
"Value": 14
},
{
"DataType": "System.Int32",
"Value": -114
},
{
"DataType": "System.Double",
"Value": 99.82
}
]
}

Value of the string data node = 'Hello World'