Hi Megan,
I was able to get the demonstration program to work, and identified the problem.
Here is a snippet of my code:
hr = DS_GetDataType (Module->DS_Handle, &type, &x, &y);
if (type & CAVT_ARRAY)
{
hr = DS_GetDataValue (Module->DS_Handle, CAVT_UCHAR|CAVT_ARRAY, &data,
sizeof(MODDATA), &sz, NULL);
if (SUCCEEDED(hr))
memcpy (&(Module->data), &data, sizeof(MODDATA));
}
else
{
hr = DS_GetDataValue (Module->DS_Handle, CAVT_UCHAR|CAVT_ARRAY, &data,
sizeof(MODDATA), &sz, NULL);
}
Here is the write expression:
hr = DS_SetDataValue (Module->DS_Handle, CAVT_UCHAR|CAVT_ARRAY, &(Module->data), sizeof(MODDATA), 0);
And the structure of MODDATA:
typedef struct MODDATA
{
int Cmd;
int CmdReply;
int RemoteStatus; // remote status
int RemoteStatus2; //
int CurrentTray;
int FailureTray;
int Sock1Status;
int Sock2Status;
int Sock3Status;
int Sock4Status;
BOOL SMEMA_TrayAvail;
BOOL SMEMA_Busy;
BOOL SMEMA_ReqTray;
BOOL SMEMA_AcqTray;
char ModuleStatus[50];
} MODDATA;
I had to add the statement after the "else", because after the connection is established the DS_GetDataType is returning a 103 until a DS_GetDataValue is exectued. (without the else, the DS_GetDataValue never returns the right value) On subsequent calls the type is returned correctly. Despite the fact that the type is returning a 103, the DS_GetDataValue using a CAVT_UCHAR|CAVT_ARRAY works without throwing an error. The sample polling code does not check the type, though the sample event code recommends that the type be checked. I haven't checked to see what data is returned on the first call to see if it's valid or not.
This is pretty useful since it allows the sending of a complete structure over DataSocket without having to break it up or do anything fancy.
Jim