Error

samples/error.cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
/**
 * Sample code for error callback usage.
 */
#include <cepton_sdk_api.hpp>

int main(int argc, char** argv) {
  // Initialize
  cepton_sdk::api::SensorErrorCallback error_callback;
  CEPTON_CHECK_ERROR(
      error_callback.listen([&](cepton_sdk::SensorHandle handle,
                                const cepton_sdk::SensorError& error) {
        // Handle error...
      }));
  CEPTON_CHECK_ERROR(cepton_sdk::initialize(
      CEPTON_SDK_VERSION, cepton_sdk::create_options(),
      error_callback.global_on_callback, &error_callback));

  // Deinitialize
  cepton_sdk::deinitialize().ignore();
}