Skip to content

How to flexibly set each variant type when creating a ua server(add_variable) #835

Answered by schroeder-
ryangu18 asked this question in Q&A
Discussion options

You must be logged in to vote

Just provide a dict such as:


datatype_to_variant = {
   'Float':  (0.0, ua.VariantType.Double),
   'Int32': (ua.Int32(0), ua.ua.VariantType.Int32),
   ....
}

def_val, datatype = datatype_to_variant[eachTag[2]]
Temp = await Param.add_variable(addspace, eachTag[0], def_val, datatype)  # 

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ryangu18
Comment options

Answer selected by ryangu18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants