MX Foundation 4

Functions

uint32 mxfCanBusTxAperiodicWrite (HMXF_BUFFER buffer, uint64 options, uint64 startTime, uint64 count, MXF_CANBUS_DATAREC *rec)
 
uint32 mxfCanBusTxPeriodicUpdateMsgWrite (HMXF_BUFFER buffer, uint64 count, MXF_CANBUS_DATAREC *rec)
 
uint32 mxfCanBusRxAcqMsgSelectGet (HMXF_BUFFER buffer, uint64 maxCount, uint64 *count, uint64 *IDs)
 
uint32 mxfCanBusRxAcqMsgSelectSet (HMXF_BUFFER buffer, uint64 select, uint64 count, uint64 *IDs)
 
uint32 mxfCanBusRxAcqRead (HMXF_BUFFER buffer, uint64 maxMsgCount, uint64 maxByteCount, uint64 *status, uint64 *msgCount, uint64 *byteCount, MXF_CANBUS_DATAREC *rec)
 
uint32 mxfCanBusRxSamplingRead (HMXF_BUFFER buffer, uint64 flags, uint64 maxMsgCount, uint64 maxBytesCount, uint64 *msgCount, uint64 *byteCount, MXF_CANBUS_SAMPREC *rec)
 
uint32 mxfCanBusRxSamplingSingleRead (HMXF_BUFFER buffer, uint64 flags, uint64 ID, MXF_CANBUS_SAMPREC *rec)
 
uint32 mxfCanBusRxSamplingMsgSelectSet (HMXF_BUFFER buffer, uint64 select, uint64 count, uint64 *IDs)
 
uint32 mxfCanBusRxSamplingMsgSelectGet (HMXF_BUFFER buffer, uint64 maxCount, uint64 *count, uint64 *IDs)
 
uint32 mxfCanBusAsyncEventRxMsgSelectSet (HMXF_ASYNCEVENT asyncEvent, HMXF_CHANNEL channel, uint64 select, uint64 count, MXF_MSGID_CANBUS *msg)
 
uint32 mxfCanBusAsyncEventRxMsgSelectGet (HMXF_ASYNCEVENT asyncEvent, HMXF_CHANNEL channel, uint64 maxCount, uint64 *count, MXF_MSGID_CANBUS *msg)
 
uint32 mxfCanBusNextDataRecordPtrGet (MXF_CANBUS_DATAREC *currentRec, MXF_CANBUS_DATAREC **nextRec)
 
uint32 mxfCanBusNextSamplingRecordPtrGet (MXF_CANBUS_SAMPREC *currentRec, MXF_CANBUS_SAMPREC **nextRec)
 
uint32 mxfCanBusTimingCalculator (HMXF_CHANNEL channel, double speed, double errMax, uint64 max, uint64 *listCnt, MXF_CANBUS_TIMING_LIST *list)
 
uint32 mxfCanBusTimingSet (HMXF_CHANNEL channel, MXF_CANBUS_TIMING *timing)
 
uint32 mxfCanBusTimingGet (HMXF_CHANNEL channel, MXF_CANBUS_TIMING *timing)
 
uint32 mxfCanBusFdTimingCalculator (HMXF_CHANNEL channel, uint64 option, uint64 phase, double speed, double errMax, uint64 max, uint64 *listCnt, MXF_CANBUS_TIMING_LIST *list)
 
uint32 mxfCanBusFdTimingSet (HMXF_CHANNEL channel, MXF_CANBUS_FD_TIMING *timing)
 
uint32 mxfCanBusFdTimingGet (HMXF_CHANNEL channel, MXF_CANBUS_FD_TIMING *timing)
 
uint32 mxfCanBusStateSet (HMXF_CHANNEL channel, uint64 state)
 
uint32 mxfCanBusStateGet (HMXF_CHANNEL channel, uint64 *state)
 
uint32 mxfCanBusStatusGet (HMXF_CHANNEL channel, uint64 *status, uint64 *txErrorCnt, uint64 *rxErrorCnt)
 
uint32 mxfCanBusStatisticGet (HMXF_CHANNEL channel, MXF_CANBUS_STATS *stats)
 
uint32 mxfCanBusEmbeddedNVStorageFileMsgSelectSet (HMXF_CHANNEL channel, uint64 select, uint64 count, MXF_MSGID_CANBUS *msgid)
 
uint32 mxfCanBusEmbeddedNVStorageFileMsgSelectGet (HMXF_CHANNEL channel, uint64 maxCount, uint64 *count, MXF_MSGID_CANBUS *msgid)
 
uint32 mxfCanBusEmbeddedNVStorageFileMsgRead (HMXF_NVSTORAGE storage, uint64 fileIndex, uint64 maxRecCount, uint64 maxByteCount, uint64 *recCount, uint64 *byteCount, MXF_CANBUS_DATAREC *rec)
 
uint32 mxfCanBusEmbeddedNVStorageFileMsgWrite (HMXF_NVSTORAGE storage, uint64 fileIndex, uint64 maxRecCount, MXF_CANBUS_DATAREC *rec, uint64 *recCount)
 
