Program Listing for File client.h

Return to documentation for file (include/ros2_ouster/client/client.h)

#pragma once

#include <cstdint>
#include <memory>
#include <string>

#include "ros2_ouster/client/types.h"
#include "ros2_ouster/client/version.h"

namespace ouster {
  namespace sensor {

    struct client;

    enum client_state
    {
      TIMEOUT = 0,
      CLIENT_ERROR = 1,
      LIDAR_DATA = 2,
      IMU_DATA = 4,
      EXIT = 8
    };

    const util::version min_version = {1, 12, 0};

    std::shared_ptr < client > init_client(
      const std::string & hostname = "",
      int lidar_port = 7502, int imu_port = 7503);

    std::shared_ptr < client > init_client(
      const std::string & hostname,
      const std::string & udp_dest_host,
      lidar_mode mode = MODE_UNSPEC,
      timestamp_mode ts_mode = TIME_FROM_UNSPEC,
      int lidar_port = 0,
      int imu_port = 0,
      int timeout_sec = 60);

    client_state poll_client(const client & cli, int timeout_sec = 1);

    bool read_lidar_packet(
      const client & cli, uint8_t * buf,
      const packet_format & pf);

    bool read_imu_packet(const client & cli, uint8_t * buf, const packet_format & pf);

    std::string get_metadata(client & cli, int timeout_sec = 60);

    bool get_config(const std::string& hostname, sensor_config& config,
                    bool active = true);

    bool set_config(const std::string& hostname, const sensor_config& config,
                    uint8_t config_flags = 0);


  } // namespace sensor
}  // namespace ouster