--- a/mqtt/client.py Thu Sep 26 15:28:10 2024 +0200
+++ b/mqtt/client.py Mon Sep 30 16:21:11 2024 +0200
@@ -4,6 +4,7 @@
from editors.ConfTreeNodeEditor import ConfTreeNodeEditor
from PLCControler import LOCATION_CONFNODE, LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT
@@ -26,9 +27,11 @@
class MQTTClientEditor(ConfTreeNodeEditor):
- (_("MQTT Client"), "CreateMQTTClient_UI")]
+ (_("MQTT Client"), "CreateMQTTClient_UI"), + (_("Info"), "CreateInfo_UI")] self.Controler.GetCTRoot().logger.write(msg)
@@ -41,6 +44,15 @@
return self.MQTTClient_UI
+ def CreateInfo_UI(self, parent): + location_str = "_".join(map(str, self.Controler.GetCurrentLocation())) + information=("Connection status GLOBAL VAR is:\n\n\tMQTT_STATUS_"+location_str + +"0 is disconnected\n\t" + self.Info_UI = wx.StaticText(parent, label = information) self.MQTTClient_UI.RefreshView()
@@ -224,6 +236,7 @@
def CTNGlobalInstances(self):
location_str = "_".join(map(str, self.GetCurrentLocation()))
- return [("MQTT_HAPPY_"+location_str, "DINT", "")]
+ return [("MQTT_STATUS_"+location_str, "INT", ""), --- a/mqtt/mqtt_template.c Thu Sep 26 15:28:10 2024 +0200
+++ b/mqtt/mqtt_template.c Mon Sep 30 16:21:11 2024 +0200
@@ -44,6 +44,8 @@
+extern INT CONFIG__MQTT_STATUS_{locstr}; #define DECL_VAR(iec_type, C_type, c_loc_name) \
static C_type PLC_##c_loc_name##_buf; \
static C_type MQTT_##c_loc_name##_buf; \
@@ -557,6 +559,7 @@
void __retrieve_{locstr}(void)
if (pthread_mutex_trylock(&MQTT_retrieve_mutex) == 0){{
+ CONFIG__MQTT_STATUS_{locstr} = MQTT_is_disconnected ? 0 : 1; pthread_mutex_unlock(&MQTT_retrieve_mutex);