uint32 mxfCanBusErrorInjectionSet (uint64 id, uint64 param, uint32 *errorInj)
 

Detailed Description

Function Documentation

uint32 mxfCanBusTxAperiodicWrite ( HMXF_BUFFER  buffer,
uint64  options,
uint64  startTime,
uint64  count,
MXF_CANBUS_DATAREC rec 
)
C#
public static extern UInt32 mxfCanBusTxAperiodicWrite(UInt64 buffer, UInt64 options, UInt64 startTime, UInt64 count, IntPtr rec);

Sends aperiodic data records for transmission. The data items to be transmitted are specified within the records, along with a time tag and a control word. The first data item is transmitted at the specified start time.

The records to transmit on time tag must be placed in chronological order in the array. The same time tag must not appear more than once in the array. When the start time is specified, the time tag of the first record or the start time should be at least 50 msec in advance to be relatively precise, otherwise it will be sent as soon as possible. Also, the cumulative time of all record’s time tag and the start time must be smaller than 30 seconds.

Note
This function is the specific version for CAN bus of the multi-protocol mxfTxAperiodicWrite() function.
Parameters
[in]bufferbuffer handle.
[in]optionsoptions for controlling the transmitter before for sending the data records. The details of the options are explained below.
  • MXF_TXAPERIODIC_FLAG_DEFAULT
  • MXF_TXAPERIODIC_FLAG_USE_RECORD_ABSOLUTE_TIME
  • MXF_TXAPERIODIC_FLAG_ABSOLUTE_START_TIME
  • MXF_TXAPERIODIC_FLAG_USE_RECORD_RELATIVE_TIME
[in]startTimestart time based on the timebase. This is the time at which the data held in the first record is transmitted by the device. The time is either expressed accordingly to the process time base or relative to the current real-time clock value (i.e. offset in the future). If the bit MXF_TXAPERIODIC_FLAG_ABSOLUTE_START_TIME of the transmit flag is set, then the start time is specified in absolute time (rather than relative). MXF_TXAPERIODIC_FLAG_USE_RECORD_ABSOLUTE_TIME or MXF_TXAPERIODIC_FLAG_USE_RECORD_RELATIVE_TIME options cannot be used with a start time.
[in]countnumber of records to write
[in]recrecords to write. The records in the buffer need to be indexed using the mxfCanBusNextDataRecordPtrGet() function.


The options parameter modifies the transmission scheme as described below;

  • MXF_TXAPERIODIC_FLAG_DEFAULT

    This is the default transmission flag, the scheduling priority defined when the buffer area was defined (see mxfTxAperiodicBufferAlloc()) is used to schedule transmissions.

    The time tag field is not used and must be set to 0. The records are transmitted with minimum delay between them.

  • MXF_TXAPERIODIC_FLAG_USE_RECORD_ABSOLUTE_TIME

    When set, the absolute transmit time of each data must be set in the record time tag. The time tag must be formatted according to the process time base.

    This flag cannot be used with MXF_TXAPERIODIC_FLAG_USE_RECORD_RELATIVE_TIME, MXF_TXAPERIODIC_FLAG_ABSOLUTE_START_TIME or a start time.

  • MXF_TXAPERIODIC_FLAG_USE_RECORD_RELATIVE_TIME

    When set, the relative transmit time of each data must be set in the record time tag. The process time base resolution is used, but the time base itself is ignored.

    This option causes transmission of the first record at the specified offset and transmission of the remaining records after a delay that is computed by subtracting the record time tag from the time tag of preceding records (i.e. delta time).

    Let’s assume N data records to be transmitted with the MXF_TXAPERIODIC_FLAG_USE_RECORD_RELATIVE_TIME.

    The actual record data transmit time will be computed as follows:

    Time rec1 = Transmission offset (min 50 msec)
    Time rec2 = Time rec1 + (rec2 time tag – rec1 time tag )
    Time rec3 = Time rec2 + (rec3 time tag – rec2 time tag )

    Time recN = Time recN-1 + (recN time tag - recN-1 time tag )

    This flag cannot be used with MXF_TXAPERIODIC_FLAG_USE_RECORD_ABSOLUTE_TIME, MXF_TXAPERIODIC_FLAG_ABSOLUTE_START_TIME or a start time.

  • MXF_TXAPERIODIC_FLAG_ABSOLUTE_START_TIME

    When set, the startTime parameter must be formatted according to the process time base.

    If not set, the startTime parameter is expressed as a relative time from the current real time clock value. The process time base resolution is used, but the time base itself is ignored.

    This flag cannot be used with MXF_TXAPERIODIC_FLAG_USE_RECORD_ABSOLUTE_TIME or MXF_TXAPERIODIC_FLAG_USE_RECORD_RELATIVE_TIME options.
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.2 and later.
See also
mxfTxAperiodicWrite()
mxfTxAperiodicBufferAlloc()
mxfTxAperiodicBufferStatusGet()
mxfTxAperiodicClear()
mxfSystemTimeBaseSet()
mxfCanBusNextDataRecordPtrGet()
Examples:
can_fd.c, canbus.c, and canbus.cs.
uint32 mxfCanBusTxPeriodicUpdateMsgWrite ( HMXF_BUFFER  buffer,
uint64  count,
MXF_CANBUS_DATAREC rec 
)
C#
public static extern UInt32 mxfCanBusTxPeriodicUpdateMsgWrite(UInt64 buffer, UInt64 count, IntPtr rec);

