22
33@uamethod
44def callback (parent , in_extobj ):
5-
65 out_extobj = ua .uaprotocol_auto .AxisInformation () # get new instanace of AxisInformation
76 out_extobj .EngineeringUnits = in_extobj .EngineeringUnits
87 out_extobj .EURange .Low = in_extobj .EURange .Low
@@ -12,10 +11,13 @@ def callback(parent, in_extobj):
1211 out_extobj .AxisSteps = in_extobj .AxisSteps
1312
1413 axis_info .set_value (out_extobj ) #write values to variable
15-
16- return [
17- out_extobj
18- ]
14+
15+ ret = (
16+ ua .Variant (out_extobj , ua .VariantType .ExtensionObject ),
17+ ua .Variant ("test" , ua .VariantType .String )
18+ )
19+
20+ return ret
1921
2022server = Server ()
2123server .set_endpoint ("opc.tcp://0.0.0.0:4840/freeopcua/server/" )
@@ -40,6 +42,13 @@ def callback(parent, in_extobj):
4042outarg_extobj .ArrayDimensions = []
4143outarg_extobj .Description = ua .LocalizedText ("Actual AxisInformation" )
4244
45+ status = ua .Argument ()
46+ status .Name = "Status"
47+ status .DataType = ua .NodeId (12 , 0 )
48+ status .ValueRank = - 1
49+ status .ArrayDimensions = []
50+ status .Description = ua .LocalizedText ("MSG" )
51+
4352method_parent = obj .add_object (idx , "Methods" )
4453method_node = method_parent .add_method (
4554 idx ,
@@ -49,12 +58,13 @@ def callback(parent, in_extobj):
4958 inarg_extobj
5059 ],
5160 [
52- outarg_extobj
61+ outarg_extobj ,
62+ status
5363 ]
5464)
5565
5666#add a variable of type AxisInformation
5767axis_info = obj .add_variable (idx , "AxisInformation" , ua .uaprotocol_auto .AxisInformation (), varianttype = ua .VariantType .ExtensionObject )
5868
5969if __name__ == "__main__" :
60- server .start ()
70+ server .start ()
0 commit comments