docs(gateway): update UML diagrams following review feedback
- Fix class diagram: use aggregation (o--) for BleakScanner and MQTTClient - Split sequence diagram into separate files for clarity - Add sequence_startup.puml for gateway initialization - Add sequence_data_collection.puml with error handling - Use collections for BLE broadcaster to reflect multiplicity - Remove loop construct — gateway reacts to packets, ignores intervals - Add discard of unknown UUID packets - Add handling of invalid sensor values
This commit is contained in:
@@ -31,7 +31,7 @@ class MQTTClient {
|
||||
+ username_pw_set()
|
||||
}
|
||||
|
||||
Gateway --> BleakScanner : uses
|
||||
Gateway --> MQTTClient : uses
|
||||
Gateway o-- BleakScanner
|
||||
Gateway o-- MQTTClient
|
||||
|
||||
@enduml
|
||||
|
||||
27
doc_resources/gateway/sequence_data_collection.puml
Normal file
27
doc_resources/gateway/sequence_data_collection.puml
Normal file
@@ -0,0 +1,27 @@
|
||||
@startuml
|
||||
skinparam sequenceMessageAlign center
|
||||
|
||||
collections "BLE broadcaster" as thingy
|
||||
participant "Gateway\n(Raspberry Pi)" as gw
|
||||
participant "MQTT Broker\n(RabbitMQ)" as broker
|
||||
participant "Database\n(InfluxDB)" as db
|
||||
|
||||
== Data collection ==
|
||||
thingy -> gw : BLE advertising packet
|
||||
|
||||
alt UUID does not match ef680100
|
||||
gw -> gw : discard packet
|
||||
else UUID matches
|
||||
gw -> gw : extract raw payload
|
||||
gw -> gw : decode_payload()
|
||||
|
||||
alt unknown key or value out of range
|
||||
gw -> gw : discard invalid value\nlog warning
|
||||
else valid payload
|
||||
gw -> gw : add UTC timestamp
|
||||
gw -> broker : publish JSON\n{gateway_id}/{mac}/update
|
||||
broker -> db : store measurement
|
||||
end
|
||||
end
|
||||
|
||||
@enduml
|
||||
@@ -1,30 +0,0 @@
|
||||
@startuml
|
||||
skinparam sequenceMessageAlign center
|
||||
|
||||
participant "Thingy:52" as thingy
|
||||
participant "Gateway\n(Raspberry Pi)" as gw
|
||||
participant "MQTT Broker\n(RabbitMQ)" as broker
|
||||
participant "Database\n(InfluxDB)" as db
|
||||
|
||||
== Startup ==
|
||||
gw -> gw : load config.json
|
||||
gw -> broker : connect (MQTTS, TLS, auth)
|
||||
broker --> gw : connected
|
||||
gw -> gw : start BLE scan
|
||||
|
||||
== Data collection ==
|
||||
loop every 2 min to 6 hours
|
||||
thingy -> thingy : read sensors
|
||||
thingy -> gw : BLE advertising packet\n(key/value payload)
|
||||
gw -> gw : filter on UUID ef680100
|
||||
gw -> gw : decode_payload()\n0x02 humidity\n0x03 temperature\n0x04 CO2
|
||||
gw -> gw : add UTC timestamp
|
||||
gw -> broker : publish JSON\n{gateway_id}/{mac}/update
|
||||
broker -> db : store measurement
|
||||
end
|
||||
|
||||
== Node failure ==
|
||||
thingy ->x gw : no advertising for > 6h
|
||||
gw -> broker : node considered dead\n(missing from next publish)
|
||||
|
||||
@enduml
|
||||
13
doc_resources/gateway/sequence_startup.puml
Normal file
13
doc_resources/gateway/sequence_startup.puml
Normal file
@@ -0,0 +1,13 @@
|
||||
@startuml
|
||||
skinparam sequenceMessageAlign center
|
||||
|
||||
participant "Gateway\n(Raspberry Pi)" as gw
|
||||
participant "MQTT Broker\n(RabbitMQ)" as broker
|
||||
|
||||
== Startup ==
|
||||
gw -> gw : load config.json
|
||||
gw -> broker : connect (MQTTS, TLS, auth)
|
||||
broker --> gw : connected
|
||||
gw -> gw : start BLE scan
|
||||
|
||||
@enduml
|
||||
Reference in New Issue
Block a user