Writes messages of the record array into the specified buffer. The last message of each buffer is sent forever until a new message is written into the buffer.

Note
This function is the specific version for CAN bus of the multi-protocol mxfTxPeriodicUpdateMsgWrite() function.
Parameters
[in]bufferbuffer handle.
[in]countcount of records to write.
[in]recarray of record(s) to write. The records in the buffer need to be indexed using mxfCanBusNextDataRecordPtrGet() function.
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.3.8 and later.
See also
mxfTxPeriodicUpdateMsgWrite()
mxfTxPeriodicUpdateMsgBufferStatusGet()
mxfTxPeriodicUpdateMsgClear()
mxfCanBusNextDataRecordPtrGet()
Examples:
canbus_periodic.c, and canbus_sampling.c.
uint32 mxfCanBusRxAcqMsgSelectGet ( HMXF_BUFFER  buffer,
uint64  maxCount,
uint64 *  count,
uint64 *  IDs 
)
C#
public static extern UInt32 mxfCanBusRxAcqMsgSelectGet(UInt64 buffer, UInt64 maxCount, out UInt64 count, UInt64[] IDs);

Returns the list of IDs selected for acquisition.

Note
This function is the specific version for CAN bus of the multi-protocol mxfRxAcqMsgSelectGet() function.
Parameters
[in]bufferbuffer handle.
[in]maxCountmaximum number of labels in the array.
[out]countreturned number of labels in the label array.
[out]IDsaddress of the returned label array.
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.3.9 and later.
See also
mxfRxAcqMsgSelectGet()
mxfRxAcqBufferAlloc()
mxfRxAcqBufferGet()
mxfCanBusRxAcqMsgSelectSet()
uint32 mxfCanBusRxAcqMsgSelectSet ( HMXF_BUFFER  buffer,
uint64  select,
uint64  count,
uint64 *  IDs 
)
C#
public static extern UInt32 mxfCanBusRxAcqMsgSelectSet(UInt64 buffer, UInt64 select, UInt64 count, UInt64[] IDs);

public static extern UInt32 mxfCanBusRxAcqMsgSelectSet(UInt64 buffer, UInt64 select, UInt64 count, IntPtr IDs);

Selects or deselects the ID(s) to be acquired on the specified acquisition buffer.

Upon data arrival, the embedded process will check if the received ID is found in the current selection list. The receive data record will be added to the acquisition buffer only if the ID is found in the selection list, otherwise it is discarded.

By default, after a device reset, no filtering is performed and all IDs are received.

Note
count set to 0 with IDs set to NULL means ALL IDs.
This function is the specific version for CAN bus of the multi-protocol mxfRxAcqMsgSelectSet() function.
Parameters
[in]bufferbuffer handle.
[in]selectaction to perform with the labels array.
Option Description
MXF_MSG_SELECT_ONLY Replaces the current selection with the provided list.
[in]countnumber of entries in IDs.
[in]IDsaddress of array of IDs
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.3.9 and later.
See also
mxfRxAcqMsgSelectSet()
mxfRxAcqBufferAlloc()
mxfRxAcqBufferGet()
mxfCanBusRxAcqMsgSelectGet()
uint32 mxfCanBusRxAcqRead ( HMXF_BUFFER  buffer,
uint64  maxMsgCount,
uint64  maxByteCount,
uint64 *  status,
uint64 *  msgCount,
uint64 *  byteCount,
MXF_CANBUS_DATAREC rec 
)
C#
public static extern UInt32 mxfCanBusRxAcqRead(UInt64 buffer, UInt64 maxRecCount, UInt64 maxByteCount, out UInt64 status, out UInt64 recCount, out UInt64 byteCount, IntPtr rec);

Transfers the records from the channel acquisition buffer to the calling application.

Note
This function is the specific version for CAN bus of the multi-protocol mxfRxAcqRead() function.
Parameters
[in]bufferbuffer handle.
[in]maxMsgCountmaximum records to read (0 means all messages).
[in]maxByteCountmaximum number of bytes to be read.
[out]statuslast status set.
[out]msgCountnumber of records returned.
[out]byteCountnumber of bytes returned.
[out]recaddress of data records. The records in the buffer need to be indexed using the mxfCanBusNextDataRecordPtrGet() function.
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.2 and later.
See also
mxfRxAcqRead()
mxfRxAcqStart()
mxfRxAcqBufferAlloc()
mxfRxAcqStop()
mxfCanBusNextDataRecordPtrGet()
Examples:
can_fd.c, canbus.c, canbus.cs, and canbus_periodic.c.
uint32 mxfCanBusRxSamplingRead ( HMXF_BUFFER  buffer,
uint64  flags,
uint64  maxMsgCount,
uint64  maxBytesCount,
uint64 *  msgCount,
uint64 *  byteCount,
MXF_CANBUS_SAMPREC rec 
)
C#
public static extern UInt32 mxfCanBusRxSamplingRead(UInt64 buffer, UInt64 flags, UInt64 maxRecCount, UInt64 maxBytesCount, out UInt64 recCount, out UInt64 byteCount, IntPtr rec);

