01-12-2010 12:41 PM
I'm trying to develop software with Measurement Studio 8.6 that communicates to a machine running LabVIEW RT.
The software deployed in the RT machine uses a custom control to group data (It is a cluster of string arrays and double arrays).
I've been able to connect and disconnect, get/set values of simpler types such as Booleans, but the .NET library (specifically the NetworkVariableReader<Object> type) throws an exception when I use the ReadData() function on my custom control data.
NetworkVariable cannot convert from n to an equivalent .NET type
If there is no way to send Network variable data that is of a custom control, then I see only two options...
1) Break the data down to simpler types, which would change the implementation of the RT software significantly
2) Cast the custom control data to an array of bytes and send it through the network, which I can then cast on the .NET recieving end into a structure.
However, it is not that easy to work with an array of bytes, I suspect other issues will pop-up, and I was wondering if there is a way I can recieve the custom control data directly. Else I'll probably go with approach #1 😞
I also store the custom control data as an xml file on the RT harddisk. Maybe this file can somehow be used to get the data? Any suggestions?
Thank you
01-13-2010 05:07 PM
Hi Tavak,
Unfortunately, the .NET Network Variable Class only supports primitive data types, and so you will have to implement one of the two methods you described.
01-14-2010 08:28 AM
I'd like to clarify Al B's answer. Al B's answer is 100% correct in the context of using the .NET Network Variable class library to exchange data with LabVIEW or CVI.
However, when you use the .NET Network Variable class library for both writing and reading the data, it is possible to transfer complex data types if the complex data types are serializable. This is described in the "Supported Data Types" section of the "Key Measurement Studio Network Variable .NET Library Features" topic in the Measurement Studio help.