use ProtocolIfc class

This commit is contained in:
Stefan Allius
2024-10-05 21:11:42 +02:00
parent c7d0a91371
commit 9852f44dfa
7 changed files with 108 additions and 154 deletions

View File

@@ -119,19 +119,19 @@
<!-- A6 -->
<g id="node7" class="node">
<title>A6</title>
<polygon fill="none" stroke="#000000" points="356.5,-236 356.5,-268 468.5,-268 468.5,-236 356.5,-236"/>
<text text-anchor="start" x="389.9995" y="-249" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">StreamPtr</text>
<polygon fill="none" stroke="#000000" points="356.5,-216 356.5,-236 468.5,-236 468.5,-216 356.5,-216"/>
<polygon fill="none" stroke="#000000" points="356.5,-172 356.5,-216 468.5,-216 468.5,-172 356.5,-172"/>
<text text-anchor="start" x="366.3825" y="-197" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">stream:MessageProt</text>
<text text-anchor="start" x="387.2185" y="-185" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">ifc:AsyncIfc</text>
<polygon fill="none" stroke="#000000" points="356.5,-236 356.5,-268 456.5,-268 456.5,-236 356.5,-236"/>
<text text-anchor="start" x="383.9995" y="-249" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">StreamPtr</text>
<polygon fill="none" stroke="#000000" points="356.5,-216 356.5,-236 456.5,-236 456.5,-216 356.5,-216"/>
<polygon fill="none" stroke="#000000" points="356.5,-172 356.5,-216 456.5,-216 456.5,-172 356.5,-172"/>
<text text-anchor="start" x="366.2175" y="-197" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">stream:ProtocolIfc</text>
<text text-anchor="start" x="381.2185" y="-185" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">ifc:AsyncIfc</text>
</g>
<!-- A5&#45;&gt;A6 -->
<g id="edge8" class="edge">
<title>A5&#45;&gt;A6</title>
<path fill="none" stroke="#000000" d="M359.288,-317.872C366.9377,-303.802 374.5179,-289.86 381.4556,-277.0995"/>
<polygon fill="#000000" stroke="#000000" points="386.3856,-268.0318 385.5625,-278.9667 383.9973,-272.4245 381.609,-276.8173 381.609,-276.8173 381.609,-276.8173 383.9973,-272.4245 377.6556,-274.6678 386.3856,-268.0318 386.3856,-268.0318"/>
<text text-anchor="middle" x="385.1534" y="-284.9938" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">2</text>
<path fill="none" stroke="#000000" d="M356.1387,-317.872C363.3786,-303.802 370.5526,-289.86 377.1187,-277.0995"/>
<polygon fill="#000000" stroke="#000000" points="381.7846,-268.0318 381.2105,-278.9826 379.4969,-272.4777 377.2091,-276.9237 377.2091,-276.9237 377.2091,-276.9237 379.4969,-272.4777 373.2078,-274.8647 381.7846,-268.0318 381.7846,-268.0318"/>
<text text-anchor="middle" x="381.0069" y="-285.0166" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">2</text>
</g>
<!-- A7 -->
<g id="node8" class="node">
@@ -160,44 +160,44 @@
<!-- A11 -->
<g id="node12" class="node">
<title>A11</title>
<polygon fill="none" stroke="#000000" points="456.1421,-36 366.8579,-36 366.8579,0 456.1421,0 456.1421,-36"/>
<text text-anchor="middle" x="411.5" y="-15" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">&lt;&lt;AsyncIfc&gt;&gt;</text>
<polygon fill="none" stroke="#000000" points="450.1421,-36 360.8579,-36 360.8579,0 450.1421,0 450.1421,-36"/>
<text text-anchor="middle" x="405.5" y="-15" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">&lt;&lt;AsyncIfc&gt;&gt;</text>
</g>
<!-- A6&#45;&gt;A11 -->
<g id="edge11" class="edge">
<title>A6&#45;&gt;A11</title>
<path fill="none" stroke="#000000" d="M396.5836,-171.9861C390.0675,-146.4721 384.9947,-114.5619 389.5,-86 391.6448,-72.403 396.0621,-57.8206 400.3796,-45.6603"/>
<polygon fill="#000000" stroke="#000000" points="403.9307,-36.0902 404.6707,-47.0311 402.1913,-40.7779 400.4518,-45.4656 400.4518,-45.4656 400.4518,-45.4656 402.1913,-40.7779 396.2329,-43.9001 403.9307,-36.0902 403.9307,-36.0902"/>
<text text-anchor="middle" x="405.5493" y="-53.0246" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">1</text>
<path fill="none" stroke="#000000" d="M392.6633,-171.974C386.9982,-146.4565 382.5868,-114.547 386.5,-86 388.3468,-72.5276 392.161,-57.9618 395.8907,-45.7804"/>
<polygon fill="#000000" stroke="#000000" points="398.9587,-36.1851 400.1994,-47.0805 397.4359,-40.9476 395.9131,-45.71 395.9131,-45.71 395.9131,-45.71 397.4359,-40.9476 391.6269,-44.3395 398.9587,-36.1851 398.9587,-36.1851"/>
<text text-anchor="middle" x="401.4892" y="-53.0243" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">1</text>
</g>
<!-- A12 -->
<g id="node13" class="node">
<title>A12</title>
<polygon fill="none" stroke="#000000" points="508.7573,-122 398.2427,-122 398.2427,-86 508.7573,-86 508.7573,-122"/>
<text text-anchor="middle" x="453.5" y="-101" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">&lt;&lt;MessageProt&gt;&gt;</text>
<polygon fill="none" stroke="#000000" points="493.5879,-122 395.4121,-122 395.4121,-86 493.5879,-86 493.5879,-122"/>
<text text-anchor="middle" x="444.5" y="-101" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">&lt;&lt;ProtocolIfc&gt;&gt;</text>
</g>
<!-- A6&#45;&gt;A12 -->
<g id="edge10" class="edge">
<title>A6&#45;&gt;A12</title>
<path fill="none" stroke="#000000" d="M429.5315,-171.8133C434.3787,-158.0994 439.4923,-143.6315 443.7456,-131.5978"/>
<polygon fill="#000000" stroke="#000000" points="447.0913,-122.132 448.0016,-133.06 445.425,-126.8462 443.7588,-131.5604 443.7588,-131.5604 443.7588,-131.5604 445.425,-126.8462 439.516,-130.0607 447.0913,-122.132 447.0913,-122.132"/>
<text text-anchor="middle" x="449.0201" y="-139.0387" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">1</text>
<path fill="none" stroke="#000000" d="M422.2853,-171.8133C426.7329,-158.2365 431.4225,-143.9208 435.3408,-131.9595"/>
<polygon fill="#000000" stroke="#000000" points="438.5602,-122.132 439.7235,-133.036 437.0036,-126.8835 435.4471,-131.6351 435.4471,-131.6351 435.4471,-131.6351 437.0036,-126.8835 431.1707,-130.2341 438.5602,-122.132 438.5602,-122.132"/>
<text text-anchor="middle" x="440.9498" y="-138.9887" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">1</text>
</g>
<!-- A8 -->
<g id="node9" class="node">
<title>A8</title>
<polygon fill="#fff8dc" stroke="#000000" points="586.906,-248 486.094,-248 486.094,-192 592.906,-192 592.906,-242 586.906,-248"/>
<polyline fill="none" stroke="#000000" points="586.906,-248 586.906,-242 "/>
<polyline fill="none" stroke="#000000" points="592.906,-242 586.906,-242 "/>
<text text-anchor="middle" x="539.5" y="-235" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">Creates an GEN3</text>
<text text-anchor="middle" x="539.5" y="-223" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">inverter instance</text>
<text text-anchor="middle" x="539.5" y="-211" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">with</text>
<text text-anchor="middle" x="539.5" y="-199" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">prot_class:Talent</text>
<polygon fill="#fff8dc" stroke="#000000" points="574.906,-248 474.094,-248 474.094,-192 580.906,-192 580.906,-242 574.906,-248"/>
<polyline fill="none" stroke="#000000" points="574.906,-248 574.906,-242 "/>
<polyline fill="none" stroke="#000000" points="580.906,-242 574.906,-242 "/>
<text text-anchor="middle" x="527.5" y="-235" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">Creates an GEN3</text>
<text text-anchor="middle" x="527.5" y="-223" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">inverter instance</text>
<text text-anchor="middle" x="527.5" y="-211" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">with</text>
<text text-anchor="middle" x="527.5" y="-199" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">prot_class:Talent</text>
</g>
<!-- A7&#45;&gt;A8 -->
<g id="edge3" class="edge">
<title>A7&#45;&gt;A8</title>
<path fill="none" stroke="#000000" stroke-dasharray="5,2" d="M308.5491,-238.3283C317.4345,-256.0056 333.5793,-281.6949 356.5,-293 401.1429,-315.019 422.6447,-312.368 468.5,-293 490.1607,-283.8511 508.4784,-264.5049 521.0802,-248.0264"/>
<path fill="none" stroke="#000000" stroke-dasharray="5,2" d="M308.5491,-238.3283C317.4345,-256.0056 333.5793,-281.6949 356.5,-293 396.3598,-312.6598 415.5578,-310.2929 456.5,-293 478.1607,-283.8511 496.4784,-264.5049 509.0802,-248.0264"/>
</g>
<!-- A10 -->
<g id="node11" class="node">
@@ -218,9 +218,9 @@
<!-- A12&#45;&gt;A11 -->
<g id="edge12" class="edge">
<title>A12&#45;&gt;A11</title>
<path fill="none" stroke="#000000" stroke-dasharray="5,2" d="M444.5929,-85.7616C438.8574,-74.0176 431.2964,-58.5355 424.8496,-45.3349"/>
<polygon fill="#000000" stroke="#000000" points="420.3943,-36.2121 428.8262,-43.223 422.5885,-40.7049 424.7827,-45.1978 424.7827,-45.1978 424.7827,-45.1978 422.5885,-40.7049 420.7391,-47.1726 420.3943,-36.2121 420.3943,-36.2121"/>
<text text-anchor="middle" x="429.0435" y="-70.1832" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">use</text>
<path fill="none" stroke="#000000" stroke-dasharray="5,2" d="M436.2291,-85.7616C430.9033,-74.0176 423.8824,-58.5355 417.896,-45.3349"/>
<polygon fill="#000000" stroke="#000000" points="413.759,-36.2121 421.9874,-43.4608 415.824,-40.7657 417.8891,-45.3194 417.8891,-45.3194 417.8891,-45.3194 415.824,-40.7657 413.7908,-47.1779 413.759,-36.2121 413.759,-36.2121"/>
<text text-anchor="middle" x="421.0451" y="-69.7445" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">use</text>
</g>
<!-- A13 -->
<g id="node14" class="node">

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -11,7 +11,7 @@
[<<InverterIfc>>||healthy()->bool;<async>disc(shutdown_started=False);<async>create_remote();]
[<<AbstractIterMeta>>]^-.-[<<InverterIfc>>]
[InverterBase|_registry;__ha_restarts;;addr;config_id:str;prot_class:MessageProt;remote:StreamPtr;local:StreamPtr;|healthy()->bool;<async>disc(shutdown_started=False);<async>create_remote();<async>async_publ_mqtt()]
[StreamPtr||stream:MessageProt;ifc:AsyncIfc]
[StreamPtr||stream:ProtocolIfc;ifc:AsyncIfc]
[<<InverterIfc>>]^-.-[InverterBase]
[InverterG3]-[note: Creates an GEN3 inverter instance with prot_class:Talent{bg:cornsilk}]
[InverterG3P]-[note: Creates an GEN3PLUS inverter instance with prot_class:SolarmanV5{bg:cornsilk}]
@@ -24,11 +24,11 @@
[<<AsyncIfc>>]
[StreamPtr]-1>[<<MessageProt>>]
[StreamPtr]-1>[<<ProtocolIfc>>]
[StreamPtr]-1>[<<AsyncIfc>>]
[<<MessageProt>>]use-.->[<<AsyncIfc>>]
[<<ProtocolIfc>>]use-.->[<<AsyncIfc>>]
[ModbusConn|host;port;addr;stream:InverterG3P;|]has-1>[InverterG3P]

View File

@@ -4,11 +4,11 @@
<!-- Generated by graphviz version 2.40.1 (20161225.0304)
-->
<!-- Title: G Pages: 1 -->
<svg width="438pt" height="1820pt"
viewBox="0.00 0.00 438.35 1820.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<svg width="446pt" height="1820pt"
viewBox="0.00 0.00 446.35 1820.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 1816)">
<title>G</title>
<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-1816 434.348,-1816 434.348,4 -4,4"/>
<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-1816 442.348,-1816 442.348,4 -4,4"/>
<!-- A0 -->
<g id="node1" class="node">
<title>A0</title>
@@ -47,81 +47,81 @@
<!-- A2 -->
<g id="node3" class="node">
<title>A2</title>
<polygon fill="none" stroke="#000000" points="308.348,-584 308.348,-616 430.348,-616 430.348,-584 308.348,-584"/>
<text text-anchor="start" x="345.7325" y="-597" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">InverterG3</text>
<polygon fill="none" stroke="#000000" points="308.348,-528 308.348,-584 430.348,-584 430.348,-528 308.348,-528"/>
<text text-anchor="start" x="359.345" y="-565" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">addr</text>
<text text-anchor="start" x="329.901" y="-553" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">remote:StreamPtr</text>
<text text-anchor="start" x="335.18" y="-541" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">local:StreamPtr</text>
<polygon fill="none" stroke="#000000" points="308.348,-472 308.348,-528 430.348,-528 430.348,-472 308.348,-472"/>
<text text-anchor="start" x="317.9515" y="-509" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">create_remote()</text>
<text text-anchor="start" x="354.3505" y="-485" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">close()</text>
<polygon fill="none" stroke="#000000" points="340.348,-584 340.348,-616 438.348,-616 438.348,-584 340.348,-584"/>
<text text-anchor="start" x="365.7325" y="-597" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">InverterG3</text>
<polygon fill="none" stroke="#000000" points="340.348,-528 340.348,-584 438.348,-584 438.348,-528 340.348,-528"/>
<text text-anchor="start" x="379.345" y="-565" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">addr</text>
<text text-anchor="start" x="349.901" y="-553" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">remote:StreamPtr</text>
<text text-anchor="start" x="355.18" y="-541" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">local:StreamPtr</text>
<polygon fill="none" stroke="#000000" points="340.348,-472 340.348,-528 438.348,-528 438.348,-472 340.348,-472"/>
<text text-anchor="start" x="353.79" y="-509" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">create_remote()</text>
<text text-anchor="start" x="374.3505" y="-485" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">close()</text>
</g>
<!-- A7 -->
<g id="node8" class="node">
<title>A7</title>
<polygon fill="none" stroke="#000000" points="12.348,-100 12.348,-132 190.348,-132 190.348,-100 12.348,-100"/>
<text text-anchor="start" x="56.8995" y="-113" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">AsyncStreamServer</text>
<polygon fill="none" stroke="#000000" points="12.348,-68 12.348,-100 190.348,-100 190.348,-68 12.348,-68"/>
<text text-anchor="start" x="53.2805" y="-81" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">create_remote</text>
<polygon fill="none" stroke="#000000" points="12.348,0 12.348,-68 190.348,-68 190.348,0 12.348,0"/>
<text text-anchor="start" x="53.0055" y="-49" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">&lt;async&gt;server_loop()</text>
<text text-anchor="start" x="43.8365" y="-37" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">&lt;async&gt;_async_forward()</text>
<text text-anchor="start" x="22.157" y="-25" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">&lt;async&gt;publish_outstanding_mqtt()</text>
<text text-anchor="start" x="86.3505" y="-13" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">close()</text>
<polygon fill="none" stroke="#000000" points="7.348,-100 7.348,-132 185.348,-132 185.348,-100 7.348,-100"/>
<text text-anchor="start" x="51.8995" y="-113" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">AsyncStreamServer</text>
<polygon fill="none" stroke="#000000" points="7.348,-68 7.348,-100 185.348,-100 185.348,-68 7.348,-68"/>
<text text-anchor="start" x="64.119" y="-81" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">create_remote</text>
<polygon fill="none" stroke="#000000" points="7.348,0 7.348,-68 185.348,-68 185.348,0 7.348,0"/>
<text text-anchor="start" x="48.0055" y="-49" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">&lt;async&gt;server_loop()</text>
<text text-anchor="start" x="38.8365" y="-37" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">&lt;async&gt;_async_forward()</text>
<text text-anchor="start" x="17.157" y="-25" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">&lt;async&gt;publish_outstanding_mqtt()</text>
<text text-anchor="start" x="81.3505" y="-13" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">close()</text>
</g>
<!-- A2&#45;&gt;A7 -->
<g id="edge8" class="edge">
<title>A2&#45;&gt;A7</title>
<path fill="none" stroke="#000000" d="M337.3924,-460.3836C333.0399,-447.6226 328.8668,-434.5306 325.348,-422 295.9146,-317.1872 337.6516,-271.9662 276.348,-182 253.3709,-148.28 233.3826,-154.5085 199.348,-132 199.2571,-131.9399 199.1662,-131.8797 199.0752,-131.8196"/>
<polygon fill="#000000" stroke="#000000" points="337.4849,-460.65 343.2337,-465.0033 341.4263,-471.9842 335.6775,-467.6309 337.4849,-460.65"/>
<polygon fill="#000000" stroke="#000000" points="190.5035,-126.1357 201.3247,-127.9118 194.6706,-128.899 198.8378,-131.6622 198.8378,-131.6622 198.8378,-131.6622 194.6706,-128.899 196.3509,-135.4126 190.5035,-126.1357 190.5035,-126.1357"/>
<text text-anchor="middle" x="327.4894" y="-454.6398" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">local</text>
<path fill="none" stroke="#000000" d="M355.1669,-460.7015C350.2935,-447.8271 345.5247,-434.6178 341.348,-422 306.6206,-317.0888 342.6855,-270.3837 276.348,-182 250.7246,-147.8611 230.2817,-155.039 194.348,-132 194.2563,-131.9412 194.1645,-131.8823 194.0727,-131.8234"/>
<polygon fill="#000000" stroke="#000000" points="355.1669,-460.7018 361.0503,-464.8714 359.4643,-471.9059 353.5809,-467.7363 355.1669,-460.7018"/>
<polygon fill="#000000" stroke="#000000" points="185.433,-126.2441 196.2748,-127.8888 189.6333,-128.9566 193.8336,-131.6691 193.8336,-131.6691 193.8336,-131.6691 189.6333,-128.9566 191.3923,-135.4493 185.433,-126.2441 185.433,-126.2441"/>
<text text-anchor="middle" x="345.0813" y="-455.0087" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">local</text>
</g>
<!-- A8 -->
<g id="node9" class="node">
<title>A8</title>
<polygon fill="none" stroke="#000000" points="208.348,-82 208.348,-114 346.348,-114 346.348,-82 208.348,-82"/>
<text text-anchor="start" x="234.845" y="-95" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">AsyncStreamClient</text>
<polygon fill="none" stroke="#000000" points="208.348,-62 208.348,-82 346.348,-82 346.348,-62 208.348,-62"/>
<polygon fill="none" stroke="#000000" points="208.348,-18 208.348,-62 346.348,-62 346.348,-18 208.348,-18"/>
<text text-anchor="start" x="231.226" y="-43" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">&lt;async&gt;client_loop()</text>
<text text-anchor="start" x="218.172" y="-31" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">&lt;async&gt;_async_forward())</text>
<polygon fill="none" stroke="#000000" points="203.348,-82 203.348,-114 341.348,-114 341.348,-82 203.348,-82"/>
<text text-anchor="start" x="229.845" y="-95" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">AsyncStreamClient</text>
<polygon fill="none" stroke="#000000" points="203.348,-62 203.348,-82 341.348,-82 341.348,-62 203.348,-62"/>
<polygon fill="none" stroke="#000000" points="203.348,-18 203.348,-62 341.348,-62 341.348,-18 203.348,-18"/>
<text text-anchor="start" x="226.226" y="-43" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">&lt;async&gt;client_loop()</text>
<text text-anchor="start" x="213.172" y="-31" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">&lt;async&gt;_async_forward())</text>
</g>
<!-- A2&#45;&gt;A8 -->
<g id="edge6" class="edge">
<title>A2&#45;&gt;A8</title>
<path fill="none" stroke="#000000" d="M366.3359,-471.8318C361.9206,-397.9861 351.1813,-280.4371 325.348,-182 320.2128,-162.4325 312.4912,-141.8047 304.7338,-123.458"/>
<polygon fill="#000000" stroke="#000000" points="300.6874,-114.0894 308.7837,-121.4854 302.67,-118.6796 304.6526,-123.2698 304.6526,-123.2698 304.6526,-123.2698 302.67,-118.6796 300.5214,-125.0541 300.6874,-114.0894 300.6874,-114.0894"/>
<text text-anchor="middle" x="315.6341" y="-124.3784" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">remote</text>
<path fill="none" stroke="#000000" d="M388.2845,-471.9734C385.2471,-397.4776 374.9339,-278.7213 341.348,-182 334.28,-161.6455 323.3872,-140.9471 312.3293,-122.7781"/>
<polygon fill="#000000" stroke="#000000" points="306.9036,-114.0745 316.0125,-120.18 309.5487,-118.3175 312.1938,-122.5606 312.1938,-122.5606 312.1938,-122.5606 309.5487,-118.3175 308.375,-124.9412 306.9036,-114.0745 306.9036,-114.0745"/>
<text text-anchor="middle" x="323.6654" y="-121.9851" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">remote</text>
</g>
<!-- A3 -->
<g id="node4" class="node">
<title>A3</title>
<polygon fill="none" stroke="#000000" points=".348,-342 .348,-374 122.348,-374 122.348,-342 .348,-342"/>
<text text-anchor="start" x="34.398" y="-355" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">InverterG3P</text>
<polygon fill="none" stroke="#000000" points=".348,-286 .348,-342 122.348,-342 122.348,-286 .348,-286"/>
<text text-anchor="start" x="51.345" y="-323" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">addr</text>
<text text-anchor="start" x="21.901" y="-311" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">remote:StreamPtr</text>
<text text-anchor="start" x="27.18" y="-299" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">local:StreamPtr</text>
<polygon fill="none" stroke="#000000" points=".348,-230 .348,-286 122.348,-286 122.348,-230 .348,-230"/>
<text text-anchor="start" x="9.9515" y="-267" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">create_remote()</text>
<text text-anchor="start" x="46.3505" y="-243" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">close()</text>
<polygon fill="none" stroke="#000000" points="18.348,-342 18.348,-374 116.348,-374 116.348,-342 18.348,-342"/>
<text text-anchor="start" x="40.398" y="-355" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">InverterG3P</text>
<polygon fill="none" stroke="#000000" points="18.348,-286 18.348,-342 116.348,-342 116.348,-286 18.348,-286"/>
<text text-anchor="start" x="57.345" y="-323" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">addr</text>
<text text-anchor="start" x="27.901" y="-311" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">remote:StreamPtr</text>
<text text-anchor="start" x="33.18" y="-299" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">local:StreamPtr</text>
<polygon fill="none" stroke="#000000" points="18.348,-230 18.348,-286 116.348,-286 116.348,-230 18.348,-230"/>
<text text-anchor="start" x="31.79" y="-267" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">create_remote()</text>
<text text-anchor="start" x="52.3505" y="-243" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">close()</text>
</g>
<!-- A3&#45;&gt;A7 -->
<g id="edge12" class="edge">
<title>A3&#45;&gt;A7</title>
<path fill="none" stroke="#000000" d="M75.5849,-218.0021C79.7918,-193.1818 84.3705,-166.167 88.4854,-141.8895"/>
<polygon fill="#000000" stroke="#000000" points="75.572,-218.0786 78.5131,-224.6627 73.5667,-229.9099 70.6256,-223.3258 75.572,-218.0786"/>
<polygon fill="#000000" stroke="#000000" points="90.1576,-132.0235 92.9231,-142.6349 89.322,-136.9532 88.4864,-141.8829 88.4864,-141.8829 88.4864,-141.8829 89.322,-136.9532 84.0497,-141.1309 90.1576,-132.0235 90.1576,-132.0235"/>
<text text-anchor="middle" x="68.2622" y="-207.6261" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">local</text>
<path fill="none" stroke="#000000" d="M77.7163,-217.6237C80.7418,-193.0021 84.0292,-166.2494 86.9885,-142.1671"/>
<polygon fill="#000000" stroke="#000000" points="77.6702,-217.9995 80.9085,-224.4425 76.2065,-229.9099 72.9682,-223.4668 77.6702,-217.9995"/>
<polygon fill="#000000" stroke="#000000" points="88.2349,-132.0235 91.4816,-142.4978 87.6251,-136.9862 87.0152,-141.9489 87.0152,-141.9489 87.0152,-141.9489 87.6251,-136.9862 82.5488,-141.4 88.2349,-132.0235 88.2349,-132.0235"/>
<text text-anchor="middle" x="70.028" y="-207.8882" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">local</text>
</g>
<!-- A3&#45;&gt;A8 -->
<g id="edge10" class="edge">
<title>A3&#45;&gt;A8</title>
<path fill="none" stroke="#000000" d="M115.795,-229.9222C128.6843,-213.8036 142.6706,-197.0375 156.348,-182 175.0997,-161.3835 196.7546,-139.9587 216.5165,-121.2154"/>
<polygon fill="#000000" stroke="#000000" points="223.9878,-114.1704 219.7994,-124.3049 220.35,-117.6006 216.7122,-121.0309 216.7122,-121.0309 216.7122,-121.0309 220.35,-117.6006 213.625,-117.7568 223.9878,-114.1704 223.9878,-114.1704"/>
<text text-anchor="middle" x="216.5987" y="-129.7553" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">remote</text>
<path fill="none" stroke="#000000" d="M116.4873,-232.1115C129.0204,-215.3231 142.7944,-197.7122 156.348,-182 174.1632,-161.3474 194.8826,-139.9135 213.8403,-121.173"/>
<polygon fill="#000000" stroke="#000000" points="221.01,-114.1296 217.0299,-124.3477 217.4432,-117.6336 213.8763,-121.1375 213.8763,-121.1375 213.8763,-121.1375 217.4432,-117.6336 210.7227,-117.9274 221.01,-114.1296 221.01,-114.1296"/>
<text text-anchor="middle" x="214.0028" y="-129.8619" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">remote</text>
</g>
<!-- A4 -->
<g id="node5" class="node">
@@ -199,14 +199,14 @@
<!-- A6&#45;&gt;A7 -->
<g id="edge3" class="edge">
<title>A6&#45;&gt;A7</title>
<path fill="none" stroke="#000000" d="M160.8205,-188.0478C151.5043,-168.9294 142.1189,-149.6691 133.6443,-132.2776"/>
<polygon fill="none" stroke="#000000" points="157.7107,-189.6563 165.2376,-197.1126 164.0034,-186.5899 157.7107,-189.6563"/>
<path fill="none" stroke="#000000" d="M160.6502,-192.461C150.1789,-171.8674 139.5319,-150.9284 129.9938,-132.1701"/>
<polygon fill="none" stroke="#000000" points="157.6308,-194.2451 165.2832,-201.5725 163.8705,-191.0723 157.6308,-194.2451"/>
</g>
<!-- A6&#45;&gt;A8 -->
<g id="edge4" class="edge">
<title>A6&#45;&gt;A8</title>
<path fill="none" stroke="#000000" d="M249.927,-172.088C255.2644,-151.438 260.4749,-131.2796 264.8954,-114.1772"/>
<polygon fill="none" stroke="#000000" points="246.498,-171.3682 247.3841,-181.9259 253.2753,-173.12 246.498,-171.3682"/>
<path fill="none" stroke="#000000" d="M247.1746,-172.088C252.0746,-151.438 256.8579,-131.2796 260.9161,-114.1772"/>
<polygon fill="none" stroke="#000000" points="243.7436,-171.3879 244.8402,-181.9259 250.5545,-173.0041 243.7436,-171.3879"/>
</g>
<!-- A9 -->
<g id="node10" class="node">
@@ -237,17 +237,17 @@
<!-- A9&#45;&gt;A2 -->
<g id="edge5" class="edge">
<title>A9&#45;&gt;A2</title>
<path fill="none" stroke="#000000" d="M356.4487,-1053.6998C358.0019,-1040.2968 359.3489,-1026.94 360.348,-1014 371.1987,-873.4591 367.4052,-708.5736 366.556,-616.1962"/>
<polygon fill="#000000" stroke="#000000" points="355.2231,-1063.9519 351.942,-1053.4885 355.8166,-1058.9873 356.4102,-1054.0226 356.4102,-1054.0226 356.4102,-1054.0226 355.8166,-1058.9873 360.8784,-1054.5568 355.2231,-1063.9519 355.2231,-1063.9519"/>
<text text-anchor="middle" x="348.982" y="-1041.9506" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">remote</text>
<path fill="none" stroke="#000000" d="M355.8388,-1053.6462C357.5291,-1040.2553 359.074,-1026.9158 360.348,-1014 374.197,-873.5946 378.4625,-708.6618 382.5377,-616.2392"/>
<polygon fill="#000000" stroke="#000000" points="354.52,-1063.8901 351.3338,-1053.3974 355.1585,-1058.9311 355.797,-1053.972 355.797,-1053.972 355.797,-1053.972 355.1585,-1058.9311 360.2601,-1054.5466 354.52,-1063.8901 354.52,-1063.8901"/>
<text text-anchor="middle" x="348.4513" y="-1041.8331" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">remote</text>
</g>
<!-- A9&#45;&gt;A2 -->
<g id="edge7" class="edge">
<title>A9&#45;&gt;A2</title>
<path fill="none" stroke="#000000" d="M374.3992,-1053.6998C376.0019,-1040.2968 377.3489,-1026.94 378.348,-1014 388.7431,-879.3607 385.698,-722.3785 379.8141,-628.21"/>
<polygon fill="#000000" stroke="#000000" points="373.1253,-1063.9519 369.8928,-1053.4733 373.7419,-1058.9901 374.3585,-1054.0283 374.3585,-1054.0283 374.3585,-1054.0283 373.7419,-1058.9901 378.8241,-1054.5832 373.1253,-1063.9519 373.1253,-1063.9519"/>
<polygon fill="#000000" stroke="#000000" points="379.8116,-628.1704 375.4269,-622.4455 379.0249,-616.1962 383.4097,-621.9211 379.8116,-628.1704"/>
<text text-anchor="middle" x="388.6473" y="-630.7293" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">local</text>
<path fill="none" stroke="#000000" d="M373.7894,-1053.6462C375.5291,-1040.2553 377.074,-1026.9158 378.348,-1014 391.6155,-879.4905 396.0874,-722.4703 395.1595,-628.2587"/>
<polygon fill="#000000" stroke="#000000" points="372.4223,-1063.8901 369.2847,-1053.3827 373.0837,-1058.9341 373.7452,-1053.978 373.7452,-1053.978 373.7452,-1053.978 373.0837,-1058.9341 378.2056,-1054.5733 372.4223,-1063.8901 372.4223,-1063.8901"/>
<polygon fill="#000000" stroke="#000000" points="395.1593,-628.2382 391.0833,-622.2896 395.0066,-616.2392 399.0827,-622.1878 395.1593,-628.2382"/>
<text text-anchor="middle" x="403.6888" y="-631.2564" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">local</text>
</g>
<!-- A9&#45;&gt;A4 -->
<g id="edge15" class="edge">
@@ -295,17 +295,17 @@
<!-- A10&#45;&gt;A3 -->
<g id="edge9" class="edge">
<title>A10&#45;&gt;A3</title>
<path fill="none" stroke="#000000" d="M63.2812,-1090.0398C59.4779,-1064.8912 56.2888,-1038.6862 54.348,-1014 36.0005,-780.6307 43.7035,-502.9057 52.599,-374.1544"/>
<polygon fill="#000000" stroke="#000000" points="64.8268,-1099.9929 58.8455,-1090.8019 64.0595,-1095.0521 63.2922,-1090.1113 63.2922,-1090.1113 63.2922,-1090.1113 64.0595,-1095.0521 67.7389,-1089.4208 64.8268,-1099.9929 64.8268,-1099.9929"/>
<text text-anchor="middle" x="53.6931" y="-1080.3784" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">remote</text>
<path fill="none" stroke="#000000" d="M63.2254,-1090.0442C59.4271,-1064.8951 56.2542,-1038.6889 54.348,-1014 36.3281,-780.6024 47.1574,-502.891 57.6579,-374.1486"/>
<polygon fill="#000000" stroke="#000000" points="64.7695,-1099.9973 58.7895,-1090.8055 64.0029,-1095.0565 63.2364,-1090.1156 63.2364,-1090.1156 63.2364,-1090.1156 64.0029,-1095.0565 67.6832,-1089.4256 64.7695,-1099.9973 64.7695,-1099.9973"/>
<text text-anchor="middle" x="53.6382" y="-1080.3813" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">remote</text>
</g>
<!-- A10&#45;&gt;A3 -->
<g id="edge11" class="edge">
<title>A10&#45;&gt;A3</title>
<path fill="none" stroke="#000000" d="M80.9376,-1090.0398C77.4779,-1064.8912 74.2888,-1038.6862 72.348,-1014 54.556,-787.6956 61.261,-519.6805 63.1505,-386.2518"/>
<polygon fill="#000000" stroke="#000000" points="82.3274,-1099.9929 76.4876,-1090.7113 81.6359,-1095.0409 80.9444,-1090.089 80.9444,-1090.089 80.9444,-1090.089 81.6359,-1095.0409 85.4011,-1089.4666 82.3274,-1099.9929 82.3274,-1099.9929"/>
<polygon fill="#000000" stroke="#000000" points="63.1517,-386.1533 59.2325,-380.1002 63.3125,-374.1544 67.2317,-380.2074 63.1517,-386.1533"/>
<text text-anchor="middle" x="71.5214" y="-389.3921" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">local</text>
<path fill="none" stroke="#000000" d="M80.8817,-1090.0442C77.4271,-1064.8951 74.2542,-1038.6889 72.348,-1014 54.8736,-787.6681 64.5282,-519.665 68.0596,-386.2452"/>
<polygon fill="#000000" stroke="#000000" points="82.2701,-1099.9973 76.4317,-1090.7149 81.5793,-1095.0453 80.8885,-1090.0932 80.8885,-1090.0932 80.8885,-1090.0932 81.5793,-1095.0453 85.3454,-1089.4715 82.2701,-1099.9973 82.2701,-1099.9973"/>
<polygon fill="#000000" stroke="#000000" points="68.0621,-386.1446 64.2181,-380.0435 68.3714,-374.1486 72.2154,-380.2497 68.0621,-386.1446"/>
<text text-anchor="middle" x="76.3539" y="-389.4865" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000">local</text>
</g>
<!-- A10&#45;&gt;A4 -->
<g id="edge17" class="edge">

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View File