Reads all sampling records from the sampling buffer to the application buffer.

The sampling process maintains records for all of the received IDs. An ID is considered received if corresponding data words were received within the kill-time period. A record refresh from the receive port resets the kill-time timer and an updated copy is made available to the application.

The sampling record contains information on the arrival rate and the number of errors, as well as the latest data received for that ID.

Note
This function is the specific version for CAN bus of the multi-protocol mxfRxSamplingRead() function.
Parameters
[in]bufferbuffer handle.
[in]flagsoption flag.
Flags Description
MXF_RXSAMPLING_FLAG_DEFAULT The record is kept in the buffer and the same record can be read again by the current or another application.
MXF_RXSAMPLING_FLAG_ERASE_WHEN_READ After the sampling record is returned, it is removed from the buffer.
[in]maxMsgCountmaximum number of messages to read (0 means all messages).
[in]maxBytesCountmaximum number of bytes to read.
[out]msgCountnumber of messages returned.
[out]byteCountnumber of bytes returned.
[out]recarray of sampling record structure. The records in the buffer need to be indexed using mxfCanBusNextSamplingRecordPtrGet().
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.3.9 and later.
See also
mxfRxSamplingRead()
mxfRxSamplingBufferAlloc()
mxfCanBusRxSamplingMsgSelectSet()
mxfRxSamplingStart()
mxfCanBusNextSamplingRecordPtrGet()
Examples:
canbus_sampling.c.
uint32 mxfCanBusRxSamplingSingleRead ( HMXF_BUFFER  buffer,
uint64  flags,
uint64  ID,
MXF_CANBUS_SAMPREC rec 
)
C#
public static extern UInt32 mxfCanBusRxSamplingSingleRead(UInt64 buffer, UInt64 flags, UInt64 ID, IntPtr rec);

Reads a specific sampling record from the sampling buffer.

Note
This function is the specific version for CAN bus of the multi-protocol mxfRxSamplingSingleRead() function.
Parameters
[in]bufferbuffer handle.
[in]flagsoption flag.
Flags Description
MXF_RXSAMPLING_FLAG_DEFAULT The record is kept in the buffer and the same record can be read again by the current or another application.
MXF_RXSAMPLING_FLAG_ERASE_WHEN_READ After the sampling record is returned, it is removed from the buffer.
[in]IDmessage ID.
[out]recaddress of sampling record.
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.3.9 and later.
See also
mxfRxSamplingSingleRead()
mxfRxSamplingBufferAlloc()
mxfRxSamplingMsgSelectSet()
mxfRxSamplingStart()
mxfRxSamplingStop()
uint32 mxfCanBusRxSamplingMsgSelectSet ( HMXF_BUFFER  buffer,
uint64  select,
uint64  count,
uint64 *  IDs 
)
C#
public static extern UInt32 mxfCanBusRxSamplingMsgSelectSet(UInt64 buffer, UInt64 select, UInt64 count, UInt64[] IDs);

public static extern UInt32 mxfCanBusRxSamplingMsgSelectSet(UInt64 buffer, UInt64 select, UInt64 count, IntPtr IDs);

Selects or deselects the ID(s) to be received on the specified sampling buffer.

Upon data arrival, the embedded process checks if the received ID is defined in the current selection list. The receive data record will be added to the sampling buffer only if the ID was added previously in the selection list, otherwise it is discarded.

By default, after a device reset, no filtering is performed and all IDs are received.

Note
count set to 0 with IDs set to NULL means ALL IDs.
This function is the specific version for CAN bus of the multi-protocol mxfRxSamplingMsgSelectSet() function.
Parameters
[in]bufferbuffer handle.
[in]selectaction to perform with the message ID array.
Option Description
MXF_MSG_DESELECT Deselects the ID(s).
MXF_MSG_SELECT_ADD Adds the specified ID(s).
MXF_MSG_SELECT_ONLY Replaces the current selection with the provided list.
[in]countcount of IDs in the array.
[in]IDsaddress of array of ID(s).
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.3.9 and later.
See also
mxfRxSamplingMsgSelectSet()
mxfRxSamplingBufferAlloc()
mxfRxSamplingStart()
mxfCanBusRxSamplingRead()
mxfCanBusRxSamplingMsgSelectGet()
Examples:
canbus_sampling.c.
uint32 mxfCanBusRxSamplingMsgSelectGet ( HMXF_BUFFER  buffer,
uint64  maxCount,
uint64 *  count,
uint64 *  IDs 
)
C#
public static extern UInt32 mxfCanBusRxSamplingMsgSelectGet(UInt64 buffer, UInt64 maxCount, out UInt64 count, UInt64[] IDs);

Returns the list of IDs selected for sampling.

