Commit a9816a0f authored by Thomas Juerges's avatar Thomas Juerges
Browse files

Create variables as opcua.Variants

This should tell clients what variable they are dealing with.
parent bcb6a021
......@@ -54,7 +54,7 @@ def setup_server(url: str):
mp_name = "RCU_error_spectra"
obj = folder.add_object(idx, mp_name)
var = obj.add_variable(idx, "rcu", 0)
var = obj.add_variable(idx, "rcu", 0, ua.VariantType.UInt32)
# Set to be read-only
var.set_read_only()
#var.set_writable()
......@@ -66,43 +66,43 @@ def setup_server(url: str):
monitor_points[mp_name]={}
monitor_points[mp_name]["rcu"] = {"object": obj, "variable": var}
var = obj.add_variable(idx, "obs_id", 0)
var = obj.add_variable(idx, "obs_id", ua.Variant(0, ua.VariantType.UInt64))
# Set to be read-only
var.set_read_only()
monitor_points[mp_name]["obs_id"] = {"object": obj, "variable": var}
var = obj.add_variable(idx, "rcumode", 0)
var = obj.add_variable(idx, "rcumode", ua.Variant(0, ua.VariantType.UInt64))
# Set to be read-only
var.set_read_only()
monitor_points[mp_name]["rcumode"] = {"object": obj, "variable": var}
var = obj.add_variable(idx, "error", "")
var = obj.add_variable(idx, "error", ua.Variant("", ua.VariantType.String))
# Set to be read-only
var.set_read_only()
monitor_points[mp_name]["error"] = {"object": obj, "variable": var}
var = obj.add_variable(idx, "start_freq", 0.0)
var = obj.add_variable(idx, "start_freq", ua.Variant(0.0, ua.VariantType.Double))
# Set to be read-only
var.set_read_only()
monitor_points[mp_name]["start_freq"] = {"object": obj, "variable": var}
var = obj.add_variable(idx, "end_freq", 0.0)
var = obj.add_variable(idx, "end_freq", ua.Variant(0.0, ua.VariantType.Double))
# Set to be read-only
var.set_read_only()
monitor_points[mp_name]["end_freq"] = {"object": obj, "variable": var}
var = obj.add_variable(idx, "timestamp", 0.0)
var = obj.add_variable(idx, "timestamp", ua.Variant(datetime.utcnow(), ua.VariantType.DateTime))
# Set to be read-only
var.set_read_only()
monitor_points[mp_name]["timestamp"] = {"object": obj, "variable": var}
empty_list=[0] * 256
var = obj.add_variable(idx, "average_spectrum", empty_list)
var = obj.add_variable(idx, "average_spectrum", ua.Variant(empty_list, ua.VariantType.Double))
# Set to be read-only
var.set_read_only()
monitor_points[mp_name]["average_spectrum"] = {"object": obj, "variable": var}
var = obj.add_variable(idx, "spectrum", empty_list)
var = obj.add_variable(idx, "spectrum", ua.Variant(empty_list, ua.VariantType.Double))
# Set to be read-only
var.set_read_only()
monitor_points[mp_name]["spectrum"] = {"object": obj, "variable": var}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment