List Connected Devices Sample

The sample installed in <install-prefix>/share/metavision/hal/samples/metavision_hal_ls/metavision_hal_ls.cpp shows how to use Metavision HAL API to list all connected event-based devices.

Expected Output

The application prints information about connected event-based devices to the console.

Example of the outcome:

Trying to open device Prophesee:hal_plugin_gen31_fx3:00001345

Example for more information:

Trying to open device Prophesee:hal_plugin_gen31_fx3:00001345
## HAL Software
Version:                      2.1.0.2025315
VCS branch:                   release/v2.1.0-RC1
VCS commit:                   c29ca65361fecddde4e7197c756985d397274e2d
VCS commit's date:            2025315

## Plugin Software
Version:                      2.1.0.2025315
VCS branch:                   release/v2.1.0-RC1
VCS commit:                   c29ca65361fecddde4e7197c756985d397274e2d
VCS commit's date:            2025315

## Hardware
Connection:                   USB
FX3 Build Date:               Tue Apr 16 14:22:28 2019
FX3 ID:                       1
FX3 Release Version:          1.3.1
FX3 Speed:                    5000
FX3 Version Control ID:       0x31bef107
Manufacturer:                 Prophesee
Raw Formats:                  EVT2
Sensor Info:                  3.1
Serial:                       00001345
System Build Date:            Sat Apr  6 03:07:48 2019
System Version:               3.2.3
System Version Control ID:    0x8284fb1e
SystemID:                     28

How to start

First, compile the sample as described in this tutorial.

To start the sample, run:

Linux

./metavision_hal_ls

Windows

metavision_hal_ls.exe

To get more information about connected event-based devices:

Linux

./metavision_hal_ls -v

Windows

metavision_hal_ls.exe -v

Code Overview

The following code snippet shows how to retrieve the serial numbers of connected devices:

    auto v = Metavision::DeviceDiscovery::list();

    if (v.empty()) {
        MV_LOG_ERROR() << "No device found";
    }

Once the serial number is known, a device with the given serial number can be created with the following code:

                // open device from a serial
                device.reset(Metavision::DeviceDiscovery::open(s));

Then, from the device, the available facilities can be retrieved with cpp:func:Metavision::Device::get_facility. For example, the following code displays the device hardware information:

                // Retrieves The facility that provides information about the hardware
                Metavision::I_HW_Identification *hw_identification =
                    device->get_facility<Metavision::I_HW_Identification>();
                if (hw_identification) {
                    MV_LOG_INFO() << "## Hardware";
                    // Retrieves a map of key/value with the informations
                    for (auto system_info : hw_identification->get_system_info()) {
                        auto key            = system_info.first;
                        auto value          = system_info.second;
                        const std::string s = key + ":";
                        MV_LOG_INFO() << Metavision::Log::no_space << std::left << std::setw(30) << s << value;
                    }
                }