Note
This function is the specific version for CAN bus of the multi-protocol mxfRxSamplingMsgSelectGet() function.
Parameters
[in]bufferbuffer handle.
[in]maxCountmaximum number of IDs in the array IDs.
[out]countreturned number of IDs in the IDs array.
[out]IDsaddress of the returned IDs array.
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.3.9 and later.
See also
mxfRxSamplingMsgSelectGet()
mxfRxSamplingBufferAlloc()
mxfRxSamplingStart()
mxfACanBusRxSamplingRead()
mxfCanBusRxSamplingMsgSelectSet()
uint32 mxfCanBusAsyncEventRxMsgSelectSet ( HMXF_ASYNCEVENT  asyncEvent,
HMXF_CHANNEL  channel,
uint64  select,
uint64  count,
MXF_MSGID_CANBUS msg 
)
C#
public static extern UInt32 mxfCanBusAsyncEventRxMsgSelectSet(UInt64 asyncEvent, UInt64 channel, UInt64 select, UInt64 count, MXF_MSGID_CANBUS[] msg);

public static extern UInt32 mxfCanBusAsyncEventRxMsgSelectSet(UInt64 asyncEvent, UInt64 channel, UInt64 select, UInt64 count, IntPtr msg);

Selects or deselects the ID (message id) for MXF_ASYNCEVENT_COND_RX_MSG condition on a specified RX channel.

The function must be called in addition to the mxfAsyncEventConditionsSet() function with MXF_ASYNCEVENT_COND_RX_MSG condition to cause an asynchronous event to occur when a specific ID is received.

The message selection must be made by only one asynchronous event routine for a specific channel. Otherwise, an error code will be returned while conditions of other asynchronous event routines are present.

In this case, you must disable the MXF_ASYNCEVENT_COND_RX_MSG condition using mxfAsyncEventConditionsSet() function using another asynchronous event handle.

Note
count set to 0 with msg set to NULL means ALL IDs.
This function is the specific version for CAN bus of the multi-protocol mxfAsyncEventRxMsgSelectSet() function.
Parameters
[in]asyncEventasynchronous event handle.
[in]channelchannel handle.
[in]selectaction to perform for the message ID.
Action Description
MXF_MSG_DESELECT Deselects the messages id.
MXF_MSG_SELECT_ADD Adds the specified messages id.
MXF_MSG_SELECT_ONLY Replaces the current selection with the provided list.
[in]countcount of messages id.
[in]msgaddress of array of message id.
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.3.9 and later.
See also
mxfAsyncEventRxMsgSelectSet()
mxfAsyncEventHandlerInit()
mxfCanBusAsyncEventRxMsgSelectGet()
mxfAsyncEventConditionsSet()
uint32 mxfCanBusAsyncEventRxMsgSelectGet ( HMXF_ASYNCEVENT  asyncEvent,
HMXF_CHANNEL  channel,
uint64  maxCount,
uint64 *  count,
MXF_MSGID_CANBUS msg 
)
C#
public static extern UInt32 mxfCanBusAsyncEventRxMsgSelectGet(UInt64 asyncEvent, UInt64 channel, UInt64 maxCount, out UInt64 count, [Out] MXF_MSGID_CANBUS[] msgid);

Returns the list of message IDs registered for a specified RX channel for the MXF_ASYNCEVENT_COND_RX_MSG asynchronous event condition ID.

Note
This function is the specific version for CAN bus of the multi-protocol mxfAsyncEventRxMsgSelectGet() function.
Parameters
[in]asyncEventasynchronous event handle.
[in]channelchannel handle.
[in]maxCountmaximum ID messages expected.
[out]countnumber of ID messages returned.
[out]msgreturned message ID array.
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.3.9 and later.
See also
mxfAsyncEventRxMsgSelectGet()
mxfAsyncEventHandlerInit()
mxfCanBusAsyncEventRxMsgSelectSet()
mxfAsyncEventConditionsSet()
uint32 mxfCanBusNextDataRecordPtrGet ( MXF_CANBUS_DATAREC currentRec,
MXF_CANBUS_DATAREC **  nextRec 
)
C#
public static extern UInt32 mxfCanBusNextDataRecordPtrGet(IntPtr currentRec, out IntPtr nextRec);

Returns the next buffer address in a MXF_CANBUS_DATAREC buffer array.

Note
This function is the specific version for CAN bus of the multi-protocol mxfNextRecordPtrGet() function.
Parameters
[in]currentRecpointer to the beginning or the current record in the buffer.
[out]nextRecpointer to next record in the buffer.
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.2 and later.
See also
mxfNextRecordPtrGet()
mxfCanBusRxAcqRead()
mxfCanBusTxAperiodicWrite()
Examples:
can_fd.c, canbus.c, canbus.cs, and canbus_periodic.c.
uint32 mxfCanBusNextSamplingRecordPtrGet ( MXF_CANBUS_SAMPREC currentRec,
MXF_CANBUS_SAMPREC **  nextRec 
)
C#
public static extern UInt32 mxfCanBusNextSamplingRecordPtrGet(IntPtr currentRec, out IntPtr nextRec);

Returns the next buffer address in a MXF_CANBUS_SAMPREC buffer array.

