This commit is contained in:
2026-04-07 09:51:38 +08:00
parent ecba4d726a
commit 00dcd6b6cc
36 changed files with 2857 additions and 505 deletions

View File

@ -66,7 +66,7 @@ class OpcuaClientFeed(Thread):
self.name="opcua_feed_client"
self.target_var_paths = []
#订阅配置文件中的参数
self.subscription_name=["pd_notify","pd_set_mode","pd_set_volume"]
self.subscription_name=["pd_notify","pd_notify_finish","pd_set_mode","pd_set_volume"]
# self.server_url = ""
self.read_opc_config() # 读取配置文件
@ -88,7 +88,7 @@ class OpcuaClientFeed(Thread):
"""停止线程+断开连接"""
self.is_running = False
self.disconnect()
self.wait()
# self.wait()
print("opcua客户端线程已退出")
def connect(self):

View File

@ -83,6 +83,7 @@ class SimpleOPCUAServer:
self.feed_status = self.mould.add_variable(self.namespace, "feed_status", ua.Variant(0, ua.VariantType.Int16))
self.pd_data=self.pd.add_variable(self.namespace, "pd_data", ua.Variant("", ua.VariantType.String))
self.pd_notify=self.pd.add_variable(self.namespace, "pd_notify", ua.Variant("", ua.VariantType.String))
self.pd_notify_finish=self.pd.add_variable(self.namespace, "pd_notify_finish", ua.Variant("", ua.VariantType.String))
self.pd_set_mode=self.pd.add_variable(self.namespace, "set_mode", ua.Variant(0, ua.VariantType.Int16))
self.pd_set_volume=self.pd.add_variable(self.namespace, "set_volume", ua.Variant("", ua.VariantType.String))
@ -106,6 +107,7 @@ class SimpleOPCUAServer:
self.feed_status.set_writable(True)
self.pd_data.set_writable(True)
self.pd_notify.set_writable(True)
self.pd_notify_finish.set_writable(True)
self.pd_set_mode.set_writable(True)
self.pd_set_volume.set_writable(True)
self.sys_set_mode.set_writable(True)