While a schedule runs, the ARINC 708 data can be updated asynchronously by the main application using the mxfA708TxPeriodicUpdateMsgWrite() function.
The next example shows how to use some functions for updating a transmission buffer.
Scheduling a Message
The program below shows how to define a single message with mxfTxPeriodicScheduleSingleMsgAdd() for scheduling that will be later updated while the schedule runs.
The example in the next section shows how to update the records dynamically.
ar708_buffer_threshold.c
uint32 rc;
HMXF_SCHED schedule=0;
HMXF_SCHED_MSG msgSched;
HMXF_CHANNEL txChannel;
HMXF_BUFFER txBuffer=0;
size_t txBufferSize;
...
if(!rc)
{
if(!rc)
{
if(!txHostBuffer)
rc = MAXT_ERROR_MEM;
}
}
if(!rc)
if(!rc)
if(!rc)
if(!rc)
{
printf("Running periodic transmission...\n\r");
}
if(txHostBuffer)
free(txHostBuffer)
...
Updating the buffer
The value of the ARINC 708 data sent can be updated while a background schedule runs.
The example below shows how the mxfA708TxPeriodicUpdateMsgWrite() function can be used to perform the update operation.
The update loop changes every 5ms and stops after two seconds.
ar708_buffer_threshold.c
#define TXALMOSTFULL 100
uint32 rc=0;
uint16 i, bin;
static uint32 TXAsyncEvents=0;
static uint16 scanAngle=0;
static uint16 binValue=0;
...
for(i=0; !rc && i<TXALMOSTFULL; i++, scanAngle++)
{
if(scanAngle > 720)
{
scanAngle = 0;
binValue++;
}
setLabel(recPtr, 055);
setCtrlAccept(recPtr, 0x3);
setMode(recPtr, 1);
setTilt(recPtr, 0);
setGain(recPtr, -16);
setRange(recPtr, 80);
setDataAccept(recPtr, 3);
setScanAngle(recPtr, ((double)scanAngle*0.25)+270);
for(bin=1; bin<=512; bin++)
{
setBin(recPtr, bin, binValue);
}
if(!rc)
}
if(!rc)
if(rc)
printf("Periodic Update failed; rc=0x%08x\n", rc);
else
printf("\nAsync Event %d - Writing %d records\n", ++TXAsyncEvents, i);
...