Note
This function is the specific version for CAN bus of the multi-protocol mxfNextRecordPtrGet() function.
Parameters
[in]currentRecpointer to the beginning or the current record in the buffer.
[out]nextRecpointer to next record in the buffer.
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.3.9 and later.
See also
mxfNextRecordPtrGet()
mxfCanBusRxSamplingRead()
mxfCanBusNextDataRecordPtrGet()
Examples:
canbus_sampling.c.
uint32 mxfCanBusTimingCalculator ( HMXF_CHANNEL  channel,
double  speed,
double  errMax,
uint64  max,
uint64 *  listCnt,
MXF_CANBUS_TIMING_LIST list 
)
C#
public static extern UInt32 mxfCanBusTimingCalculator(UInt64 channel, double speed, double errMax, UInt64 max, out UInt64 listCnt, [Out] MXF_CANBUS_TIMING_LIST[] list);

Returns a list of possible timing for the requested speed and precision. Item from this list can then be used to create the timing structure for mxfCanBusTimingSet().

Parameters
[in]channelchannel handle
[in]speedrequested speed timing (in bps)
Values [10000 .. 1000000]
[in]errMaxmaximum deviation from requested speed (in %)
Values [0.0 .. 25.0]
[in]maxmaximum number of item to return (1-256)
[out]listCntnumber of item returned
[out]listlist of possible timing
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.2 and later.
See also
mxfCanBusTimingSet()
mxfCanBusFdTimingCalculator()
uint32 mxfCanBusTimingSet ( HMXF_CHANNEL  channel,
MXF_CANBUS_TIMING timing 
)
C#
public static extern UInt32 mxfCanBusTimingSet(UInt64 channel, ref MXF_CANBUS_TIMING timing);

Set the CAN Bit timing for the specified channel. mxfCanBusTimingCalculator() can be used to get possible timings.

Parameters
[in]channelchannel handle
[in]timingtiming to set
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.2 and later.
See also
mxfCanBusTimingGet()
mxfCanBusTimingCalculator()
mxfCanBusFdTimingSet()
Examples:
canbus.c, and canbus.cs.
uint32 mxfCanBusTimingGet ( HMXF_CHANNEL  channel,
MXF_CANBUS_TIMING timing 
)
C#
public static extern UInt32 mxfCanBusTimingGet(UInt64 channel, out MXF_CANBUS_TIMING timing);

Get the CAN Bit timing for the specified channel.

Parameters
[in]channelchannel handle
[out]timingcurrent timing set
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.2 and later.
See also
mxfCanBusTimingSet()
mxfCanBusFdTimingGet()
uint32 mxfCanBusFdTimingCalculator ( HMXF_CHANNEL  channel,
uint64  option,
uint64  phase,
double  speed,
double  errMax,
uint64  max,
uint64 *  listCnt,
MXF_CANBUS_TIMING_LIST list 
)
C#
public static extern UInt32 mxfCanBusFdTimingCalculator(UInt64 channel, UInt64 option, UInt64 phase, double speed, double errMax, UInt64 max, out UInt64 listCnt, [Out] MXF_CANBUS_TIMING_LIST[] list);

Returns a list of possible timing for the requested speed and precision. Item from this list can then be used to create the timing structure for mxfCanBusFdTimingSet().

Parameters
[in]channelchannel handle
[in]optionReseved for future use, must be set to 0.
[in]phaseBit timing phase
Phase Description
MXF_CANBUS_TIMING_PHASE_NOMINAL Nominal phase
MXF_CANBUS_TIMING_PHASE_DATA Data phase
[in]speedrequested speed timing (in bps)
Values [10000 .. 1000000] in nominal phase
Values [20000 .. 8000000] in data phase
[in]errMaxmaximum deviation from requested speed (in %)
Values [0.0 .. 25.0]
[in]maxmaximum number of item to return (1-256)
[out]listCntnumber of item returned
[out]listlist of possible timing
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.4.0 and later.
See also
mxfCanBusFdTimingSet()
uint32 mxfCanBusFdTimingSet ( HMXF_CHANNEL  channel,
MXF_CANBUS_FD_TIMING timing 
)
C#
public static extern UInt32 mxfCanBusFdTimingSet(UInt64 channel, ref MXF_CANBUS_FD_TIMING timing);

Set the CAN Bit timing for the specified channel. mxfCanBusFdTimingCalculator() can be used to get possible timings.

Parameters
[in]channelchannel handle
[in]timingtiming to set
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.4.0 and later.
See also
mxfCanBusFdTimingGet()
mxfCanBusFdTimingCalculator()
mxfCanBusTimingSet()
Examples:
can_fd.c.
uint32 mxfCanBusFdTimingGet ( HMXF_CHANNEL  channel,
MXF_CANBUS_FD_TIMING timing 
)
C#
public static extern UInt32 mxfCanBusFdTimingGet(UInt64 channel, out MXF_CANBUS_FD_TIMING timing);

Get the CAN Bit timing for the specified channel.

Parameters
[in]channelchannel handle
[out]timingcurrent timing set
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.4.0 and later.
See also
mxfCanBusFdTimingSet()
mxfCanBusTimingGet()
uint32 mxfCanBusStateSet ( HMXF_CHANNEL  channel,
uint64  state 
)
C#
public static extern UInt32 mxfCanBusStateSet(UInt64 channel, UInt64 state);

