Voyant API 0.2.1
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
VoyantClient Class Reference

Class for interacting with a Voyant Photonics, Inc. sensor to receive data streams. More...

#include <voyant_client.hpp>

Public Member Functions

 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.
 
 VoyantClient (const std::string &addr, bool filterPoints=false)
 Creates a unicast VoyantClient for receiving data sent directly to this machine.
 
 ~VoyantClient ()
 Destructor - releases resources.
 
bool tryReceiveNextFrame ()
 Attempts to receive the next available frame from the data stream.
 
VoyantFrameWrapperlatestFrame ()
 Gets the latest frame whether or not there's new data.
 
const VoyantFrameWrapperlatestFrame () const
 Gets the latest frame whether or not there's new data (const version)
 
bool isValid () const
 Checks if the client was initialized properly.
 

Static Public Member Functions

static void setupSignalHandling (int signal=SIGINT)
 Sets up signal handling for graceful termination.
 
static bool isTerminated ()
 Checks if a termination signal has been received.
 
static void resetTerminationFlag ()
 Resets the termination flag.
 

Detailed Description

Class for interacting with a Voyant Photonics, Inc. sensor to receive data streams.

Constructor & Destructor Documentation

◆ VoyantClient() [1/2]

VoyantClient::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.

Parameters
bindAddrLocal socket address to receive data on (e.g., "0.0.0.0:4444") Use "0.0.0.0" to listen on all network interfaces (recommended) The port number must match the sender's multicast port
groupAddrMulticast group address to join (e.g., "224.0.0.0") Must be a valid multicast address in range 224.0.0.0 - 239.255.255.255 This must match the sender's multicast group address All clients joined to this group will receive the same data
interfaceAddrIP address of the network interface to use for receiving multicast data For local testing: use "127.0.0.1" (loopback interface) For external devices: use the IP of your interface on the network connected to the device (e.g., "192.168.20.100")
filterPointsWhether to filter out invalid points during processing. When true, invalid points will be removed from frames. When false, all points including invalid ones will be included.

◆ VoyantClient() [2/2]

VoyantClient::VoyantClient ( const std::string &  addr,
bool  filterPoints = false 
)
explicit

Creates a unicast VoyantClient for receiving data sent directly to this machine.

Parameters
addrLocal socket address to listen on (e.g., "0.0.0.0:4444") Use "0.0.0.0" to listen on all network interfaces Use a specific IP (e.g., "192.168.1.100:4444") to listen on just one interface The port specified must match the sender's destination port
filterPointsWhether to filter out invalid points during processing. When true, invalid points will be removed from frames. When false, all points including invalid ones will be included.

◆ ~VoyantClient()

VoyantClient::~VoyantClient ( )

Destructor - releases resources.

Member Function Documentation

◆ isTerminated()

static bool VoyantClient::isTerminated ( )
static

Checks if a termination signal has been received.

Returns
true if a signal has been received

◆ isValid()

bool VoyantClient::isValid ( ) const

Checks if the client was initialized properly.

Returns
true if client has been properly initialized

◆ latestFrame() [1/2]

VoyantFrameWrapper & VoyantClient::latestFrame ( )

Gets the latest frame whether or not there's new data.

Returns
Mutable reference to the internal frame

◆ latestFrame() [2/2]

const VoyantFrameWrapper & VoyantClient::latestFrame ( ) const

Gets the latest frame whether or not there's new data (const version)

Returns
Const reference to the internal frame

◆ resetTerminationFlag()

static void VoyantClient::resetTerminationFlag ( )
static

Resets the termination flag.

◆ setupSignalHandling()

static void VoyantClient::setupSignalHandling ( int  signal = SIGINT)
static

Sets up signal handling for graceful termination.

Parameters
signalSignal to handle (default: SIGINT)

◆ tryReceiveNextFrame()

bool VoyantClient::tryReceiveNextFrame ( )

Attempts to receive the next available frame from the data stream.

Returns
true if a new frame was received and processed, false otherwise
Note
When successful, the internal frame is updated and can be accessed via latestFrame()

The documentation for this class was generated from the following file: