JSON Configuration Format¶
This page describes the JSON configuration format for HERO devices.
The JSON configuration can be provided as a single HERO config object or as a collection of HERO configs under the rows key.
Single HERO Config¶
A single HERO config is a dictionary with the following keys:
{
"_id": "hero_name",
"classname": "module.class",
"arguments": {},
"datasource": {}
}
Key |
Type |
Description |
|---|---|---|
|
string |
Name of the HERO. |
|
string |
Path to the device driver class in the form |
|
dict |
Dictionary of keyword-value pairs passed to the |
|
dict |
Keyword-value pairs that describe a datasource (classes with the |
|
list |
List of tags that are added to the HERO. The tag |
Special Arguments¶
{
"_id": "hero_name_1",
"classname": "module.class",
"arguments": {
"loop": "@_boss_loop",
"pool": "@_boss_pool"
}
}
Event Loop¶
Using @_boss_loop as the value of the key/value pair in the arguments part of the configuration passes the asyncio.EventLoop which is running inside BOSS.
Note, asyncio support in Zenoh is still in development and using the event loop might not behave as expected.
Process Pool¶
Upon start, BOSS creates an concurrent.futures.ProcessPoolExecutor, this pool can be passed to the target class via @_boss_pool.
The number of workers can be controlled via the parameter --max-workers when starting BOSS.
Datasource Keys¶
The datasource dictionary supports the following keys:
Key |
Type |
Description |
|---|---|---|
|
bool |
If |
|
number |
Polling interval in seconds. |
|
list |
List of class attributes that are polled and emitted with the |
Multiple HERO Configs¶
To define multiple HERO configs, use the rows key:
{
"rows": [
{
"_id": "hero_name_1",
"classname": "module.class",
"arguments": {},
"datasource": {}
},
{
"_id": "hero_name_2",
"classname": "module.class",
"arguments": {},
"datasource": {}
}
]
}
Warning
The couchdb API may enclose the HERO config dictionary in a doc keyword. This is handled automatically, so do not use doc as a top-level key in your configuration.
Tip
You may use additional keys for specific use cases, such as CouchDB views. For more information, see Using Views.