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:
-
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.
-
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 asmanifest.json
andproperty.json
.The add-on registration API attempts to detect this directory automatically. If automatic detection fails, you must explicitly specify the
base_dir
path. -
Add-on instance
Registering add-ons
You can register add-ons using one of the following methods:
-
Use the explicit registration API
Call the registration API to manually register the add-on's
base_dir
with the TEN runtime.infoCurrently, only the standalone testing framework provides this API.
-
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: