|
@@ -24,6 +24,7 @@ import device.dev_mng as g_Dev
|
|
|
from device.dev_mng import (
|
|
|
Device,
|
|
|
)
|
|
|
+from core.alarm_plan import AlarmPlan
|
|
|
|
|
|
import core.g_LAS as g_las
|
|
|
|
|
@@ -213,6 +214,39 @@ def deal_las_test(msg:mqtt.MQTTMessage):
|
|
|
LOGERR(f"[{frame.filename}:{frame.lineno}] @{frame.name}(), error: {e}")
|
|
|
|
|
|
|
|
|
+# 获取调试信息
|
|
|
+def deal_get_debug_info(msg:mqtt.MQTTMessage):
|
|
|
+ try:
|
|
|
+ plans_info: list = []
|
|
|
+ plan: AlarmPlan = None
|
|
|
+ plans = g_las.g_alarm_plan_mgr.list_all_plan()
|
|
|
+ for plan in plans:
|
|
|
+ item = {
|
|
|
+ "plan_uuid" : plan.plan_uuid_,
|
|
|
+ "name" : plan.name_,
|
|
|
+ "dev_id" : plan.dev_id_,
|
|
|
+ "dev_name" : plan.dev_name_,
|
|
|
+ "enable" : plan.enable_,
|
|
|
+ "event_type" : plan.event_type_,
|
|
|
+ "threshold_time" : plan.threshold_time_,
|
|
|
+ "rect" : plan.rect_,
|
|
|
+ "rect" : plan.rect_,
|
|
|
+ "param" : plan.param_
|
|
|
+ }
|
|
|
+ plans_info.append(item)
|
|
|
+
|
|
|
+ mqtt_send.las_debug_info(plans_info)
|
|
|
+
|
|
|
+ except json.JSONDecodeError as e:
|
|
|
+ tb_info = traceback.extract_tb(e.__traceback__)
|
|
|
+ for frame in tb_info:
|
|
|
+ LOGERR(f"[{frame.filename}:{frame.lineno}] @{frame.name}(), error:{e}, {e.doc}")
|
|
|
+ except Exception as e:
|
|
|
+ tb_info = traceback.extract_tb(e.__traceback__)
|
|
|
+ for frame in tb_info:
|
|
|
+ LOGERR(f"[{frame.filename}:{frame.lineno}] @{frame.name}(), error: {e}")
|
|
|
+
|
|
|
+
|
|
|
# 设备消息分发处理:/dev/#
|
|
|
def deal_dev_msg(client:mqtt.Client, userdaata, msg:mqtt.MQTTMessage):
|
|
|
try:
|
|
@@ -287,9 +321,14 @@ def deal_las_msg(client:mqtt.Client, userdaata, msg:mqtt.MQTTMessage):
|
|
|
if (check_topic(topic,Topic_Pattern.las_alarm_plan_update)):
|
|
|
deal_alarm_plan_update(msg)
|
|
|
|
|
|
+ # 测试
|
|
|
elif (check_topic(topic,Topic_Pattern.las_test)):
|
|
|
deal_las_test(msg)
|
|
|
|
|
|
+ # 获取调试信息
|
|
|
+ elif (check_topic(topic,Topic_Pattern.las_get_debug_info)):
|
|
|
+ deal_get_debug_info(msg)
|
|
|
+
|
|
|
except json.JSONDecodeError as e:
|
|
|
tb_info = traceback.extract_tb(e.__traceback__)
|
|
|
for frame in tb_info:
|