MX Foundation 4
Channel Class

For accessing a physical discrete channel, a logical handle to the channel is required by the programming services.

The channel handle is a reference to the physical channel holding the physical port resources.

In order to obtain an handle for the discrete channel regardless of the devices installed, an enumeration using the sequences of services mxfSystemDeviceAllGet(), mxfDeviceModuleAllGet(), and mxfModuleChannelAllGet() specifying as parameter MXF_CLASS_FLEXDIO must be performed.

The example below shows how to setup a programming environment for Flex discrete IO handling.

HMXF_SERVER server;
HMXF_CHANNEL channel;
HMXF_DEVICE device;
HMXF_MODULE module;
uint64 dev, mod, port;
char * direction;
uint32 rc;
// Connects to local server
rc = mxfServerConnect("192.168.0.1", "admin", "admin", FALSE, &server);
if (rc)
return;
// Init and server configuration
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;
// Queries channel info using the channel handle
if (!rc)
rc = mxfChannelDirectionGet(channel, &direction);
// Gets the physical location of the DIO channel
if (!rc)
rc = mxfChannelLocationGet(channel, &dev, &mod, &port);
if (!rc)
{
printf("Channel location is Device:%llu Module:%llu Port:%llu\n", dev, mod, port);
switch (direction)
{
case MXF_CHANNEL_RX;
direction = "Rx";
break;
case MXF_CHANNEL_TX:
direction = "Tx";
break;
case MXF_CHANNEL_TXRX:
direction = "TxRx";
break;
}
printf("Channel direction is %s\n", direction);
}
if (rc)
printf("Error code=0x%lX\n", rc);
Updated 10/23/2023