locka99 / opcua

A client and server implementation of the OPC UA specification written in Rust
Mozilla Public License 2.0
496 stars 131 forks source link

[Feature/Help]: Use of json value to update tag values. #132

Closed jigar88 closed 3 years ago

jigar88 commented 3 years ago

Hello ,

I am having quick question about updating variable node values. Can I use straight json values and write to variable using set variable with json. Like if I have

msg_json = {"tag_value": 5} then 
let v = msg_json["tag_value"]
address_space.set_variable_value(&node_to_update, v,  &now, &now);

is server supports json values to update tags ?

locka99 commented 3 years ago

The set_variable_value function takes any value that can be turned into a Variant. I don't know what your json code is doing, but if you can pull an integer or floating type out of it you should be able to set it on the address space.