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)
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?