@@ -1,14 +1,6 @@
from abc import ABCMeta
class IterRegistry(type):
def __iter__(cls):
for ref in cls._registry:
obj = ref()
if obj is not None:
yield obj
class AbstractIterMeta(ABCMeta):
def __iter__(cls):
for ref in cls._registry:

View File

@@ -5,11 +5,11 @@ from enum import Enum
if __name__ == "app.src.messages":
from app.src.iter_registry import IterRegistry
from app.src.protocol_ifc import ProtocolIfc
from app.src.infos import Infos, Register
from app.src.modbus import Modbus
else: # pragma: no cover
from iter_registry import IterRegistry
from protocol_ifc import ProtocolIfc
from infos import Infos, Register
from modbus import Modbus
@@ -82,8 +82,7 @@ class State(Enum):
'''connection closed'''
class Message(metaclass=IterRegistry):
_registry = []
class Message(ProtocolIfc):
MAX_START_TIME = 400
'''maximum time without a received msg in sec'''
MAX_INV_IDLE_TIME = 120

View File

@@ -1,5 +1,4 @@
from abc import abstractmethod
import weakref
if __name__ == "app.src.protocol_ifc":
from app.src.iter_registry import AbstractIterMeta
@@ -10,34 +9,13 @@ else: # pragma: no cover
class ProtocolIfc(metaclass=AbstractIterMeta):
@abstractmethod
def __init__(self, addr, ifc: "AsyncIfc", server_side: bool,
client_mode: bool = False, id_str=b''):
pass # pragma: no cover
@abstractmethod
def close(self):
pass # pragma: no cover
def __enter__(self):
return self
def __exit__(self, exc_type, exc, tb):
self.close()
class Test():
def test_method(self):
return self
class ProtocolIfcImpl(ProtocolIfc, Test):
_registry = []
@abstractmethod
def __init__(self, addr, ifc: "AsyncIfc", server_side: bool,
client_mode: bool = False, id_str=b''):
self._registry.append(weakref.ref(self))
pass # pragma: no cover
@abstractmethod
def close(self):
pass # pragma: no cover

View File

@@ -10,8 +10,7 @@ from app.src.config import Config
from app.src.gen3.talent import Talent
from app.src.inverter_base import InverterBase
from app.src.singleton import Singleton
from app.src.protocol_ifc import ProtocolIfcImpl
from app.src.async_stream import AsyncStream, AsyncIfcImpl, AsyncStreamClient
from app.src.async_stream import AsyncStream, AsyncStreamClient
from app.tests.test_modbus_tcp import patch_mqtt_err, patch_mqtt_except, test_port, test_hostname
@@ -114,20 +113,6 @@ def patch_unhealthy_remote():
with patch.object(AsyncStreamClient, 'healthy', new_healthy) as conn:
yield conn
def test_protocol_iter():
ProtocolIfcImpl._registry.clear()
cnt = 0
ifc = AsyncIfcImpl()
prot = ProtocolIfcImpl(('test.intern', 123), ifc, True)
for p in ProtocolIfcImpl:
assert p == prot
cnt += 1
del p
del prot
assert cnt == 1
for p in ProtocolIfcImpl:
assert False
def test_inverter_iter():
InverterBase._registry.clear()
cnt = 0