![]() |
NDEVR
API Documentation
|
Server that streams RealSense point cloud data to remote clients over UDP. More...
Classes | |
| class | WorkerThread |
| Background thread for the server update loop. More... | |
Public Member Functions | |
| RealSenseServer (RealSenseScannerFactory *scanner_factory) | |
| Constructs the server with the given scanner factory. | |
| void | checkRecieve () |
| Checks for and processes incoming commands from the client. | |
| void | initConnections () |
| Initializes the UDP listening connection for incoming commands. | |
| void | sendCommandData (const String &data) |
| Sends a command response to the connected client. | |
| void | sendPointData (const RasterPacketInfo &packet_info) |
| Sends point cloud data to the connected client. | |
| void | startServer () |
| Starts the server, discovers local scanners, and begins streaming. | |
| void | stopServer () |
| Stops the server and disconnects all scanners. | |
| bool | updateServer () |
| Runs one update cycle: collects data from scanners and sends to client. | |
Static Public Member Functions | |
| static void | CreateCloudPacket (String &packet, const RasterPacketInfo &packet_info, uint04 data_offset, uint02 data_size, uint04 packet_num) |
| Creates a compressed point cloud data packet. | |
| static void | CreateCommandPacket (String &packet, const String &command, uint04 packet_num) |
| Creates a command packet from a command string. | |
| static void | CreateProbeInfoPacket (String &packet, const RasterPacketInfo &packet_info, uint04 packet_num) |
| Creates a probe info packet with scanner metadata. | |
| static uint04 | ReadNetworkPacket (const String &packet, RasterPacketInfo &packet_info, uint04 offset, String &command_response) |
| Reads and parses a network packet from a raw data buffer. | |
Public Attributes | |
| Buffer< RealSenseScanner * > | m_connected_scanners |
| List of connected local scanners. | |
| RasterPacketInfo | m_packet_info |
| Current raster packet info being transmitted. | |
| Connection * | m_rx_connection = nullptr |
| UDP connection for receiving commands. | |
| RealSenseScannerFactory * | m_scanner_factory = nullptr |
| Factory for discovering local scanners. | |
| WorkerThread * | m_thread |
| Background server thread. | |
| Connection * | m_tx_connection = nullptr |
| UDP connection for transmitting data. | |
| String | m_tx_packet |
| Reusable transmit packet buffer. | |
| uint04 | m_tx_packet_count = 0 |
| Transmit packet sequence counter. | |
Static Public Attributes | |
| static constexpr uint04 | rx_port_number = 31458 |
| UDP port for receiving commands. | |
| static constexpr uint04 | tx_port_number = 31459 |
| UDP port for transmitting data. | |
Server that streams RealSense point cloud data to remote clients over UDP.
Manages local scanner connections, serializes point cloud and metadata into packets, and transmits them to connected clients.
Definition at line 76 of file RealSenseServer.h.
|
inline |
Constructs the server with the given scanner factory.
| [in] | scanner_factory | The factory for discovering local scanners. |
Definition at line 300 of file RealSenseServer.h.
References m_scanner_factory, and m_thread.
Referenced by RealSenseServer::WorkerThread::WorkerThread().
|
inlinestatic |
Creates a compressed point cloud data packet.
| [in] | packet | The output buffer to write the packet into. |
| [in] | packet_info | The packet info containing point and color data. |
| [in] | data_offset | The starting offset in the point data buffer. |
| [in] | data_size | The number of points to include. |
| [in] | packet_num | The packet sequence number. |
Definition at line 128 of file RealSenseServer.h.
References RasterPacketInfo::active_color_data, RasterPacketInfo::active_point_data, cast(), DataPacketHeader::compressed_color_data_size, DataPacketHeader::compressed_point_data_size, DataPacketHeader::data_size, e_cloud_data, RealsensePacketHeader::packet_num, RealsensePacketHeader::packet_type, and Compressor::ZLibCompress().
Referenced by sendPointData().
|
inlinestatic |
Creates a command packet from a command string.
| [in] | packet | The output buffer to write the packet into. |
| [in] | command | The command string. |
| [in] | packet_num | The packet sequence number. |
Definition at line 86 of file RealSenseServer.h.
References cast(), e_probe_info_packet, CommandPacket::packet_info, RealsensePacketHeader::packet_num, and RealsensePacketHeader::packet_type.
Referenced by sendCommandData().
|
inlinestatic |
Creates a probe info packet with scanner metadata.
| [in] | packet | The output buffer to write the packet into. |
| [in] | packet_info | The scanner metadata to encode. |
| [in] | packet_num | The packet sequence number. |
Definition at line 105 of file RealSenseServer.h.
References cast(), e_probe_info_packet, InfoPacketHeader::frame_time, RasterPacketInfo::frame_time, InfoPacketHeader::gyro_status, RasterPacketInfo::gyro_status, RasterPacketInfo::mat, InfoPacketHeader::matrix, RealsensePacketHeader::packet_num, RealsensePacketHeader::packet_type, InfoPacketHeader::scanner_id, and RasterPacketInfo::scanner_id.
Referenced by sendPointData().
|
inlinestatic |
Reads and parses a network packet from a raw data buffer.
| [in] | packet | The raw data buffer. |
| [in] | packet_info | The packet info to populate with parsed data. |
| [in] | offset | The byte offset to start reading from. |
| [in] | command_response | Output for any command response string. |
Definition at line 164 of file RealSenseServer.h.
References RasterPacketInfo::active_color_data, RasterPacketInfo::active_point_data, Buffer< t_type, t_memory_manager >::addSpace(), RealsensePacketHeader::check_sum, DataPacketHeader::compressed_color_data_size, DataPacketHeader::compressed_point_data_size, DataPacketHeader::data_size, e_cloud_data, e_command_packet, e_probe_info_packet, InfoPacketHeader::frame_time, RasterPacketInfo::frame_time, getMax(), InfoPacketHeader::gyro_status, RasterPacketInfo::gyro_status, RealsensePacketChecksum::index_value, String::indexOf(), IsInvalid(), RasterPacketInfo::mat, InfoPacketHeader::matrix, CommandPacket::packet_info, RasterPacketInfo::packet_num, RealsensePacketHeader::packet_num, RealsensePacketHeader::packet_type, InfoPacketHeader::scanner_id, RasterPacketInfo::scanner_id, and Compressor::ZLibDecompress().
|
inline |
Sends a command response to the connected client.
| [in] | data | The command string to send. |
Definition at line 326 of file RealSenseServer.h.
References CreateCommandPacket(), m_tx_connection, m_tx_packet, and m_tx_packet_count.
Referenced by checkRecieve().
|
inline |
Sends point cloud data to the connected client.
| [in] | packet_info | The raster packet info containing point and color data. |
Definition at line 308 of file RealSenseServer.h.
References RasterPacketInfo::active_color_data, cast(), CreateCloudPacket(), CreateProbeInfoPacket(), getMin(), m_tx_connection, m_tx_packet, and m_tx_packet_count.
Referenced by updateServer().
|
inline |
Runs one update cycle: collects data from scanners and sends to client.
Definition at line 392 of file RealSenseServer.h.
References checkRecieve(), initConnections(), QTTools::log(), m_connected_scanners, m_packet_info, m_rx_connection, m_tx_connection, and sendPointData().