The way to setup a basic acquisition receive application is as follows:
- A receive channel must be obtained using the mxfModuleChannelGet() function or with the mxfModuleChannelAllGet() function by specifying the MXF_SCLASS_RXACQ_SRV subclass.
- The acquisition buffer must be allocated using the mxfRxAcqBufferAlloc() function.
- The acquisition mode can be set using the mxfRxAcqModeSet() function.
Two modes of acquisition are defined:
Condition | Description |
MXF_RXACQ_MODE_LINEAR | In this mode the acquisition stops when the buffer is full. |
MXF_RXACQ_MODE_CIRCULAR | In this mode the acquisition buffer is circular and never stops receiving.
Whenever the acquisition queue becomes full, the acquisition process will discard the newest received record. |
- The acquisition must be started using the mxfRxAcqStart() function.
- A read loop can be implemented using the mxfASCBRxAcqRead() function.
The MXF_ASCB_DATAREC structure must be used to read ASCB messages with acquisition service.
Example
ascb_bm.c
The example below shows how to configure the bus monitor and record a chunk of 100 ASCB messages.
#define MAX_MSG 100
HMXF_SERVER server=0;
HMXF_DEVICE device=0;
HMXF_MODULE module=0;
HMXF_CHANNEL bm=0;
HMXF_BUFFER buffer=0;
uint32 rc;
uint64 deviceCount=0;
uint64 deviceType = MXF_DEVICE_PCIE502;
uint64 moduleIndex = 0;
uint64 channelIndex = 0;
uint64 startTime = 0;
uint64 duration = 0;
uint64 status, msgCount, byteCount;
uint64 i;
uint32 w;
if(rc == MAXT_SUCCESS)
if(rc == MAXT_SUCCESS && deviceCount == 1)
{
if(rc == MAXT_SUCCESS)
if(rc == MAXT_SUCCESS)
{
if(rc == MAXT_SUCCESS)
rc =
mxfRxAcqStart(buffer, MXF_RXACQ_FLAG_DEFAULT, startTime, duration);
if(rc == MAXT_SUCCESS)
rc =
mxfASCBRxAcqRead(buffer, MAX_MSG,
sizeof(AcqASCB), &status, &msgCount, &byteCount, AcqASCB);
else
{
printf("Error code=0x%lX\n", rc);
return rc;
}
printf("ASCB Bus Monitor Acquisition Queue: %lld messages received\n", msgCount);
rec = AcqASCB;
for(i=0; i<msgCount; i++)
{
printf("| %llu | %08x | %4.4i |",
{
printf(
" %04x ", rec->
data[w]);
}
printf("\n");
}
if(rc != MAXT_SUCCESS)
{
printf("Error code=0x%lX\n", rc);
return rc;
}
printf("Acquisition stopped\n");
}
}