Set the bus state for the specified channel. Setting the bus to MXF_CANBUS_BUS_STATE_OFF then another state will reset the statistics counters and transmit/receive error count.

Parameters
[in]channelchannel handle
[in]statebus state
Bus State Description
MXF_CANBUS_BUS_STATE_OFF Disconnect from the bus
MXF_CANBUS_BUS_STATE_ON Connect to the bus
MXF_CANBUS_BUS_STATE_ON_RXONLY Connect to the bus in receive only mode
MXF_CANBUS_BUS_STATE_ON_SELFTEST Connect to the bus in selftest mode (STATE_ON but no ACK)
MXF_CANBUS_BUS_STATE_ON_INTERNAL_LOOPBACK Connect to the bus in internal loopback mode
MXF_CANBUS_BUS_STATE_ON_RESTRICTED Connect to the bus in restricted mode
Note
Setting the speed and the CAN mode require the bus to be set to MXF_CANBUS_BUS_STATE_OFF first.
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.2 and later.
See also
mxfCanBusStateGet()
Examples:
can_fd.c, canbus.c, canbus.cs, canbus_periodic.c, and canbus_sampling.c.
uint32 mxfCanBusStateGet ( HMXF_CHANNEL  channel,
uint64 *  state 
)
C#
public static extern UInt32 mxfCanBusStateGet(UInt64 channel, out UInt64 state);

Get the bus state for the specified channel.

Parameters
[in]channelchannel handle
[out]statebus state
Bus State Description
MXF_CANBUS_BUS_STATE_OFF Disconnected from the bus
MXF_CANBUS_BUS_STATE_ON Connected to the bus
MXF_CANBUS_BUS_STATE_ON_RXONLY Connected to the bus in receive only mode
MXF_CANBUS_BUS_STATE_ON_SELFTEST Connected to the bus in selftest mode
MXF_CANBUS_BUS_STATE_ON_INTERNAL_LOOPBACK Connected to the bus in internal loopback mode
MXF_CANBUS_BUS_STATE_ON_RESTRICTED Connect to the bus in restricted mode
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.2 and later.
See also
mxfCanBusStateSet()
mxfCanBusStatusGet()
uint32 mxfCanBusStatusGet ( HMXF_CHANNEL  channel,
uint64 *  status,
uint64 *  txErrorCnt,
uint64 *  rxErrorCnt 
)
C#
public static extern UInt32 mxfCanBusStatusGet(UInt64 channel, out UInt64 status, out UInt64 txErrorCnt, out UInt64 rxErrorCnt);

Get the bus status for the specified channel.

Parameters
[in]channelchannel handle
[out]statusbus status
Bus State Description
MXF_CANBUS_BUS_STATUS_OFF Disconnected from the bus
MXF_CANBUS_BUS_STATUS_ON Connected to the bus
MXF_CANBUS_BUS_STATUS_ERROR_PASSIVE Connected to the bus in error passive mode
MXF_CANBUS_BUS_STATUS_ERROR_OFF Disconnected from the bus due to error count
[out]txErrorCntBus transmit error count
[out]rxErrorCntBus receive error count
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.2 and later.
See also
mxfCanBusStateGet()
mxfCanBusStatisticGet()
Examples:
can_fd.c, canbus.c, and canbus.cs.
uint32 mxfCanBusStatisticGet ( HMXF_CHANNEL  channel,
MXF_CANBUS_STATS stats 
)
C#
public static extern UInt32 mxfCanBusStatisticGet(UInt64 channel, out MXF_CANBUS_STATS stats);

Get the statistics for the specified channel. Statistics are reset when the bus state changes to ON.

Parameters
[in]channelchannel handle
[out]statsstatistics
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.2 and later.
See also
mxfCanBusStateGet()
mxfCanBusStatusGet()
Examples:
can_fd.c, canbus.c, and canbus.cs.
uint32 mxfCanBusEmbeddedNVStorageFileMsgSelectSet ( HMXF_CHANNEL  channel,
uint64  select,
uint64  count,
MXF_MSGID_CANBUS msgid 
)
C#
public static extern UInt32 mxfCanBusEmbeddedNVStorageFileMsgSelectSet(UInt64 channel, UInt64 select, UInt64 count, MXF_MSGID_CANBUS[] msgid);

public static extern UInt32 mxfCanBusEmbeddedNVStorageFileMsgSelectSet(UInt64 channel, UInt64 select, UInt64 count, IntPtr msgId);

Selects / deselects the specified message IDs on a channel for automatic embedded non-volatile storage recording.

