|
livox_mid360_core
C++ driver library for the Livox Mid-360 LiDAR
|
Synchronous command channel to one LiDAR. Move-only. More...
#include <livox/mid360/session.hpp>
Public Member Functions | |
| Session (Session &&other) noexcept | |
| Takes over the socket, the counters and a pending cancel request of other. | |
| Session & | operator= (Session &&other) noexcept |
| See the move constructor. | |
| Session (const Session &)=delete | |
| Session & | operator= (const Session &)=delete |
| const std::string & | serial_number () const noexcept |
| Serial number of the connected LiDAR. | |
| Endpoint | lidar_endpoint () const noexcept |
| Command endpoint of the LiDAR (ip:cmd_port). | |
| Endpoint | local_endpoint () const noexcept |
| Address the command socket is bound to. | |
| const SessionOptions & | options () const noexcept |
| Options passed to connect(). | |
| const SessionStats & | stats () const noexcept |
| Request counters since connect(). | |
| void | cancel () noexcept |
| Abort a blocking call from another thread; it returns kCancelled. | |
Raw request | |
| std::expected< RawAck, SessionError > | request (std::uint16_t cmd_id, std::span< const std::byte > data, std::optional< RequestOptions > opts=std::nullopt) |
| Send cmd_id with data and wait for the matching ACK. | |
Typed commands | |
| std::expected< DiscoveryAck, SessionError > | discovery_ack (std::optional< RequestOptions > opts=std::nullopt) |
| 0x0000 sent unicast to this LiDAR. | |
| std::expected< ParamConfigAck, SessionError > | configure (std::span< const KeyValue > kvs, std::optional< RequestOptions > opts=std::nullopt) |
| 0x0100. ret_code 0x21 (effective after reboot) is returned as success. | |
| std::expected< InquireResult, SessionError > | inquire (std::span< const std::uint16_t > keys, std::optional< RequestOptions > opts=std::nullopt) |
| 0x0101. | |
| std::expected< InquireResult, SessionError > | inquire (std::span< const Key > keys, std::optional< RequestOptions > opts=std::nullopt) |
| 0x0101 with typed keys. | |
| std::expected< SimpleAck, SessionError > | reboot (std::uint16_t timeout_ms=100, std::optional< RequestOptions > opts=std::nullopt) |
| 0x0200. The LiDAR goes silent after the ACK. | |
| std::expected< SimpleAck, SessionError > | factory_reset (std::optional< RequestOptions > opts=std::nullopt) |
| 0x0201. | |
| std::expected< SimpleAck, SessionError > | set_gps_time (std::uint64_t pps_time_ns, std::optional< RequestOptions > opts=std::nullopt) |
| 0x0202. | |
Work state | |
| std::expected< WorkState, SessionError > | work_state (std::optional< RequestOptions > opts=std::nullopt) |
| Read key 0x8006. | |
| std::expected< void, SessionError > | wait_for_state (WorkState target, std::chrono::milliseconds timeout) |
| Poll 0x8006 until target is observed. | |
Static Public Member Functions | |
| static std::expected< Session, SessionError > | connect (const DiscoveredDevice &device, const SessionOptions &options={}) |
| Connect using a discovery result (cmd endpoint = ip:cmd_port). | |
| static std::expected< Session, SessionError > | connect (Endpoint cmd_endpoint, const SessionOptions &options={}) |
| Connect to a known command endpoint; the serial number is read from the device. | |
Synchronous command channel to one LiDAR. Move-only.
|
nodiscard |
Poll 0x8006 until target is observed.
ERROR / UPGRADE end the wait with kUnexpectedState; other states are treated as transitional.
|
noexcept |
Abort a blocking call from another thread; it returns kCancelled.
The flag is consumed by the aborted call (or by the next call if none is in progress).