Files
MSE-PI-E2EEDA-Plein-de-eeee…/report/main/architecture/description.typ

55 lines
2.8 KiB
Typst

#import "/metadata.typ": *
#pagebreak()
= Global BDD
The global architecture as given in @fig:top-level-architecture can be detailed with @fig:top_level_archi_interface.
The following gives shape to the aforementioned interfaces.
#let top_level_archi_interface = [
#figure(
image("../../resources/img/bdd_complete.svg"),
caption: [Top-level architecture, including interfaces between units]
) <fig:top_level_archi_interface>
]
#top_level_archi_interface
The various interfaces available in @fig:top_level_archi_interface are composed of the following data:
- #underline[Nodes interface]:
#let nodes_interface = [A node advertise its data over @ble using key/values with the following content:
#figure(
table(
columns: (auto, auto, auto, auto),
align: center,
table.header("name", "key", "data construction", "data size"),
[Window opening status],[0x01],[0/1],[1B],
[Humidity],[0x02],[Integer giving the raw percentage],[1B],
[Temperature],[0x03],[Integer in the range [0,500]],[2B],
[CO2 level [ppm]],[0x04],[Integer in the range [400,5000]],[4B]
),
caption: [Data communicated in the nodes_interface],
)<tab:nodes_interface_content>
This description considers the following elements:
- Each key is held on 1 Byte
- The conversion from the held data for the temperature is: $"temperature" = "data"_"temp"/10 $ \
The resulting temperature is within the range [0,50] °C with one digit decimal.
- For each key, any value outside of the associated range indicates that the node failed to get a valid value.
- For a given node, the time between two broadcast of data is variable, with the shortest time being 1 minutes and the longest time being 6 hours.
]
#nodes_interface
- #underline[db set] : MQTT topic named "{id_gateway}/{node_mac}/update" with the following content:
```JSON
{
"timestamp" : <ISO 8601 timestamp>,
"co2_ppm" : <integer>,
"temp" : <float>,
"humidity" : <integer>
}
```
This description considers the following elements:
- The timestamp format respect the #link("https://en.wikipedia.org/wiki/ISO_8601")[ISO 8601] definition.
As the standard allows variations, the format is given as _YYYY-MM-DDThh:mm:ssZ_.
This choice enables efficient time manipulation on all ends.
A timestamp considering the milliseconds is not required as the recorded data should stay stable over several consecutive seconds
- Upon receiving a data point from a node, the gateway adds the timestamp and publish the content on the MQTT channel.
- #underline[db API] : the content for this interface in tracked in #link("https://github.com/PI-E2EEDA/Plein-de-eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-project/issues/7")[issue \#7].
- #underline[teams API] : The teams API is to be followed and as such is kept absent from this document.