Note
This function should be called before the function mxfEmbeddedNVStorageFileMsgSelectEnableSet() that starts the logging of messages on file for the specific channel.
count set to 0 with a msg set to NULL means ALL message IDs.
This function is the specific version for CAN bus of the multi-protocol mxfEmbeddedNVStorageFileMsgSelectSet() function.
Parameters
[in]channelchannel handle
[in]selectaction to perform with the provided selection list
Action Description
MXF_MSG_DESELECT Deselects the messages
MXF_MSG_SELECT_ADD Adds the specified messages
MXF_MSG_SELECT_ONLY Replaces the current selection with the provided list
[in]countcount of messages
[in]msgidpointer to an array of message identifiers.
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.3.9 and later.
See also
mxfModuleChannelAllGet()
mxfEmbeddedNVStorageHandleGet()
mxfEmbeddedNVStorageFileMsgSelectEnableSet()
mxfEmbeddedNVStorageFileMsgSelectGet()
uint32 mxfCanBusEmbeddedNVStorageFileMsgSelectGet ( HMXF_CHANNEL  channel,
uint64  maxCount,
uint64 *  count,
MXF_MSGID_CANBUS msgid 
)
C#
public static extern UInt32 mxfCanBusEmbeddedNVStorageFileMsgSelectGet(UInt64 channel, UInt64 maxCount, out UInt64 count, [Out] MXF_MSGID_CANBUS[] msgid);

Returns the specific message IDs registered on a channel for automatic embedded non-volatile storage recording.

Note
This function is the specific version for CAN bus of the multi-protocol mxfEmbeddedNVStorageFileMsgSelectGet() function.
Parameters
[in]channelchannel handle.
[in]maxCountmaximum count of messages return in the array
[out]countcount of messages returned
[out]msgidpointer to an array of message identifiers.
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.3.9 and later.
See also
mxfModuleChannelAllGet()
mxfEmbeddedNVStorageHandleGet()
mxfEmbeddedNVStorageFileMsgSelectSet()
mxfEmbeddedNVStorageFileMsgSelectEnableSet()
uint32 mxfCanBusEmbeddedNVStorageFileMsgRead ( HMXF_NVSTORAGE  storage,
uint64  fileIndex,
uint64  maxRecCount,
uint64  maxByteCount,
uint64 *  recCount,
uint64 *  byteCount,
MXF_CANBUS_DATAREC rec 
)
C#
public static extern UInt32 mxfCanBusEmbeddedNVStorageFileMsgRead(UInt64 storage, UInt64 fileIndex, UInt64 maxRecCount, UInt64 maxByteCount, out UInt64 recCount, out UInt64 byteCount, IntPtr rec);

Reads the records from a specific file. The messages format must be of type MXF_EMBEDDED_NVSTORAGE_MSGTYPE_CANBUS.

Note
This function is the specific version for CAN bus of the multi-protocol mxfEmbeddedNVStorageFileMsgRead() function.
Parameters
[in]storagenon-volatile storage handle
[in]fileIndexfile index
[in]maxRecCountmaximum number of messages that can be returned
[in]maxByteCountmaximum byte count that can be returned
[out]recCountcount of messages returned
[out]byteCountnumber of bytes returned in the msg buffer
[out]recpointer to read buffer containing messages. The records in the buffer need to be indexed using the mxfCanBusNextDataRecordPtrGet() function.
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.2 and later.
See also
mxfEmbeddedNVStorageHandleGet()
mxfEmbeddedNVStorageFileStatusGet()
uint32 mxfCanBusEmbeddedNVStorageFileMsgWrite ( HMXF_NVSTORAGE  storage,
uint64  fileIndex,
uint64  maxRecCount,
MXF_CANBUS_DATAREC rec,
uint64 *  recCount 
)
C#
public static extern UInt32 mxfCanBusEmbeddedNVStorageFileMsgWrite(UInt64 storage, UInt64 fileIndex, UInt64 maxRecCount, IntPtr rec, out UInt64 recCount);

Writes messages to the specified file. The messages format must be of type MXF_EMBEDDED_NVSTORAGE_MSGTYPE_CANBUS.

Note
This function is the specific version for CAN bus of the multi-protocol mxfEmbeddedNVStorageFileMsgWrite() function.
Parameters
[in]storagenon-volatile storage handle
[in]fileIndexfile index
[in]maxRecCountmaximum number of messages to write
[in]recpointer to messages to write. The records in the buffer need to be indexed using mxfCanBusNextDataRecordPtrGet() function.
[out]recCountnumber of messages actually written
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.2 and later.
See also
mxfEmbeddedNVStorageHandleGet()
mxfEmbeddedNVStorageFileStatusGet()
uint32 mxfCanBusErrorInjectionSet ( uint64  id,
uint64  param,
uint32 *  errorInj 
)
C#
public static extern UInt32 mxfCanBusErrorInjectionSet(UInt64 id, UInt64 param, out UInt32 errorInj);

Helper function to build the error ID and parameter for MXF_CANBUS_DATAREC.errorInj field.

Parameters
[in]iderror ID
[in]paramerror parameter
[out]errorInjreturned built errorInj field
Returns
MAXT_SUCCESS is returned when the function has succeeded.
Refer to mxf_error.h for a list of defined errors.
Call mxfSystemErrorStringGet() to transform the return code into a text string.
Availability:
Available in MX Foundation 4.4.0 and later.
See also
MXF_CANBUS_DATAREC.errorInj
Examples:
can_fd.c, canbus.c, and canbus.cs.
Updated 10/23/2023