57 lines
12 KiB
XML
57 lines
12 KiB
XML
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="439px" preserveAspectRatio="none" style="width:308px;height:439px;" version="1.1" viewBox="0 0 308 439" width="308px" zoomAndPan="magnify"><defs><filter height="300%" id="f1nrmzuf4n70d9" width="300%" x="-1" y="-1"><feGaussianBlur result="blurOut" stdDeviation="2.0"/><feColorMatrix in="blurOut" result="blurOut2" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 0"/><feOffset dx="4.0" dy="4.0" in="blurOut2" result="blurOut3"/><feBlend in="SourceGraphic" in2="blurOut3" mode="normal"/></filter></defs><g><!--MD5=[6de492f04047ff8a778df2bea690e363]
|
|
class Gateway--><rect fill="#FEFECE" filter="url(#f1nrmzuf4n70d9)" height="248.0703" id="Gateway" style="stroke: #A80036; stroke-width: 1.5;" width="223" x="34.5" y="8"/><ellipse cx="115.25" cy="24" fill="#ADD1B2" rx="11" ry="11" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M118.2188,29.6406 Q117.6406,29.9375 117,30.0781 Q116.3594,30.2344 115.6563,30.2344 Q113.1563,30.2344 111.8281,28.5938 Q110.5156,26.9375 110.5156,23.8125 Q110.5156,20.6875 111.8281,19.0313 Q113.1563,17.375 115.6563,17.375 Q116.3594,17.375 117,17.5313 Q117.6563,17.6875 118.2188,17.9844 L118.2188,20.7031 Q117.5938,20.125 117,19.8594 Q116.4063,19.5781 115.7813,19.5781 Q114.4375,19.5781 113.75,20.6563 Q113.0625,21.7188 113.0625,23.8125 Q113.0625,25.9063 113.75,26.9844 Q114.4375,28.0469 115.7813,28.0469 Q116.4063,28.0469 117,27.7813 Q117.5938,27.5 118.2188,26.9219 L118.2188,29.6406 Z "/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="53" x="135.75" y="28.1543">Gateway</text><line style="stroke: #A80036; stroke-width: 1.5;" x1="35.5" x2="256.5" y1="40" y2="40"/><rect fill="none" height="6" style="stroke: #C82930; stroke-width: 1.0;" width="6" x="42.5" y="48"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="87" x="54.5" y="54.2104">gateway_id: str</text><rect fill="none" height="6" style="stroke: #C82930; stroke-width: 1.0;" width="6" x="42.5" y="60.8047"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="93" x="54.5" y="67.0151">mqtt_broker: str</text><rect fill="none" height="6" style="stroke: #C82930; stroke-width: 1.0;" width="6" x="42.5" y="73.6094"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="77" x="54.5" y="79.8198">mqtt_port: int</text><rect fill="none" height="6" style="stroke: #C82930; stroke-width: 1.0;" width="6" x="42.5" y="86.4141"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="104" x="54.5" y="92.6245">mqttc: MQTTClient</text><line style="stroke: #A80036; stroke-width: 1.0;" x1="35.5" x2="256.5" y1="99.2188" y2="99.2188"/><ellipse cx="45.5" cy="110.2188" fill="none" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="170" x="54.5" y="113.4292">EXPECTED_PAYLOAD_SIZE: 14</text><ellipse cx="45.5" cy="123.0234" fill="none" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="174" x="54.5" y="126.2339">DEDUP_WINDOW_SECONDS: 10</text><ellipse cx="45.5" cy="135.8281" fill="none" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="152" x="54.5" y="139.0386">INVALID_VALUE: 0xFFFFFFFF</text><line style="stroke: #A80036; stroke-width: 1.0;" x1="35.5" x2="256.5" y1="145.6328" y2="145.6328"/><ellipse cx="45.5" cy="156.6328" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="191" x="54.5" y="159.8433">decode_payload(data: bytes): dict</text><ellipse cx="45.5" cy="169.4375" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="158" x="54.5" y="172.6479">publish(mac: str, data: dict)</text><ellipse cx="45.5" cy="182.2422" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="155" x="54.5" y="185.4526">is_duplicate(mac: str): bool</text><ellipse cx="45.5" cy="195.0469" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="197" x="54.5" y="198.2573">on_device_found(device, adv_data)</text><ellipse cx="45.5" cy="207.8516" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="84" x="54.5" y="211.062">on_connect(...)</text><ellipse cx="45.5" cy="220.6563" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="101" x="54.5" y="223.8667">on_disconnect(...)</text><ellipse cx="45.5" cy="233.4609" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="81" x="54.5" y="236.6714">on_publish(...)</text><ellipse cx="45.5" cy="246.2656" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="27" x="54.5" y="249.4761">run()</text><!--MD5=[9bcdb053cc478e270a3d5ddd8067c8f1]
|
|
class BleakScanner--><rect fill="#FEFECE" filter="url(#f1nrmzuf4n70d9)" height="73.6094" id="BleakScanner" style="stroke: #A80036; stroke-width: 1.5;" width="118" x="6" y="335"/><ellipse cx="21" cy="351" fill="#ADD1B2" rx="11" ry="11" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M23.9688,356.6406 Q23.3906,356.9375 22.75,357.0781 Q22.1094,357.2344 21.4063,357.2344 Q18.9063,357.2344 17.5781,355.5938 Q16.2656,353.9375 16.2656,350.8125 Q16.2656,347.6875 17.5781,346.0313 Q18.9063,344.375 21.4063,344.375 Q22.1094,344.375 22.75,344.5313 Q23.4063,344.6875 23.9688,344.9844 L23.9688,347.7031 Q23.3438,347.125 22.75,346.8594 Q22.1563,346.5781 21.5313,346.5781 Q20.1875,346.5781 19.5,347.6563 Q18.8125,348.7188 18.8125,350.8125 Q18.8125,352.9063 19.5,353.9844 Q20.1875,355.0469 21.5313,355.0469 Q22.1563,355.0469 22.75,354.7813 Q23.3438,354.5 23.9688,353.9219 L23.9688,356.6406 Z "/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="86" x="35" y="355.1543">BleakScanner</text><line style="stroke: #A80036; stroke-width: 1.5;" x1="7" x2="123" y1="367" y2="367"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="7" x2="123" y1="375" y2="375"/><ellipse cx="17" cy="386" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="35" x="26" y="389.2104">start()</text><ellipse cx="17" cy="398.8047" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="33" x="26" y="402.0151">stop()</text><!--MD5=[7b0a38b921e8edd57f0a15334e548aaa]
|
|
class MQTTClient--><rect fill="#FEFECE" filter="url(#f1nrmzuf4n70d9)" height="112.0234" id="MQTTClient" style="stroke: #A80036; stroke-width: 1.5;" width="138" x="159" y="316"/><ellipse cx="191.1" cy="332" fill="#ADD1B2" rx="11" ry="11" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M194.0688,337.6406 Q193.4906,337.9375 192.85,338.0781 Q192.2094,338.2344 191.5063,338.2344 Q189.0063,338.2344 187.6781,336.5938 Q186.3656,334.9375 186.3656,331.8125 Q186.3656,328.6875 187.6781,327.0313 Q189.0063,325.375 191.5063,325.375 Q192.2094,325.375 192.85,325.5313 Q193.5063,325.6875 194.0688,325.9844 L194.0688,328.7031 Q193.4438,328.125 192.85,327.8594 Q192.2563,327.5781 191.6313,327.5781 Q190.2875,327.5781 189.6,328.6563 Q188.9125,329.7188 188.9125,331.8125 Q188.9125,333.9063 189.6,334.9844 Q190.2875,336.0469 191.6313,336.0469 Q192.2563,336.0469 192.85,335.7813 Q193.4438,335.5 194.0688,334.9219 L194.0688,337.6406 Z "/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="68" x="208.9" y="336.1543">MQTTClient</text><line style="stroke: #A80036; stroke-width: 1.5;" x1="160" x2="296" y1="348" y2="348"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="160" x2="296" y1="356" y2="356"/><ellipse cx="170" cy="367" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="52" x="179" y="370.2104">connect()</text><ellipse cx="170" cy="379.8047" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="49" x="179" y="383.0151">publish()</text><ellipse cx="170" cy="392.6094" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="46" x="179" y="395.8198">tls_set()</text><ellipse cx="170" cy="405.4141" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="112" x="179" y="408.6245">username_pw_set()</text><ellipse cx="170" cy="418.2188" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="65" x="179" y="421.4292">loop_start()</text><!--MD5=[f9c3b514e0aba6d6a3196a5f57c4f892]
|
|
reverse link Gateway to BleakScanner--><path d="M99.84,268.63 C91.52,293.08 83.53,316.57 77.3,334.87 " fill="none" id="Gateway<-BleakScanner" style="stroke: #A80036; stroke-width: 1.0;"/><polygon fill="#FFFFFF" points="104.08,256.18,98.3573,260.5676,100.2063,267.5376,105.929,263.15,104.08,256.18" style="stroke: #A80036; stroke-width: 1.0;"/><!--MD5=[4146429b5d3f8b857a7db7bec0318a68]
|
|
reverse link Gateway to MQTTClient--><path d="M192.83,268.93 C198.54,285.51 204.1,301.64 209.05,316 " fill="none" id="Gateway<-MQTTClient" style="stroke: #A80036; stroke-width: 1.0;"/><polygon fill="#FFFFFF" points="188.44,256.18,186.6152,263.1564,192.3531,267.5241,194.1779,260.5477,188.44,256.18" style="stroke: #A80036; stroke-width: 1.0;"/><!--MD5=[c5663ed99c2436235eb9a2b9543979fc]
|
|
@startuml
|
|
skinparam linestyle ortho
|
|
|
|
class Gateway {
|
|
- gateway_id: str
|
|
- mqtt_broker: str
|
|
- mqtt_port: int
|
|
- mqttc: MQTTClient
|
|
- -
|
|
+ EXPECTED_PAYLOAD_SIZE: 14
|
|
+ DEDUP_WINDOW_SECONDS: 10
|
|
+ INVALID_VALUE: 0xFFFFFFFF
|
|
- -
|
|
+ decode_payload(data: bytes): dict
|
|
+ publish(mac: str, data: dict)
|
|
+ is_duplicate(mac: str): bool
|
|
+ on_device_found(device, adv_data)
|
|
+ on_connect(...)
|
|
+ on_disconnect(...)
|
|
+ on_publish(...)
|
|
+ run()
|
|
}
|
|
|
|
class BleakScanner {
|
|
+ start()
|
|
+ stop()
|
|
}
|
|
|
|
class MQTTClient {
|
|
+ connect()
|
|
+ publish()
|
|
+ tls_set()
|
|
+ username_pw_set()
|
|
+ loop_start()
|
|
}
|
|
|
|
Gateway o- - BleakScanner
|
|
Gateway o- - MQTTClient
|
|
|
|
@enduml
|
|
|
|
PlantUML version 1.2020.02(Sun Mar 01 11:22:07 CET 2020)
|
|
(GPL source distribution)
|
|
Java Runtime: OpenJDK Runtime Environment
|
|
JVM: OpenJDK 64-Bit Server VM
|
|
Java Version: 21.0.11+10-1-deb13u2-Debian
|
|
Operating System: Linux
|
|
Default Encoding: UTF-8
|
|
Language: en
|
|
Country: GB
|
|
--></g></svg> |