Voyant API 0.2.1
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>
8#include <points_client.hpp>
9#include <string>
11
17{
18public:
40 VoyantClient(const std::string &bindAddr,
41 const std::string &groupAddr,
42 const std::string &interfaceAddr,
43 bool filterPoints = false);
44
57 explicit VoyantClient(const std::string &addr, bool filterPoints = false);
58
63
70
76
82
87 bool isValid() const;
88
93 static void setupSignalHandling(int signal = SIGINT);
94
99 static bool isTerminated();
100
104 static void resetTerminationFlag();
105
106private:
107 // Client data
109 std::unique_ptr<uint8_t[]> buffer_;
112
113 // Global signal handling
114 static volatile bool terminated_;
115 static void signalHandler(int);
116};
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:110
std::unique_ptr< uint8_t[]> buffer_
Definition voyant_client.hpp:109
static volatile bool terminated_
Definition voyant_client.hpp:114
VoyantFrameWrapper latestFrame_
Definition voyant_client.hpp:111
static void resetTerminationFlag()
Resets the termination flag.
bool tryReceiveNextFrame()
Attempts to receive the next available frame from the data stream.
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:108
static void signalHandler(int)
VoyantClient(const std::string &bindAddr, const std::string &groupAddr, const std::string &interfaceAddr, bool filterPoints=false)
Creates a multicast VoyantClient for receiving data sent to a multicast group.
static void setupSignalHandling(int signal=SIGINT)
Sets up signal handling for graceful termination.
VoyantClient(const std::string &addr, bool filterPoints=false)
Creates a unicast VoyantClient for receiving data sent directly to this machine.
Wrapper for VoyantFrame messages.
Definition voyant_frame_wrapper.hpp:19
Definition points_client.hpp:24