Voyant API 0.8.0
Loading...
Searching...
No Matches
carbon_client.hpp
Go to the documentation of this file.
1// Copyright (c) 2024-2025 Voyant Photonics, Inc.
2// All rights reserved.
3
4#pragma once
5
7#include <carbon_config.hpp>
8#include <csignal>
9#include <cstdint>
10#include <memory>
12
38{
39public:
46 explicit CarbonClient(const CarbonConfig& config);
47
49
50 // Non-copyable, non-movable (owns async runtime)
51 CarbonClient(const CarbonClient&) = delete;
55
60 bool start();
61
66 void stop();
67
71 bool isRunning() const;
72
78
84
89 static void setupSignalHandling(int signal = SIGINT);
90
94 static bool isTerminated();
95
99 static void resetTerminationFlag();
100
101private:
102 CarbonClientHandleC* handle_; // opaque pointer — type defined in carbon_client_ffi.hpp
103 std::unique_ptr<uint8_t[]> buffer_;
104 static constexpr size_t kBufferSize_ = 8 * 1024 * 1024; // 8MB
106
107 static volatile std::sig_atomic_t terminated_;
108 static void signalHandler(int);
109};
Client for receiving frames from a Carbon LiDAR sensor.
Definition carbon_client.hpp:38
static void resetTerminationFlag()
Resets the termination flag.
CarbonClient(CarbonClient &&)=delete
VoyantFrameWrapper latestFrame_
Definition carbon_client.hpp:105
static volatile std::sig_atomic_t terminated_
Definition carbon_client.hpp:107
const VoyantFrameWrapper & latestFrame() const
static bool isTerminated()
Returns true if a termination signal has been received.
CarbonClientHandleC * handle_
Definition carbon_client.hpp:102
CarbonClient(const CarbonConfig &config)
Construct a CarbonClient from a CarbonConfig. The config is cloned internally — it remains valid afte...
VoyantFrameWrapper & latestFrame()
Access the latest received frame.
bool isRunning() const
Returns true if the client is running and no shutdown has been requested.
bool start()
Start receiving and processing data.
std::unique_ptr< uint8_t[]> buffer_
Definition carbon_client.hpp:103
CarbonClient & operator=(const CarbonClient &)=delete
static constexpr size_t kBufferSize_
Definition carbon_client.hpp:104
CarbonClient(const CarbonClient &)=delete
void stop()
Stop receiving and processing data. Safe to call multiple times. Can restart with start().
CarbonClient & operator=(CarbonClient &&)=delete
static void signalHandler(int)
static void setupSignalHandling(int signal=SIGINT)
Set up OS signal handling for graceful termination.
bool tryReceiveFrame()
Try to receive the latest frame if one is available.
Configuration for the Carbon LiDAR pipeline.
Definition carbon_config.hpp:29
Wrapper for VoyantFrame messages.
Definition voyant_frame_wrapper.hpp:19