MQTT: WIP, prevent crash after disconnect. Disable auto-reconnect on connection lost callback.
<?xml version='1.0' encoding='utf-8'?>
<project xmlns:ns1="http://www.plcopen.org/xml/tc6_0201" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.plcopen.org/xml/tc6_0201">
<fileHeader companyName="Unknown" productName="Unnamed" productVersion="1" creationDateTime="2019-08-06T14:23:42"/>
<contentHeader name="Unnamed" modificationDateTime="2023-08-18T11:29:36">
<coordinateInfo>
<fbd>
<scaling x="5" y="5"/>
</fbd>
<ld>
<scaling x="0" y="0"/>
</ld>
<sfc>
<scaling x="0" y="0"/>
</sfc>
</coordinateInfo>
</contentHeader>
<types>
<dataTypes/>
<pous>
<pou name="MainStuff" pouType="program">
<interface>
<localVars>
<variable name="var0">
<type>
<derived name="HMI_REAL"/>
</type>
</variable>
<variable name="var1">
<type>
<derived name="HMI_SINT"/>
</type>
</variable>
<variable name="var2">
<type>
<derived name="HMI_INT"/>
</type>
</variable>
<variable name="var3">
<type>
<derived name="HMI_DINT"/>
</type>
</variable>
<variable name="var4">
<type>
<derived name="HMI_LINT"/>
</type>
</variable>
<variable name="var5">
<type>
<derived name="HMI_USINT"/>
</type>
</variable>
<variable name="var6">
<type>
<derived name="HMI_UINT"/>
</type>
</variable>
<variable name="var7">
<type>
<derived name="HMI_UDINT"/>
</type>
</variable>
<variable name="var8">
<type>
<derived name="HMI_ULINT"/>
</type>
</variable>
<variable name="var9">
<type>
<derived name="HMI_UDINT"/>
</type>
</variable>
</localVars>
</interface>
<body>
<FBD>
<inVariable localId="5" executionOrderId="0" height="30" width="125" negated="false">
<position x="320" y="60"/>
<connectionPointOut>
<relPosition x="125" y="15"/>
</connectionPointOut>
<expression>var0</expression>
</inVariable>
<block localId="11" typeName="REAL_TO_INT" executionOrderId="0" height="40" width="100">
<position x="495" y="95"/>
<inputVariables>
<variable formalParameter="IN">
<connectionPointIn>
<relPosition x="0" y="30"/>
<connection refLocalId="5">
<position x="495" y="125"/>
<position x="470" y="125"/>
<position x="470" y="75"/>
<position x="445" y="75"/>
</connection>
</connectionPointIn>
</variable>
</inputVariables>
<inOutVariables/>
<outputVariables>
<variable formalParameter="OUT">
<connectionPointOut>
<relPosition x="100" y="30"/>
</connectionPointOut>
</variable>
</outputVariables>
</block>
<outVariable localId="12" executionOrderId="0" height="25" width="45" negated="false">
<position x="680" y="65"/>
<connectionPointIn>
<relPosition x="0" y="10"/>
<connection refLocalId="1" formalParameter="OUT">
<position x="680" y="75"/>
<position x="610" y="75"/>
</connection>
</connectionPointIn>
<expression>var1</expression>
</outVariable>
<outVariable localId="13" executionOrderId="0" height="25" width="45" negated="false">
<position x="680" y="115"/>
<connectionPointIn>
<relPosition x="0" y="10"/>
<connection refLocalId="11" formalParameter="OUT">
<position x="680" y="125"/>
<position x="595" y="125"/>
</connection>
</connectionPointIn>
<expression>var2</expression>
</outVariable>
<outVariable localId="14" executionOrderId="0" height="25" width="45" negated="false">
<position x="680" y="165"/>
<connectionPointIn>
<relPosition x="0" y="10"/>
<connection refLocalId="21" formalParameter="OUT">
<position x="680" y="175"/>
<position x="605" y="175"/>
</connection>
</connectionPointIn>
<expression>var3</expression>
</outVariable>
<outVariable localId="15" executionOrderId="0" height="25" width="45" negated="false">
<position x="680" y="215"/>
<connectionPointIn>
<relPosition x="0" y="10"/>
<connection refLocalId="20" formalParameter="OUT">
<position x="680" y="225"/>
<position x="605" y="225"/>
</connection>
</connectionPointIn>
<expression>var4</expression>
</outVariable>
<outVariable localId="16" executionOrderId="0" height="25" width="45" negated="false">
<position x="680" y="265"/>
<connectionPointIn>
<relPosition x="0" y="10"/>
<connection refLocalId="22" formalParameter="OUT">
<position x="680" y="275"/>
<position x="610" y="275"/>
</connection>
</connectionPointIn>
<expression>var5</expression>
</outVariable>
<outVariable localId="17" executionOrderId="0" height="25" width="45" negated="false">
<position x="680" y="315"/>
<connectionPointIn>
<relPosition x="0" y="10"/>
<connection refLocalId="23" formalParameter="OUT">
<position x="680" y="325"/>
<position x="605" y="325"/>
</connection>
</connectionPointIn>
<expression>var6</expression>
</outVariable>
<outVariable localId="18" executionOrderId="0" height="25" width="45" negated="false">
<position x="680" y="365"/>
<connectionPointIn>
<relPosition x="0" y="10"/>
<connection refLocalId="24" formalParameter="OUT">
<position x="680" y="375"/>
<position x="610" y="375"/>
</connection>
</connectionPointIn>
<expression>var7</expression>
</outVariable>
<outVariable localId="19" executionOrderId="0" height="25" width="45" negated="false">
<position x="680" y="415"/>
<connectionPointIn>
<relPosition x="0" y="10"/>
<connection refLocalId="25" formalParameter="OUT">
<position x="680" y="425"/>
<position x="610" y="425"/>
</connection>
</connectionPointIn>
<expression>var8</expression>
</outVariable>
<block localId="1" typeName="REAL_TO_SINT" executionOrderId="0" height="40" width="115">
<position x="495" y="45"/>
<inputVariables>
<variable formalParameter="IN">
<connectionPointIn>
<relPosition x="0" y="30"/>
<connection refLocalId="5">
<position x="495" y="75"/>
<position x="445" y="75"/>
</connection>
</connectionPointIn>
</variable>
</inputVariables>
<inOutVariables/>
<outputVariables>
<variable formalParameter="OUT">
<connectionPointOut>
<relPosition x="115" y="30"/>
</connectionPointOut>
</variable>
</outputVariables>
</block>
<block localId="20" typeName="REAL_TO_LINT" executionOrderId="0" height="40" width="110">
<position x="495" y="195"/>
<inputVariables>
<variable formalParameter="IN">
<connectionPointIn>
<relPosition x="0" y="30"/>
<connection refLocalId="5">
<position x="495" y="225"/>
<position x="470" y="225"/>
<position x="470" y="75"/>
<position x="445" y="75"/>
</connection>
</connectionPointIn>
</variable>
</inputVariables>
<inOutVariables/>
<outputVariables>
<variable formalParameter="OUT">
<connectionPointOut>
<relPosition x="110" y="30"/>
</connectionPointOut>
</variable>
</outputVariables>
</block>
<block localId="21" typeName="REAL_TO_DINT" executionOrderId="0" height="40" width="110">
<position x="495" y="145"/>
<inputVariables>
<variable formalParameter="IN">
<connectionPointIn>
<relPosition x="0" y="30"/>
<connection refLocalId="5">
<position x="495" y="175"/>
<position x="470" y="175"/>
<position x="470" y="75"/>
<position x="445" y="75"/>
</connection>
</connectionPointIn>
</variable>
</inputVariables>
<inOutVariables/>
<outputVariables>
<variable formalParameter="OUT">
<connectionPointOut>
<relPosition x="110" y="30"/>
</connectionPointOut>
</variable>
</outputVariables>
</block>
<block localId="22" typeName="REAL_TO_USINT" executionOrderId="0" height="40" width="115">
<position x="495" y="245"/>
<inputVariables>
<variable formalParameter="IN">
<connectionPointIn>
<relPosition x="0" y="30"/>
<connection refLocalId="5">
<position x="495" y="275"/>
<position x="470" y="275"/>
<position x="470" y="75"/>
<position x="445" y="75"/>
</connection>
</connectionPointIn>
</variable>
</inputVariables>
<inOutVariables/>
<outputVariables>
<variable formalParameter="OUT">
<connectionPointOut>
<relPosition x="115" y="30"/>
</connectionPointOut>
</variable>
</outputVariables>
</block>
<block localId="23" typeName="REAL_TO_UINT" executionOrderId="0" height="40" width="110">
<position x="495" y="295"/>
<inputVariables>
<variable formalParameter="IN">
<connectionPointIn>
<relPosition x="0" y="30"/>
<connection refLocalId="5">
<position x="495" y="325"/>
<position x="470" y="325"/>
<position x="470" y="75"/>
<position x="445" y="75"/>
</connection>
</connectionPointIn>
</variable>
</inputVariables>
<inOutVariables/>
<outputVariables>
<variable formalParameter="OUT">
<connectionPointOut>
<relPosition x="110" y="30"/>
</connectionPointOut>
</variable>
</outputVariables>
</block>
<block localId="24" typeName="REAL_TO_UDINT" executionOrderId="0" height="40" width="115">
<position x="495" y="345"/>
<inputVariables>
<variable formalParameter="IN">
<connectionPointIn>
<relPosition x="0" y="30"/>
<connection refLocalId="5">
<position x="495" y="375"/>
<position x="470" y="375"/>
<position x="470" y="75"/>
<position x="445" y="75"/>
</connection>
</connectionPointIn>
</variable>
</inputVariables>
<inOutVariables/>
<outputVariables>
<variable formalParameter="OUT">
<connectionPointOut>
<relPosition x="115" y="30"/>
</connectionPointOut>
</variable>
</outputVariables>
</block>
<block localId="25" typeName="REAL_TO_ULINT" executionOrderId="0" height="40" width="115">
<position x="495" y="395"/>
<inputVariables>
<variable formalParameter="IN">
<connectionPointIn>
<relPosition x="0" y="30"/>
<connection refLocalId="5">
<position x="495" y="425"/>
<position x="470" y="425"/>
<position x="470" y="75"/>
<position x="445" y="75"/>
</connection>
</connectionPointIn>
</variable>
</inputVariables>
<inOutVariables/>
<outputVariables>
<variable formalParameter="OUT">
<connectionPointOut>
<relPosition x="115" y="30"/>
</connectionPointOut>
</variable>
</outputVariables>
</block>
</FBD>
</body>
</pou>
</pous>
</types>
<instances>
<configurations>
<configuration name="config">
<resource name="resource1">
<task name="task0" priority="0" interval="T#20ms">
<pouInstance name="instance0" typeName="MainStuff"/>
</task>
</resource>
</configuration>
</configurations>
</instances>
</project>