livox_mid360_core
C++ driver library for the Livox Mid-360 LiDAR
Loading...
Searching...
No Matches
livox::mid360::Context Class Reference

Owns the receive sockets and the receive thread. More...

#include <livox/mid360/context.hpp>

Public Member Functions

 Context (const Context &)=delete
Context & operator= (const Context &)=delete
 Context (Context &&)=delete
Context & operator= (Context &&)=delete
const ContextOptions & options () const noexcept
 Effective options: ports requested as 0 are replaced by the bound ones.
ContextStats stats () const
 Snapshot of the receive-side counters.
Multi-device

Multi-device (issue #8): the Devices open on this Context, keyed by serial number.

Non-owning: the caller keeps the unique_ptr and destroys it before the Context.

Device * find (std::string_view serial_number) const
 The open Device with this serial number, or nullptr.
std::vector< Device * > devices () const
 Every open Device, in registration order.

Static Public Member Functions

static std::expected< std::unique_ptr< Context >, DeviceError > create (const ContextOptions &opts={})
 Opens the receive sockets and starts the receive thread.

Detailed Description

Owns the receive sockets and the receive thread.

The thread starts in create() and is joined by the destructor. Every Device opened on a Context must be destroyed before it (asserted in debug builds). Non-copyable, non-movable: Devices hold a reference.

Member Function Documentation

◆ create()

std::expected< std::unique_ptr< Context >, DeviceError > livox::mid360::Context::create ( const ContextOptions & opts = {})
staticnodiscard

Opens the receive sockets and starts the receive thread.

Fails with kInvalidArgument when batch_size is 0, and with kSession (a transport SessionError) when a socket cannot be opened or bound.


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