Skip to content

Implement automatic extraction of custom extension objects #293

@Terrub

Description

@Terrub

This is related to my earlier question that now works using hardcoded values, but is not at all dynamic just yet.

I've got the inverse problem now that the call I make returns amongst other things, a custom object. This object is described in the same XML-dictionary document that describes the method. Though I should be able to retrieve the description dictionary if it wasn't, I haven't looked into it.

The code below is what I do now, but it feels like this is not at all the right way to do this.
So obviously the question is: What is the right way to do this?

def unpack_custom_data(p_custom_data):
    data = utils.Buffer(p_custom_data)
    measurements = []

    name = ua.unpack_uatype("CharArray", data)
    type = ua.unpack_uatype("Int32", data)
    num_measurements = ua.unpack_uatype("Int32", data)
    for idx in range(0, num_measurements):
        measurement = ua.unpack_uatype("Float", data)
        measurements.append(measurement)
    percentage = ua.unpack_uatype("Float", data)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions