Handling structs with PVI services

If you connect a structure variable in C# then the whole variable will be read / written. It might appear different because of the property struct_variable.WriteValueAutomatic which is true by default and causes writes of the whole structure whenever a member is written to.

To prevent this and manually write the whole sturcture when you are ready, you can either set struct_variable.WriteValueAutomatic = false; or you can assign values instead of writing them.

e.g.

struct_variable.WriteValueAutomatic = false;
struct_variable.Value[“member1”] = 1;
struct_variable.Value[“member2”] = 1;
struct_variable.WriteValue();

OR

struct_variable.WriteValueAutomatic = true;
struct_variable.Value[“member1”].Assign(1);
struct_variable.Value[“member2”].Assign(2);
struct_variable.WriteValue();

Notice that in both cases you have to write the variable by calling WriteValue() on the actual struct variable not its members.

Variable instances under struct_variable.Members are not registered with the PviManager as individual variables by themselves and only serve to represent the member in .NET.

3 Likes