07-14-2009 11:04 AM
Hello All,
I am new to Labview and DataSocket in particular, so any help would be greatly appreciated.
I am trying to write a data viewer program in IGOR (www.wavemetrics.com) which will receive multi channel data being published to a DataSocket server and display the requested channel real time. In order to do this I had to write a dll in C, then import that into IGOR, which allowed me to access all the functions in dataskt.dll (DataSocket Library - NI LabWindows™/CVI™ 9.0 Help ).
I have successfully compiled this dll with the DS_Open, DS_IsConnected, DS_DiscardObjHandle, DS_GetDataValue functions and tested them by publishing and retrieving a type double from the server. The problem I am having is that the real data is published as a custom cluster of a double, two singles, and a 1D array of singles (the datapoints at that time slice).
The second input of the DS_GetDataValue function is an unsigned int which represents the type of data expected from the server. There is a list of acceptable data types is in cviauto.h, but as you can see none of them are for a cluster (or structure for that matter):
/* Use these to specify the type of a function parameter, function return */
/* value, and a property. */
enum {
CAVT_EMPTY = 100,
CAVT_NULL,
CAVT_SHORT,
CAVT_LONG,
CAVT_INT = CAVT_LONG,
CAVT_FLOAT,
CAVT_DOUBLE,
CAVT_CY,
CAVT_DATE,
CAVT_BSTR,
CAVT_DISPATCH,
CAVT_ERROR,
CAVT_BOOL,
CAVT_VARIANT,
CAVT_UNKNOWN,
CAVT_UCHAR,
CAVT_CSTRING, /* null terminated ansi (multi-byte) string */
CAVT_OBJHANDLE,
CAVT_CHAR,
CAVT_USHORT,
CAVT_ULONG,
CAVT_UINT,
CAVT_LONGLONG,
CAVT_ULONGLONG,
CAVT_BASICTYPE_MASK = 0x0fff,
CAVT_MODIFIER_MASK = 0xf000,
CAVT_ARRAY = 0x1000,
CAVT_BYREF = 0x2000,
CAVT_IN = 0x4000,
CAVT_OUT = 0x8000,
CAVT_AUTO_CLEAR = 0x0800 /* valid only for VARIANT arguments. VariantClear is called on the variant after the function call */
};
Then the third input is a pointer to a variable that is the same data type. I have created a structure to match the cluster and tried to pass that but it does not change the values of the structure.
Another thing I have tried is the DS_GetDataType function, but that returns 100 which corresponds to CAVT_EMPTY.
Is there any way to define one of these for a cluster? Is there a better way to do what I am trying to do? Any help would be appreciated.
Thanks,
-Jeff VT
07-14-2009 01:59 PM
07-14-2009 02:08 PM
Thanks for the response.
Unfortunately I do not have control over how the data is published to the server. There are actually several clusters like I have described, each with data for a particular location during the test, all being published to the same server. The data recording program that we have is written to accept the cluster (it is a labview program) so we don't want to change the way it is published right now. Also we are dealing with a couple hundred datapoints in the array for each cluster.
-Jeff VT
07-14-2009 02:21 PM
06-11-2010 11:32 PM
hi,
i have the same problem, did you find any solutions for it? thanks.
06-14-2010 10:48 AM
Hi,
Clusters are coded as structures in C. To pass a structure over a datasocket you will want to cast it as a variant data type. In CVI you will be able to find functions for passing values to variants and retrieving values from variants.
Take care!
Tanya