docs(gateway): update diagrams for battery level support
- Add KEY_BATTERY (0x05) to class diagram - Update EXPECTED_PAYLOAD_SIZE from 12 to 14 in class diagram - Update payload size check from 12 to 14 in sequence diagram
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
@startuml
|
@startuml
|
||||||
skinparam linestyle ortho
|
skinparam linestyle ortho
|
||||||
|
|
||||||
class Gateway {
|
class Gateway {
|
||||||
- gateway_id: str
|
- gateway_id: str
|
||||||
- mqtt_broker: str
|
- mqtt_broker: str
|
||||||
@@ -11,8 +10,9 @@ class Gateway {
|
|||||||
+ KEY_HUMIDITY: 0x02
|
+ KEY_HUMIDITY: 0x02
|
||||||
+ KEY_TEMP: 0x03
|
+ KEY_TEMP: 0x03
|
||||||
+ KEY_CO2: 0x04
|
+ KEY_CO2: 0x04
|
||||||
|
+ KEY_BATTERY: 0x05
|
||||||
+ INVALID_VALUE: 0xFFFFFFFF
|
+ INVALID_VALUE: 0xFFFFFFFF
|
||||||
+ EXPECTED_PAYLOAD_SIZE: 12
|
+ EXPECTED_PAYLOAD_SIZE: 14
|
||||||
--
|
--
|
||||||
+ decode_payload(data: bytes): dict
|
+ decode_payload(data: bytes): dict
|
||||||
+ publish(mac: str, data: dict)
|
+ publish(mac: str, data: dict)
|
||||||
@@ -21,12 +21,10 @@ class Gateway {
|
|||||||
+ on_publish(client, userdata, mid, reason_code, properties)
|
+ on_publish(client, userdata, mid, reason_code, properties)
|
||||||
+ run()
|
+ run()
|
||||||
}
|
}
|
||||||
|
|
||||||
class BleakScanner {
|
class BleakScanner {
|
||||||
+ start()
|
+ start()
|
||||||
+ stop()
|
+ stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
class MQTTClient {
|
class MQTTClient {
|
||||||
+ connect()
|
+ connect()
|
||||||
+ publish()
|
+ publish()
|
||||||
@@ -34,8 +32,6 @@ class MQTTClient {
|
|||||||
+ username_pw_set()
|
+ username_pw_set()
|
||||||
+ loop_start()
|
+ loop_start()
|
||||||
}
|
}
|
||||||
|
|
||||||
Gateway o-- BleakScanner
|
Gateway o-- BleakScanner
|
||||||
Gateway o-- MQTTClient
|
Gateway o-- MQTTClient
|
||||||
|
|
||||||
@enduml
|
@enduml
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ alt company_id != 0xffff
|
|||||||
else company_id == 0xffff
|
else company_id == 0xffff
|
||||||
gw -> gw : check payload size
|
gw -> gw : check payload size
|
||||||
|
|
||||||
alt payload size != 12 bytes
|
alt payload size != 14 bytes
|
||||||
gw -> gw : discard packet\n(non-Thingy device)
|
gw -> gw : discard packet\n(non-Thingy device)
|
||||||
else
|
else
|
||||||
gw -> gw : decode_payload()
|
gw -> gw : decode_payload()
|
||||||
|
|||||||
Reference in New Issue
Block a user