Skip to main content

Add-on system

The TEN framework uses add-ons as its basic software modules. Add-ons are self-contained components that implement specific functionality within the TEN framework. All features and capabilities in a TEN application are built using these modular add-ons.

The TEN framework supports the following types of add-ons:

  • TEN extension - Implements core application logic and features
  • TEN extension group - Groups multiple extensions for coordinated functionality
  • TEN protocol - Handles communication protocols and data exchange

Loading add-ons

To load an add-on into the TEN runtime, you need:

  1. Add-on name

    The name must be globally unique within your TEN application. If you load multiple add-ons with the same name, the TEN runtime exhibits undefined behavior and may fail to load the second add-on properly.

  2. Add-on folder location

    Specify the directory path where the TEN runtime can find the add-on's files. The runtime uses this directory as the base_dir to load configuration files such as manifest.json and property.json.

    The add-on registration API attempts to detect this directory automatically. If automatic detection fails, you must explicitly specify the base_dir path.

  3. Add-on instance

Registering add-ons

You can register add-ons using one of the following methods:

  1. Use the explicit registration API

    Call the registration API to manually register the add-on's base_dir with the TEN runtime.

    info

    Currently, only the standalone testing framework provides this API.

  2. Use the designated directory structure

    Place your add-ons in the ten_packages/ directory of your TEN application. The application automatically discovers and loads add-ons at startup when you organize them as follows:


    _9
    .
    _9
    └── ten_packages/
    _9
    ├── extension/
    _9
    │ ├── <extension_foo>/
    _9
    │ └── <extension_bar>/
    _9
    ├── extension_group/
    _9
    │ └── <extension_group_x>/
    _9
    └── protocol/
    _9
    └── <protocol_a>/