Skip to main content
Version: 4.00

API Details (Common)

This page describes details of common APIs available in this product.

Read This First​

API Quick Reference (Constants / Structures / Preconditions / Minimal Examples)​

APIConstants used by this APIStructures used by this APICallable precondition statusMinimal code examples (C++/C#/VBA)
MPXGetAPIVersionAPI Return ValuesStMPXAPIVersionNot recognized / RecognizedCommon First
MPXOpenAPI Return ValuesStMPXDeviceInfoNot recognizedCommon First
MPXCloseAPI Return Values-RecognizedCommon First
MPXSetLEDLED Settings-RUN/PARAMCommon First
MPXGetStatusMicroPeckerX Status-RecognizedCommon First
MPXMonitorStartSync Mode, MicroPeckerX Status-PARAMCommon First
MPXMonitorStopAPI Return Values-SYNC/NONE/MON/SIMCommon First
MPXGetTimeStampAPI Return Values-NONE/MON/SIMCommon First
MPXSetGetLogModeLog Acquisition Mode-RUN/PARAMCAN C# Sample, LIN VBA Sample
MPXGetLogBuffer Overrun PresenceStMPXLogNONE/MON/SIMCAN C++ Sample, LIN C++ Sample

Notation​

On this page, each API is described in the following format.

Format[Function type] [Function name]([argument], ...)
Argument[Argument type][Argument name][in/out][Argument description]
Return value[Return type][Return value (error code)][Description of return value (error code)]
Function[Function behavior]
Note[Supplementary information]

If an argument type is a structure, refer to Structure Definitions (struct) for values to set or values that are set.

For [in/out], in means set by caller before invocation, and out means set by the function during processing.

API Details​

MPXGetAPIVersion​

Gets version information of this API.

FormatER MPXGetAPIVersion(StMPXAPIVersion * Version)
ArgumentStMPXAPIVersion *VersionoutAPI version information
Return valueERE_OKSuccess
E_PARAMParameter error (for example, NULL pointer)
FunctionGets version information of this API.

MPXOpen​

Detects connected MicroPeckerX device(s).

FormatER MPXOpen(StMPXDeviceInfo * Devices, uint8_t Num, uint8_t * Count)
ArgumentStMPXDeviceInfo *Devicesin/outDevice information structure array
uint8_tNuminNumber of elements in device information structure array
uint8_t *CountoutNumber of detected MicroPeckerX devices
Return valueERE_OKSuccess
E_DEVICEDevice not found
E_COMMCommunication error
E_TIMEOUTCommunication timeout
FunctionDetects MicroPeckerX devices connected to the PC.
Set Devices to a structure array for storing detected device information, and set Num to the array length.
Number of acquired device entries is returned in Count.
NoteIf multiple MicroPeckerX devices are connected, up to Num devices (maximum 4) can be detected at the same time. However, you cannot arbitrarily choose which specific devices are detected.

MPXClose​

Releases detection of MicroPeckerX device(s).

FormatER MPXClose(void)
Return valueERE_OKSuccess
FunctionReleases all currently detected MicroPeckerX devices.

MPXSetLED​

Controls LEDs on MicroPeckerX.

FormatER MPXSetLED(uint32_t Serial, uint8_t LEDRed, uint8_t LEDGreen, uint8_t LEDGreenBlink, uint8_t LEDYellow, uint8_t LEDYellowBlink)
Argumentuint32_tSerialinSerial number of target MicroPeckerX device
uint8_tLEDRedinRed LED on/off (see LED Settings)
uint8_tLEDGreeninGreen LED on/off (see LED Settings)
uint8_tLEDGreenBlinkinGreen LED blinking on/off (see LED Settings)
uint8_tLEDYellowinYellow LED on/off (see LED Settings)
uint8_tLEDYellowBlinkinYellow LED blinking on/off (see LED Settings)
Return valueERE_OKSuccess
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_TIMEOUTCommunication timeout
FunctionControls LEDs of the device specified by Serial.
Red LED turns on with MPX_LED_ON and off with MPX_LED_OFF.
Green LED turns on with MPX_LED_ON and off with MPX_LED_OFF. If LEDGreenBlink is MPX_LED_ON, it blinks regardless of LEDGreen.
Yellow LED turns on with MPX_LED_ON and off with MPX_LED_OFF. If LEDYellowBlink is MPX_LED_ON, it blinks regardless of LEDYellow.

MPXGetStatus​

Gets status of MicroPeckerX device.

FormatER MPXGetStatus(uint32_t Serial, uint16_t * StatusCh1, uint16_t * StatusCh2)
Argumentuint32_tSerialinSerial number of target MicroPeckerX device
uint16_t *StatusCh1outStatus of CH1 (see MicroPeckerX Status)
uint16_t *StatusCh2outStatus of CH2 (see MicroPeckerX Status)
Return valueERE_OKSuccess
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_TIMEOUTCommunication timeout
FunctionGets status of each channel for the device specified by Serial.

MPXMonitorStart​

Starts monitoring.

FormatER MPXMonitorStart(uint32_t Serial, uint8_t SyncMode)
Argumentuint32_tSerialinSerial number of target MicroPeckerX device
uint8_tSyncModeinSync mode (see Sync Mode)
Return valueERE_OKSuccess
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionStarts monitoring on the device specified by Serial.
MPX_SYNC_MASTER runs in master mode, and MPX_SYNC_SLAVE runs in slave mode.
For CAN communication, if slot information has been set by MPXCANSetSlot, frame transmission also starts for slots whose frame type is MPX_CAN_FRAME_TYPE_PERIODIC or MPX_CAN_FRAME_TYPE_EVENTPERIODIC.
For LIN communication, if master simulation has been set by MPXLINSetMasterSim, frame transmission also starts using the schedule selected by MPXLINChangeMasterSchedule.
NoteBefore calling this API, you must set communication parameters by calling MPXCANSetParam or MPXLINSetParam.
When operating multiple devices, start monitoring on all slave-mode devices first, then start monitoring on master-mode devices.

MPXMonitorStop​

Stops monitoring.

FormatER MPXMonitorStop(uint32_t Serial, uint32_t * mSec, uint16_t * uSec)
Argumentuint32_tSerialinSerial number of target MicroPeckerX device
uint32_t *mSecoutTimestamp (milliseconds)
uint16_t *uSecoutTimestamp (microseconds)
Return valueERE_OKSuccess
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionStops monitoring on the device specified by Serial and gets timestamp at that point.
Timestamp values in mSec and uSec indicate that logs received up to that point are guaranteed.
NoteWhen operating multiple devices, stop monitoring on master-mode devices first, then stop monitoring on slave-mode devices in sequence.

MPXGetTimeStamp​

Gets timestamp.

FormatER MPXGetTimeStamp(uint32_t Serial, uint32_t * mSec, uint16_t * uSec)
Argumentuint32_tSerialinSerial number of target MicroPeckerX device
uint32_t *mSecoutTimestamp (milliseconds)
uint16_t *uSecoutTimestamp (microseconds)
Return valueERE_OKSuccess
E_PARAMParameter error
E_DEVICEDevice not found
E_COMMCommunication error
E_STATUSStatus error
E_TIMEOUTCommunication timeout
FunctionGets current timestamp of the device specified by Serial.
Acquired timestamp is set to mSec and uSec.
NoteTimestamp values set to mSec and uSec may have time lag from actual function call timing.

MPXSetGetLogMode​

Sets how to acquire monitoring log data (TX/RX data).

FormatER MPXSetGetLogMode(uint32_t Serial, uint8_t InnerCh, uint8_t Mode)
Argumentuint32_tSerialinSerial number of target MicroPeckerX device
uint8_tInnerChinTarget CH number (1 or 2)
uint8_tModeinLog acquisition mode (see Log Acquisition Mode)
Return valueERE_OKSuccess
E_PARAMParameter error
E_DEVICEDevice not found
FunctionSets log receiving method from the channel specified by Serial and InnerCh.
Only MPX_GETLOG_GETLOGAPI (log acquisition API mode) can be specified for Mode, so this API call may be omitted.
NoteIn log acquisition API mode, you must periodically call one of MPXGetLog, MPXCANGetLogEx, or MPXLINGetLogEx.

MPXGetLog​

Gets monitoring log data (TX/RX data) from log structure buffer allocated inside DLL.

FormatER MPXGetLog(uint32_t Serial, uint8_t InnerCh, StMPXLog ** Log, uint16_t * Count, uint8_t * BufferOver)
Argumentuint32_tSerialinSerial number of target MicroPeckerX device
uint8_tInnerChinTarget CH number (1 or 2)
StMPXLog **LogoutPointer to log structure array
uint16_t *CountoutNumber of acquired logs
uint8_t *BufferOveroutBuffer overrun (see Buffer Overrun Presence)
Return valueERE_OKSuccess
E_PARAMParameter error
E_DEVICEDevice not found
FunctionGets logs from channel specified by Serial and InnerCh.
Pointer to start of internal DLL log buffer is set to Log, and number of logs is set to Count.
If buffer overrun occurs, BufferOver is set to MPX_LOG_BUFOVER_TRUE.
NoteNo caller-side log structure array preparation is required for this API.