<xml xmlns="https://developers.google.com/blockly/xml" version="16">
  <variables>
    <variable id="@!Ly@CPr3eP`~ceVzrhQ">func</variable>
    <variable id="(E@^,a%J0.[(@@uRt,0f">nfc_obj</variable>
  </variables>
  <block type="util_python_imports" id="Q|Vpxz5x:#5T/5yBeS:Q" x="-135" y="-525">
    <field name="value">from lib.display_update import  *&amp;#10;from lib.Order_interface import *</field>
  </block>
  <block type="start_block" id="5r8Hf)nzFKt,AzMq]4)P" deletable="false" x="-313" y="-318">
    <statement name="statement">
      <block type="util_python" id="Dj!Q/gntl$YpH1Vssm}x">
        <field name="value">#version 11.07.2024&amp;#10;#Bugs corrected:&amp;#10;#    - Block screenshoot blocked when ordered requested at same time that NFC read solved.&amp;#10;&amp;#10;#version 05.06.2024&amp;#10;#Bugs corrected:&amp;#10;#    - "WAITING FOR ORDER" is the only status that allow orders in TXT4 Menu&amp;#10;&amp;#10;</field>
        <next>
          <block type="display_set_label_text" id=")S=7DR%pZxv0gvn+:0[Q">
            <field name="instance_name">txt_label_version</field>
            <value name="value">
              <shadow type="text" id=";8tV9skg8kR+~Pm65cf!">
                <field name="TEXT">Version 2024/07/11</field>
              </shadow>
            </value>
            <next>
              <block type="import_function_noreturn" id="`w4x#YJ[k0M?UR1Su9})">
                <mutation parentId="xc~=wx+MD;WnZ%~eD.{f" parentFilename="lib/Factory_Variables.py"/>
                <field name="name">ini_stocks</field>
                <data>{"id":"xc~=wx+MD;WnZ%~eD.{f","filename":"lib/Factory_Variables.py"}</data>
                <next>
                  <block type="import_function_noreturn" id="KqR,gH-d!Z.M?|{%fjBo" inline="true">
                    <mutation parentId="GpNR?4P@FL?f3(jp^K8R" parentFilename="lib/Log.py"/>
                    <field name="name">initlib_log</field>
                    <data>{"id":"GpNR?4P@FL?f3(jp^K8R","filename":"lib/Log.py"}</data>
                    <value name="lev">
                      <block type="math_number" id="5sMd`*.=k%dAok8`b(,.">
                        <field name="NUM">2</field>
                      </block>
                    </value>
                    <next>
                      <block type="variables_set" id="bwk/Rho2Oj/W.ixs]q1/">
                        <field name="VAR" id="(E@^,a%J0.[(@@uRt,0f">nfc_obj</field>
                        <value name="VALUE">
                          <block type="import_function_return" id="|AQJE.V6~T!=P=jrz@u{">
                            <mutation parentId="(y6Yn(xC,ATdGc~b5x:D" parentFilename="lib/Nfc.py"/>
                            <field name="name">nfc_init</field>
                            <data>{"id":"(y6Yn(xC,ATdGc~b5x:D","filename":"lib/Nfc.py"}</data>
                          </block>
                        </value>
                        <next>
                          <block type="import_function_noreturn" id="SNhe2.mQe*9Aj85vm~R5">
                            <mutation parentId="lpc^*Ft_iUDu`:W$utgZ" parentFilename="lib/MQTT_Broker.py"/>
                            <field name="name">mosquitto_restart</field>
                            <data>{"id":"lpc^*Ft_iUDu`:W$utgZ","filename":"lib/MQTT_Broker.py"}</data>
                            <next>
                              <block type="import_function_noreturn" id="aC+0qL|+yd.);Q08]K)B">
                                <mutation parentId="5.8LXkA^m7G[pB^=`Df^" parentFilename="lib/MQTT.py"/>
                                <field name="name">init_config_MQTT</field>
                                <data>{"id":"5.8LXkA^m7G[pB^=`Df^","filename":"lib/MQTT.py"}</data>
                                <next>
                                  <block type="import_function_noreturn" id="^J]E{a,uNS?6_Jq`c%j@">
                                    <mutation parentId="C$zGqbZO6{R56Y@8:mVB" parentFilename="lib/MQTT_Bridge.py"/>
                                    <field name="name">ini_bridge</field>
                                    <data>{"id":"C$zGqbZO6{R56Y@8:mVB","filename":"lib/MQTT_Bridge.py"}</data>
                                    <next>
                                      <block type="util_python" id="v*vzIqbKTK_rVl]-{m1y">
                                        <field name="value">&amp;#10;&amp;#10;threads_info = [&amp;#10;    {"func": thread_ftCloud, "thread": None},&amp;#10;    {"func": bridge_Monitoring, "thread": None},&amp;#10;    {"func": thread_Local, "thread": None},&amp;#10;    {"func": tr_Order_Status ,"thread":None},&amp;#10;    {"func": thread_display_update ,"thread":None}&amp;#10;]&amp;#10;&amp;#10;for info in threads_info:&amp;#10;    info["thread"] = start_thread(info["func"])</field>
                                        <next>
                                          <block type="import_function_noreturn" id="ICKxpZ[Da-,:X4`J)ZtV">
                                            <mutation parentId="o;M#rBk%|jUB36$/t]Wv" parentFilename="lib/MQTT.py"/>
                                            <field name="name">start_publish_threads</field>
                                            <data>{"id":"o;M#rBk%|jUB36$/t]Wv","filename":"lib/MQTT.py"}</data>
                                            <next>
                                              <block type="loop_endless" id="2E{]QhQ@YfQdp3C[Sf}@">
                                                <statement name="DO">
                                                  <block type="util_python" id="^F^Fm1dK0NjZv1+r2|z2">
                                                    <field name="value">#watchdog&amp;#10;    for info in threads_info:&amp;#10;        if not info["thread"].is_alive():&amp;#10;            logging.warning("Thread {} died. Restarting...".format(info['func'].__name__))&amp;#10;            info["thread"] = start_thread(info["func"])&amp;#10;    time.sleep(2)</field>
                                                  </block>
                                                </statement>
                                              </block>
                                            </next>
                                          </block>
                                        </next>
                                      </block>
                                    </next>
                                  </block>
                                </next>
                              </block>
                            </next>
                          </block>
                        </next>
                      </block>
                    </next>
                  </block>
                </next>
              </block>
            </next>
          </block>
        </next>
      </block>
    </statement>
  </block>
  <block type="procedures_defreturn" id="KSu5$HwgBYAQ7Y8Qe9~V" x="178" y="213">
    <mutation>
      <arg name="func" varid="@!Ly@CPr3eP`~ceVzrhQ" argid="||x37[A@v~8*d$E*F;X_"/>
    </mutation>
    <field name="NAME">start_thread</field>
    <field name="||x37[A@v~8*d$E*F;X_">func</field>
    <statement name="STACK">
      <block type="util_python" id="B;[|Y$I7(cO0ZSWhgy?r">
        <field name="value">t = threading.Thread(target=func, daemon=True)&amp;#10;t.start()&amp;#10;return t&amp;#10;</field>
      </block>
    </statement>
  </block>
</xml>