MX Foundation 4
Attributes

FlexDIO parameter attributes such as sample rate and others can be read or modified using the mxfAttributeUint64Get() and the mxfAttributeUint64Set() functions, passing the handle (device, module or channel) and attribute key-value pair.

See the section Attributes Reference for a description of all supported attributes.

Some other utility functions are used to get information about attributes:

The following code shows how to set attributes for a discrete input channel.

HMXF_SERVER server;
HMXF_CHANNEL channel;
HMXF_DEVICE device;
HMXF_MODULE module;
uint64 count, ports;
uint32 rc;
// Connects to local server
rc = mxfServerConnect("192.168.0.1", "admin", "admin", FALSE, &server);
if (rc)
return;
// Inits and server config
rc = mxfSystemInit(server);
if (!rc)
{
// Gets the device handle
rc = mxfSystemDeviceAllGet(server, MXF_DEVICE_ALL, 1, &count, &device);
// Gets the module handle
if (!rc && count)
rc = mxfDeviceModuleAllGet(device, MXF_MODULE_FLEXDIO, 1, &count, &module);
// Gets the channel handle
if (!rc && count)
rc = mxfModuleChannelAllGet(module, MXF_CLASS_FLEXDIO, MXF_SCLASS_ALL, 1, &count, &channel);
}
if(!rc && !count)
rc = MAXT_ERROR_NOT_FOUND;
if (!rc)
{
// Gets the number of discrete pins
rc = mxfAttributeUint64Get(channel, KMXF_FLEXDIO_NUMPORT, &ports);
if (!rc)
printf("Number of ports = %llu\n", ports);
else
printf("Error code=0x%lX\n", rc);
}
if (!rc)
{
// Sets sample rate to 10 msec
rc = mxfAttributeUint64Set(channel, KMXF_FLEXDIO_RX_SAMP_PERIOD, 10000000);
}
if (rc)
printf("Error code=0x%lX\n", rc);
Updated 10/23/2023