Skip to content

ctrlX Data Layer Provider

The app demonstrates how a ctrlX Data Layer connection is established and a string and flatbuffers node are provided.

Function Description

The app connects to the ctrlX Data Layer and provides a string and flatbuffers node .

If the ctrlX Data Layer connection breaks the app will exit. After 10s it will be automatically restarted by snapd.

Preparation

This sample uses a flatbuffers node defined in sampleSchema.fbs and metadata information defined in metadata.csv.

For easy of use the project contains the according compiled files:

  • sampleSchema.fbs: ./bfbs/sampleSchema.bfbs, ./schema/InertialValue.py
  • metadata.csv: ./mddb/metadata.mddb

With these compilation files the project can instantly debugged or snaps can be build.

If changes have been made to the definition files, the compiles must be regenerated. This is done by the script make-bfbs-mddb.sh.

The script can be called from the console:

./make-bfbs-mddb.sh

It can also be called from Visual Studio Code:

Main menu -> Terminal --> Run Task... --> make bfbs mddb

Implementation Description

Definition Files

Flatbuffers

  • sampleSchema.fbs: Defines a flatbuffers value (structed value). If changed compile it - see above.

Metadata

  • metadata.csv: Defines metadata for the provided ctrlX Data Layer nodes. If changed compile it - see above.
  • metadata.mddb: Compiled information of metadata.csv.

Modules

  • The module main.py manages the ctrlX Data Layer connection and the creation of the ctrlX Data Layer nodes.
  • The module helper/ctrlx_datalayer_helper.py Provides methods to easily establish a ctrlX Data Layer connection.
  • The module app/my_provider_node.py contains the class MyProviderNode with the callback function needed by the ctrlX Data Layer.
  • The module sample/schema/InertialValue.py is generated by flatc from sampleSchema.fbs. It is used to manage the flatbuffers data struct.

License

SPDX-FileCopyrightText: Bosch Rexroth AG SPDX-License-Identifier: MIT