Voyant API 0.8.0
Loading...
Searching...
No Matches
voyant_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
6#include <csignal>
7#include <memory>
9#include <string>
11
17{
18public:
45 VoyantClient(const std::string& bindAddr,
46 const std::string& groupAddr,
47 const std::string& interfaceAddr,
48 bool filterPoints = false,
49 bool disableSpn = false);
50
68 explicit VoyantClient(const std::string& addr, bool filterPoints = false, bool disableSpn = false);
69
74
81
87
93
98 bool isValid() const;
99
104 static void setupSignalHandling(int signal = SIGINT);
105
110 static bool isTerminated();
111
115 static void resetTerminationFlag();
116
117private:
118 // Client data
120 std::unique_ptr<uint8_t[]> buffer_;
123
124 // Global signal handling
125 static volatile bool terminated_;
126 static void signalHandler(int);
127};
Class for interacting with a Voyant Photonics, Inc. sensor to receive data streams.
Definition voyant_client.hpp:17
~VoyantClient()
Destructor - releases resources.
VoyantFrameWrapper & latestFrame()
Gets the latest frame whether or not there's new data.
size_t bufferSize_
Definition voyant_client.hpp:121
std::unique_ptr< uint8_t[]> buffer_
Definition voyant_client.hpp:120
static volatile bool terminated_
Definition voyant_client.hpp:125
VoyantFrameWrapper latestFrame_
Definition voyant_client.hpp:122
static void resetTerminationFlag()
Resets the termination flag.
bool tryReceiveNextFrame()
Attempts to receive the next available frame from the data stream.
VoyantClient(const std::string &addr, bool filterPoints=false, bool disableSpn=false)
Creates a unicast VoyantClient for receiving data sent directly to this machine.
static bool isTerminated()
Checks if a termination signal has been received.
const VoyantFrameWrapper & latestFrame() const
Gets the latest frame whether or not there's new data (const version)
bool isValid() const
Checks if the client was initialized properly.
PointsClientC client_
Definition voyant_client.hpp:119
static void signalHandler(int)
static void setupSignalHandling(int signal=SIGINT)
Sets up signal handling for graceful termination.
VoyantClient(const std::string &bindAddr, const std::string &groupAddr, const std::string &interfaceAddr, bool filterPoints=false, bool disableSpn=false)
Creates a multicast VoyantClient for receiving data sent to a multicast group.
Wrapper for VoyantFrame messages.
Definition voyant_frame_wrapper.hpp:19
Definition points_client_ffi.hpp:26