NDEVR
API Documentation
RealSenseClient.h
1#pragma once
2#include "DLLInfo.h"
3#include "RealSenseInterface/Headers/RealSenseServer.h"
4#include "Base/Headers/QueueBuffer.hpp"
5namespace NDEVR
6{
7
10 {
11 public:
17 };
18
30 class REALSENSE_INTERFACE_API RealSenseClient
31 {
33 class WorkerThread : public QThread
34 {
35 public:
39 WorkerThread(RealSenseClient* client);
41 void run() override;
42 RealSenseClient* m_client;
43 };
45 RealSenseClient();
46 public:
50 static RealSenseClient* Default();
55 void setLookup(const StringView& server, DesignObjectLookup* lookup);
57 void init();
67 void sendMessage(const StringView& message);
79 void setOverrideMatrix(const UUID& id, const Matrix<fltp08>& mat, Time matrix_time);
91 void sendPing();
95 bool openPorts();
103 protected:
111 WorkerThread* m_thread;
114 Time m_ping_send = Constant<Time>::Invalid;
115 TimeSpan m_ping_offset = Constant<TimeSpan>::Invalid;
117 };
118}
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
A standard interface for all types of connections that allow transmitting and receiving of data betwe...
Definition Connection.h:316
Connection(const Model &model, LogPtr raw_network_log=nullptr, LogPtr command_log=nullptr, QObject *parent=nullptr)
Constructs a Connection with the given model and optional logs.
A core class where all Design Objects including models, materials, and geometries are stored.
A hash-based key-value store, useful for quick associative lookups.
Definition Dictionary.h:64
Templated logic for doing matrix multiplication.
Definition Matrix.hpp:182
Stores objects in a first-in, first out queue based Buffer with push and pop functions.
Buffer< QPointer< Connection > > connections()
Returns all active connections.
bool collectData()
Collects and processes one frame of data from the server.
WorkerThread * m_thread
Background data collection thread.
Time m_last_connection_attempt
Time of last connection attempt.
void sendMessage(const StringView &message)
Sends a command message to the server.
Dictionary< UUID, OverrideMatrixBuffer > m_override_matrices
Override matrices per scanner.
RasterPacketInfo m_packet_info
Current packet being assembled.
void sendConnectIfNeeded()
Sends a connection request to the server if not already connected.
bool openPorts()
Opens the UDP ports for communication.
const Dictionary< UUID, RealSenseScanner * > & connectedScanners() const
Returns the dictionary of connected scanners.
void setOverrideMatrix(const UUID &id, const Matrix< fltp08 > &mat, Time matrix_time)
Sets an override transformation matrix for a scanner.
String m_server_connection
The server address string.
Matrix< fltp08 > cameraMatrix(UUID id, Time time, const Matrix< fltp08 > &fallback)
Returns the camera matrix for a scanner at a given time.
void initConnections()
Initializes the UDP connections for data transfer.
Dictionary< UUID, RealSenseScanner * > m_connected_scanners
Connected scanner instances.
String m_rx_buffer
Receive data buffer.
Time m_ping_send
Time when last ping was sent.
DesignObjectLookup * m_lookup
The design object lookup.
static RealSenseClient * Default()
Returns the singleton RealSenseClient instance.
Connection * m_rx_connection
The receive UDP connection.
void processCommandReturn(const String &s)
Processes a command return string from the server.
TimeSpan m_ping_offset
Measured ping latency offset.
Connection * m_tx_connection
The transmit UDP connection.
void setLookup(const StringView &server, DesignObjectLookup *lookup)
Sets the server address and design object lookup.
void init()
Initializes the client.
uint04 m_rx_buffer_offset
Current offset in the receive buffer.
void startClient()
Starts the client background thread.
void sendPing()
Sends a ping to the server for latency measurement.
RealSenseServerConnection(const UUID &id)
Constructs a server connection with the given identifier.
UUID id
The UUID of the remote scanner.
The core String View class for the NDEVR API.
Definition StringView.h:58
The core String class for the NDEVR API.
Definition String.h:95
Stores a time span, or difference between two times, with an optional start time.
Definition TimeSpan.h:46
Represents a timestamp with utilities for manipulation and conversion.
Definition Time.h:62
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:61
The primary namespace for the NDEVR SDK.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
A timestamped camera matrix override value.
Matrix< fltp08 > mat
The override transformation matrix.
Time time
The time at which the override applies.
Packet of colored point data sent from the raster scanner for live and inactive display.