
The Device Server Signal Interface
devserver device;
DevVarStringArray sig_config;
DevVarFloatArray param_array;
long nu_of_properties;
long nu_of_signals;
long i, k;
case (3) :
/*
* Read the device signal values.
*/
param_array.length = 0;
param_array.sequence = NULL;
if (dev_putget (device, DevReadSigValues, NULL, D_VOID_TYPE,
¶m_array, D_VAR_FLOATARR, &error) < 0)
{
dev_printerror_no (SEND, "DevReadSigValues", error);
break;
}
/*
* Read the signal properies to display the values.
*/
sig_config.length = 0;
sig_config.sequence = NULL;
if (dev_putget (device, DevGetSigConfig, NULL, D_VOID_TYPE,
&sig_config, D_VAR_STRINGARR, &error) < 0)
{
dev_printerror_no (SEND, "DevGetSigConfig", error);
break;
}
/*
* Find the label format and unit for the signal values.
*/
nu_of_properties = atol (sig_config.sequence[0]);
nu_of_signals = (sig_config.length -1) / nu_of_properties;
printf ("Device parameters:\n");
for (i=0; i<nu_of_signals; i++)
{
sprintf (format, "%24s [%2s] : %s\n",
sig_config.sequence[(i*nu_of_properties) + 2],
sig_config.sequence[(i*nu_of_properties) + 3],
sig_config.sequence[(i*nu_of_properties) + 4]);
printf (format, param_array.sequence[i]);
}
/*
* Free the allocated arrays.
*/
if ( dev_xdrfree (D_VAR_FLOATARR, ¶m_array, &error)
< 0 )
{
dev_printerror_no (SEND, "dev_xdrfree", error);
}
if ( dev_xdrfree (D_VAR_STRINGARR, &sig_config, &error) < 0 )
{
dev_printerror_no (SEND, "dev_xdrfree", error);
}
break;

Generated with Harlequin WebMaker