leishen_m10p_close leishen_m10p_read navigation bar

Table of Contents

leishen_m10p_read

Returns information about the Leishen M10P.

Description

The leishen_m10p_read function returns information about the Leishen M10P ranging sensor, such as the hardware and firmware version numbers and the model number.

Prototype

t_error
leishen_m10p_get_device_information(t_ranging_sensor sensor, t_ranging_sensor_information* information);
    

Parameters

t_ranging_sensor sensor

A handle to the sensor, as returned by leishen_m10p_open.

t_ranging_sensor_information * information

A pointer to a variable to receive the sensor device information. The returned structure has the following fields:

Data Type

Field

Description

t_version

hardware_version

The hardware version.

t_version

firmware_version

The firmware version.

t_uint16

model

The model number of the device.

Return value

Returns zero on success. Otherwise a negative error code is returned. Error codes are defined in quanser_errors.h. A suitable error message may be retrieved using msg_get_error_message.

Error codes

QERR_INVALID_ARGUMENT

One of the arguments is invalid.

Requirements

Include Files

Libraries

quanser_ranging_sensor.h

quanser_devices.lib;quanser_communications.lib;quanser_runtime.lib;quanser_common.lib

Examples

t_ranging_sensor lidar;
t_error result = 
    leishen_m10p_open("serial://localhost:0?baud='512000',word='8',parity='none',stop='1',flow='none',device='/dev/lidar'", RANGING_DISTANCE_LONG, &lidar);
if (result == 0) {
    t_ranging_sensor_information information;
    
    result = leishen_m10p_get_device_information(lidar, &information);
    ...
    leishen_m10p_close(lidar);
} else {
    TCHAR message[512];
    msg_get_error_message(NULL, result, message, sizeof(message));
    _tprintf(_T("Failed to open Leishen M10P. %s (error %d)\n"), message, -result);
}
    

See Also

 

navigation bar