-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Everything is a driver
Underscore is the driver containing all relevant info from the platform.
It's for internal purposes only
Topic: "_"
must be retain in order to avoid needing a scan mechanism
JSON payload.
Each level contains an optional "info" field with a any
value.
The purpose is to let the platform, and the developer of a driver to pass info to the clients.
The format is entirely free, can be a JSON, a string, anything
model
and manufacturer
become attributes of a driver. They are optional.
Example: If you have a driver for a SSH connection, they don't make sense anymore.
List of strings. Each tag represents an incentive for the app to understand better how to show/treat data.
We will have a fixed list of supported tags.
To help the app understand if the driver is an instrument, a service, or anything else, we can tag a driver.
This way, you could have a tag instrument
, that would tell the app to expect these model
and manufacturer
attributes.
Could then help to show clear info for the user that this is an instrument etc.
With this reflexion we could imagine that info
could serve this purpose and be used to provide info like model
and manufacturer
.
But this is going to be very error prone if the format is not exactly correct. Tags are well-known, defined, and not flexible. Which is nice for apps, less implicit == less bugs.
{
"drivers": {},
"info": ""
}
"driver_name": {
"classes": {},
"attributes": {},
"tags": ["list_of_strings"],
"info": ""
}
Classes can be nested
"class_name": {
"classes": {}
"attributes": {},
"tags": ["list_of_strings"],
"info": ""
}
Note that the JSON object for classes is exactly the same than driver.
Makes sense, classes are optional "virtual" representation of data, but a driver is a none optional representation of data too.
The key difference is that a driver is a top-level topic, it's mandatory, and classes cannot live on their own without a driver.
"attribute_name": {
"type": "string",
"mode": "RO",
"settings": {},
"info": ""
}
String
List of known types (number, string, bool, JSON object), with array variants.
Either RW, RO, WO from the client perspective.
- Settings can be any json data
- Settings data depends on "Type", each "Type" expect a specific data format on Options
Type
== enum
- settings=> [ "val1", "val2", "val3" ]
- a list of strings
"attribute_name": {
"type": "enum",
"mode": "RO",
"settings": [ "val1", "val2", "val3" ],
"info": ""
}
Type
== si
- Options => { "unit": "A", "range": [0, 30] }
- parameters of the si
"attribute_name": {
"type": "si",
"mode": "RO",
"settings": { "unit": "A", "range": [0, 30] },
"info": ""
}