Skip to content

Accessing elements in an Array #382

@TanJunKiat

Description

@TanJunKiat

I followed the guide and created a simple OPC-UA server with one of the variables being an array

Variable::new(&array_varab;e_node, "ArrayVariable", "ArrayVariable", vec![0_i32; 3]),

And I want to read and modify the variable in a polling_action node

server.add_polling_action(2000, move || {
    let address_space = address_space.write();
    let value = address_space.get_variable_value(&car_call_request).unwrap().value.unwrap();
}

I am stuck at this point because the elements in the array are inaccessible.

> value: Array(Array { value_type: Int32, values: [Int32(0), Int32(0), Int32(0)], dimensions: None })

I understand that the array is an enum that has a Box as the component (Array(Box<Array>)).

Is there any way to get the elements out of the array?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions