File

As part of the Edge Xpert distribution, IOTech provides a File Device Service. This allows Edge Xpert to export created files from a watched directory. Once a file has been exported, the content of the file populates the Readings pane. For further information on using the Reading pane, see Displaying Readings.

The File Device Service supports the following key features:

  • Definition of the maximum size of an exported file in bytes

  • Definition of the minimum size of an exported file in bytes

  • Events generated when new files are created in a watched directory, if defined in the [Driver] section of the TOML file

    Note

    Only the defined directory is watched. Any sub-directories of the watched directory are not watched.

  • Deletion of files after export to Edge Xpert, if defined during device provisioning

The File Device Service supports the following data types:

  • Binary
  • String

Each file read by the Device Service generates an event with the following:

  • String type containing the filename
  • Binary type containing the file content

The information from the Device Service can be viewed in the Readings pane.

Note

The File Device Service can be embedded with Edge XRT. For further information on implementing Edge XRT with a Device Service, see Edge XRT.

File Examples

Before completing these examples, you must create a local copy of docker-compose.yml, as described in the Using a Custom docker.compose File section of the Edge Xpert Command Line Interface Tool topic. Once you have created the local file, complete the following steps:

  1. Locate the device-file entry in the Device Service section

  2. Locate volumes in the device-file entry

  3. Uncomment the following lines:

    #    - type: bind
    #      source: /home/myUser/folder
    #      target: /tmp/logs
    
  4. Update the source value to point to the directory to be watched

The following examples illustrate how the File Device Service can be used:

These examples assume that the Edge Xpert services have been started with at least the --xpert-manager and --device-file parameters. A suitable startup command would be as follows:

edgexpert up --xpert-manager --device-file

Note

As you are using a local copy of the docker-compose file, this command must be run from the directory containing the custom docker-compose.yaml file.