52 lines
18 KiB
XML
52 lines
18 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="838px" preserveAspectRatio="none" style="width:618px;height:838px;" version="1.1" viewBox="0 0 618 838" width="618px" zoomAndPan="magnify"><defs><filter height="300%" id="f1ks68n52r4ekn" 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><rect fill="#FFFFFF" filter="url(#f1ks68n52r4ekn)" height="620.6563" style="stroke: #000000; stroke-width: 2.0;" width="399.5" x="147.5" y="143.8594"/><rect fill="#FFFFFF" height="561.3906" style="stroke: none; stroke-width: 1.0;" width="399.5" x="147.5" y="203.125"/><rect fill="#FFFFFF" filter="url(#f1ks68n52r4ekn)" height="503.2578" style="stroke: #000000; stroke-width: 2.0;" width="379.5" x="157.5" y="254.2578"/><rect fill="#FFFFFF" height="428.8594" style="stroke: none; stroke-width: 1.0;" width="379.5" x="157.5" y="328.6563"/><rect fill="#FFFFFF" filter="url(#f1ks68n52r4ekn)" height="370.7266" style="stroke: #000000; stroke-width: 2.0;" width="359.5" x="167.5" y="379.7891"/><rect fill="#FFFFFF" height="296.3281" style="stroke: none; stroke-width: 1.0;" width="359.5" x="167.5" y="454.1875"/><rect fill="#FFFFFF" filter="url(#f1ks68n52r4ekn)" height="74.3984" style="stroke: #000000; stroke-width: 2.0;" width="226" x="177.5" y="463.1875"/><rect fill="#FFFFFF" filter="url(#f1ks68n52r4ekn)" height="191.9297" style="stroke: #000000; stroke-width: 2.0;" width="339.5" x="177.5" y="551.5859"/><rect fill="#FFFFFF" height="117.5313" style="stroke: none; stroke-width: 1.0;" width="339.5" x="177.5" y="625.9844"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="75" x2="75" y1="54.5938" y2="781.5156"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="244.5" x2="244.5" y1="54.5938" y2="781.5156"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="452" x2="452" y1="54.5938" y2="781.5156"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="559" x2="559" y1="54.5938" y2="781.5156"/><rect fill="#FEFECE" filter="url(#f1ks68n52r4ekn)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="127" x="12" y="15.2969"/><rect fill="#FEFECE" filter="url(#f1ks68n52r4ekn)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="127" x="8" y="19.2969"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="113" x="15" y="39.292">BLE broadcaster</text><rect fill="#FEFECE" filter="url(#f1ks68n52r4ekn)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="127" x="12" y="780.5156"/><rect fill="#FEFECE" filter="url(#f1ks68n52r4ekn)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="127" x="8" y="784.5156"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="113" x="15" y="804.5107">BLE broadcaster</text><rect fill="#FEFECE" filter="url(#f1ks68n52r4ekn)" height="46.5938" style="stroke: #A80036; stroke-width: 1.5;" width="110" x="187.5" y="3"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="59" x="213" y="22.9951">Gateway</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="96" x="194.5" y="39.292">(Raspberry Pi)</text><rect fill="#FEFECE" filter="url(#f1ks68n52r4ekn)" height="46.5938" style="stroke: #A80036; stroke-width: 1.5;" width="110" x="187.5" y="780.5156"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="59" x="213" y="800.5107">Gateway</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="96" x="194.5" y="816.8076">(Raspberry Pi)</text><rect fill="#FEFECE" filter="url(#f1ks68n52r4ekn)" height="46.5938" style="stroke: #A80036; stroke-width: 1.5;" width="105" x="398" y="3"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="91" x="405" y="22.9951">MQTT Broker</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="77" x="412" y="39.292">(RabbitMQ)</text><rect fill="#FEFECE" filter="url(#f1ks68n52r4ekn)" height="46.5938" style="stroke: #A80036; stroke-width: 1.5;" width="105" x="398" y="780.5156"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="91" x="405" y="800.5107">MQTT Broker</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="77" x="412" y="816.8076">(RabbitMQ)</text><rect fill="#FEFECE" filter="url(#f1ks68n52r4ekn)" height="46.5938" style="stroke: #A80036; stroke-width: 1.5;" width="80" x="517" y="3"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="66" x="524" y="22.9951">Database</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="66" x="524" y="39.292">(InfluxDB)</text><rect fill="#FEFECE" filter="url(#f1ks68n52r4ekn)" height="46.5938" style="stroke: #A80036; stroke-width: 1.5;" width="80" x="517" y="780.5156"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="66" x="524" y="800.5107">Database</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="66" x="524" y="816.8076">(InfluxDB)</text><rect fill="#EEEEEE" filter="url(#f1ks68n52r4ekn)" height="3" style="stroke: #EEEEEE; stroke-width: 1.0;" width="603" x="3" y="85.1602"/><line style="stroke: #000000; stroke-width: 1.0;" x1="3" x2="606" y1="85.1602" y2="85.1602"/><line style="stroke: #000000; stroke-width: 1.0;" x1="3" x2="606" y1="88.1602" y2="88.1602"/><rect fill="#EEEEEE" filter="url(#f1ks68n52r4ekn)" height="23.1328" style="stroke: #000000; stroke-width: 2.0;" width="129" x="240" y="74.5938"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="110" x="246" y="90.6606">Data collection</text><polygon fill="#A80036" points="232.5,124.8594,242.5,128.8594,232.5,132.8594,236.5,128.8594" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="75.5" x2="238.5" y1="128.8594" y2="128.8594"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="145" x="87.5" y="123.7935">BLE advertising packet</text><path d="M147.5,143.8594 L211.5,143.8594 L211.5,150.8594 L201.5,160.8594 L147.5,160.8594 L147.5,143.8594 " fill="#EEEEEE" style="stroke: #000000; stroke-width: 1.0;"/><rect fill="none" height="620.6563" style="stroke: #000000; stroke-width: 2.0;" width="399.5" x="147.5" y="143.8594"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="19" x="162.5" y="156.9263">alt</text><text fill="#000000" font-family="sans-serif" font-size="11" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="142" x="226.5" y="156.0698">[company_id != 0xffff]</text><line style="stroke: #A80036; stroke-width: 1.0;" x1="244.5" x2="286.5" y1="182.125" y2="182.125"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="286.5" x2="286.5" y1="182.125" y2="195.125"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="245.5" x2="286.5" y1="195.125" y2="195.125"/><polygon fill="#A80036" points="255.5,191.125,245.5,195.125,255.5,199.125,251.5,195.125" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="93" x="251.5" y="177.0591">discard packet</text><line style="stroke: #000000; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="147.5" x2="547" y1="204.125" y2="204.125"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="244.5" x2="286.5" y1="226.2578" y2="226.2578"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="286.5" x2="286.5" y1="226.2578" y2="239.2578"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="245.5" x2="286.5" y1="239.2578" y2="239.2578"/><polygon fill="#A80036" points="255.5,235.2578,245.5,239.2578,255.5,243.2578,251.5,239.2578" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="120" x="251.5" y="221.1919">check payload size</text><path d="M157.5,254.2578 L221.5,254.2578 L221.5,261.2578 L211.5,271.2578 L157.5,271.2578 L157.5,254.2578 " fill="#EEEEEE" style="stroke: #000000; stroke-width: 1.0;"/><rect fill="none" height="503.2578" style="stroke: #000000; stroke-width: 2.0;" width="379.5" x="157.5" y="254.2578"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="19" x="172.5" y="267.3247">alt</text><text fill="#000000" font-family="sans-serif" font-size="11" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="168" x="236.5" y="266.4683">[payload size != 14 bytes]</text><line style="stroke: #A80036; stroke-width: 1.0;" x1="244.5" x2="286.5" y1="307.6563" y2="307.6563"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="286.5" x2="286.5" y1="307.6563" y2="320.6563"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="245.5" x2="286.5" y1="320.6563" y2="320.6563"/><polygon fill="#A80036" points="255.5,316.6563,245.5,320.6563,255.5,324.6563,251.5,320.6563" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="93" x="251.5" y="287.4575">discard packet</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="125" x="251.5" y="302.5903">(non-Thingy device)</text><line style="stroke: #000000; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="157.5" x2="537" y1="329.6563" y2="329.6563"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="244.5" x2="286.5" y1="351.7891" y2="351.7891"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="286.5" x2="286.5" y1="351.7891" y2="364.7891"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="245.5" x2="286.5" y1="364.7891" y2="364.7891"/><polygon fill="#A80036" points="255.5,360.7891,245.5,364.7891,255.5,368.7891,251.5,364.7891" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="114" x="251.5" y="346.7231">decode_payload()</text><path d="M167.5,379.7891 L231.5,379.7891 L231.5,386.7891 L221.5,396.7891 L167.5,396.7891 L167.5,379.7891 " fill="#EEEEEE" style="stroke: #000000; stroke-width: 1.0;"/><rect fill="none" height="370.7266" style="stroke: #000000; stroke-width: 2.0;" width="359.5" x="167.5" y="379.7891"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="19" x="182.5" y="392.856">alt</text><text fill="#000000" font-family="sans-serif" font-size="11" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="165" x="246.5" y="391.9995">[unknown key in payload]</text><line style="stroke: #A80036; stroke-width: 1.0;" x1="244.5" x2="286.5" y1="433.1875" y2="433.1875"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="286.5" x2="286.5" y1="433.1875" y2="446.1875"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="245.5" x2="286.5" y1="446.1875" y2="446.1875"/><polygon fill="#A80036" points="255.5,442.1875,245.5,446.1875,255.5,450.1875,251.5,446.1875" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="93" x="251.5" y="412.9888">discard packet</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="63" x="251.5" y="428.1216">log debug</text><line style="stroke: #000000; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="167.5" x2="527" y1="455.1875" y2="455.1875"/><path d="M177.5,463.1875 L241.5,463.1875 L241.5,470.1875 L231.5,480.1875 L177.5,480.1875 L177.5,463.1875 " fill="#EEEEEE" style="stroke: #000000; stroke-width: 1.0;"/><rect fill="none" height="74.3984" style="stroke: #000000; stroke-width: 2.0;" width="226" x="177.5" y="463.1875"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="19" x="192.5" y="476.2544">alt</text><text fill="#000000" font-family="sans-serif" font-size="11" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="142" x="256.5" y="475.3979">[CO2 == 0xFFFFFFFF]</text><line style="stroke: #A80036; stroke-width: 1.0;" x1="244.5" x2="286.5" y1="516.5859" y2="516.5859"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="286.5" x2="286.5" y1="516.5859" y2="529.5859"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="245.5" x2="286.5" y1="529.5859" y2="529.5859"/><polygon fill="#A80036" points="255.5,525.5859,245.5,529.5859,255.5,533.5859,251.5,529.5859" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="115" x="251.5" y="496.3872">discard CO2 value</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="118" x="251.5" y="511.52">(sensor not ready)</text><path d="M177.5,551.5859 L241.5,551.5859 L241.5,558.5859 L231.5,568.5859 L177.5,568.5859 L177.5,551.5859 " fill="#EEEEEE" style="stroke: #000000; stroke-width: 1.0;"/><rect fill="none" height="191.9297" style="stroke: #000000; stroke-width: 2.0;" width="339.5" x="177.5" y="551.5859"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="19" x="192.5" y="564.6528">alt</text><text fill="#000000" font-family="sans-serif" font-size="11" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="191" x="256.5" y="563.7964">[duplicate within 10 seconds]</text><line style="stroke: #A80036; stroke-width: 1.0;" x1="244.5" x2="286.5" y1="604.9844" y2="604.9844"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="286.5" x2="286.5" y1="604.9844" y2="617.9844"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="245.5" x2="286.5" y1="617.9844" y2="617.9844"/><polygon fill="#A80036" points="255.5,613.9844,245.5,617.9844,255.5,621.9844,251.5,617.9844" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="93" x="251.5" y="584.7856">discard packet</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="95" x="251.5" y="599.9185">(deduplication)</text><line style="stroke: #000000; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="177.5" x2="517" y1="626.9844" y2="626.9844"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="244.5" x2="286.5" y1="649.1172" y2="649.1172"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="286.5" x2="286.5" y1="649.1172" y2="662.1172"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="245.5" x2="286.5" y1="662.1172" y2="662.1172"/><polygon fill="#A80036" points="255.5,658.1172,245.5,662.1172,255.5,666.1172,251.5,662.1172" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="128" x="251.5" y="644.0513">add UTC timestamp</text><polygon fill="#A80036" points="440.5,702.3828,450.5,706.3828,440.5,710.3828,444.5,706.3828" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="244.5" x2="446.5" y1="706.3828" y2="706.3828"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="81" x="308" y="686.1841">publish JSON</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="184" x="256.5" y="701.3169">{gateway_id}/{mac}/update</text><polygon fill="#A80036" points="255.5,731.5156,245.5,735.5156,255.5,739.5156,251.5,735.5156" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" x1="249.5" x2="451.5" y1="735.5156" y2="735.5156"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="136" x="280.5" y="730.4497">on_publish confirmed</text><!--MD5=[7ac3e8c31e8c0c09b3f8c38a63a2bca7]
|
|
@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 company_id != 0xffff
|
|
gw -> gw : discard packet
|
|
else
|
|
gw -> gw : check payload size
|
|
|
|
alt payload size != 14 bytes
|
|
gw -> gw : discard packet\n(non-Thingy device)
|
|
else
|
|
gw -> gw : decode_payload()
|
|
|
|
alt unknown key in payload
|
|
gw -> gw : discard packet\nlog debug
|
|
else
|
|
alt CO2 == 0xFFFFFFFF
|
|
gw -> gw : discard CO2 value\n(sensor not ready)
|
|
end
|
|
|
|
alt duplicate within 10 seconds
|
|
gw -> gw : discard packet\n(deduplication)
|
|
else
|
|
gw -> gw : add UTC timestamp
|
|
gw -> broker : publish JSON\n{gateway_id}/{mac}/update
|
|
broker - -> gw : on_publish confirmed
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
@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> |