feat: add dynamic_data snippet

This commit is contained in:
Strix 2023-10-15 18:06:20 +02:00
parent cfae325be4
commit 1e68840042
No known key found for this signature in database
GPG key ID: 49B2E37B8915B774

View file

@ -52,19 +52,30 @@ The master will not track the broken packet's `packet_id`, so the slave can send
Domo has a data framework reliant on data types. Domo has a data framework reliant on data types.
These define what kind of data the property holds. These define what kind of data the property holds.
| `prop_data_type` | physical type (rust types) | size | virtual type | description | | `data_type` | physical type (rust types) | size | virtual type | description |
|------------------|----------------------------|-----------|---------------------|-----------------------------------------------------------------------------| |-------------|----------------------------|-----------|---------------------|-----------------------------------------------------------------------------|
| `0x0*` | | | | **Basic** | | `0x0*` | | | | **Basic** |
| `0x00` | `None` | 0 bytes | Nothing | Nothing, mostly used internally or as example. | | `0x00` | `None` | 0 bytes | Nothing | Nothing, mostly used internally or as example. |
| `0x01` | `bool` | 1 byte | Switch | A simple switch with two states. `0x00` = off, `0x01` = on, `0x02` = toggle | | `0x01` | `bool` | 1 byte | Switch | A simple switch with two states. `0x00` = off, `0x01` = on, `0x02` = toggle |
| `0x02` | `u8` | 1 byte | Slider | A simple slider with u8 precision. | | `0x02` | `u8` | 1 byte | Slider | A simple slider with u8 precision. |
| `0x03` | `[u8; 256]` | 256 bytes | Text | A simple bit of text. | | `0x03` | `[u8; 256]` | 256 bytes | Text | A simple bit of text. |
| `0x1*` | | | | **Cosmetic** | | `0x1*` | | | | **Cosmetic** |
| `0x10` | `[u8; 3]` | 3 bytes | Color | An RGB value. | | `0x10` | `[u8; 3]` | 3 bytes | Color | An RGB value. |
| `0x9*` | | | | **Time & Space** | | `0x9*` | | | | **Time & Space** |
| `0x90` | `u64` | 8 bytes | Seconds | A simple value that is in seconds. | | `0x90` | `u64` | 8 bytes | Seconds | A simple value that is in seconds. |
| `0xF*` | | | | **Domo types** | | `0xF*` | | | | **Domo types** |
| `0xF0` | `[u8; 4]` | 4 bytes | Domo node reference | A reference to a node. | | `0xF0` | `[u8; 4]` | 4 bytes | Domo node reference | A reference to a node. |
## Dynamic data (`dynamic_data`)
Dynamic data is a data snippet with a `prop_data_type` byte and the data next to it.
> **Note**: this section uses relative offset
| offset | size | name | description | example |
|--------|-------------------------------|------------------|-------------------------|---------|
| `0x00` | 1 byte | `prop_data_type` | Describes the data type | `0x00` |
| `0x01` | depending on `prop_data_type` | `data` | The data | |
# Commands # Commands
@ -169,18 +180,17 @@ Get a properties value
| offset | size | name | description | reserved | example | | offset | size | name | description | reserved | example |
|--------|-------------------------|-----------------|---------------------------------------------|----------|---------| |--------|-------------------------|-----------------|---------------------------------------------|----------|---------|
| `0x14` | 32 bytes | `property_name` | The name of the property as a UTF-8 string. | no | "Power" | | `0x14` | 32 bytes | `property_name` | The name of the property as a UTF-8 string. | no | "Power" |
| `0x34` | 1 byte | `data_type` | The type of the data. | response | `0x00` | | `0x34` | 1 byte | `data_type` | The type of the data. | response | `0x01` |
| `0x35` | determined by data type | `data` | The actual data. | response | | | `0x35` | determined by data type | `data` | The actual data. | response | |
### `0x11` - Set property ### `0x11` - Set property
#### Command data #### Command data
| offset | size | name | description | reserved | example | | offset | size | name | description | reserved | example |
|--------|-------------------------|-----------------|---------------------------------------------|----------|---------| |--------|----------|-----------------|---------------------------------------------|----------|----------|
| `0x14` | 32 bytes | `property_name` | The name of the property as a UTF-8 string. | no | "Power" | | `0x14` | 32 bytes | `property_name` | The name of the property as a UTF-8 string. | no | "Power" |
| `0x34` | 1 byte | `data_type` | The type of the data. | no | `0x00` | | `0x34` | 1 byte | `dynamic_data` | Dynamic data snippet | no | `0x0100` |
| `0x35` | determined by data type | `data` | The actual data. | no | |
### `0x12` - Reset property ### `0x12` - Reset property