Class SampleHwInterface
Defined in File sample_hw_interface.hpp
Nested Relationships
Nested Types
Class Documentation
-
class SampleHwInterface
Receives raw sensor packets and forwards them to a registered callback.
This class owns the transport-facing state used by the sample driver.
Public Functions
-
explicit SampleHwInterface(ConnectionConfiguration connection_configuration)
Construct the hardware interface with connection settings.
- Parameters:
connection_configuration – Network addresses and ports used by the sensor stream.
-
util::expected<std::monostate, Error> sensor_interface_start()
Start packet reception.
- Returns:
std::monostate on success, Error on failure.
- Post:
On success, incoming packets are delivered through the registered callback.
-
util::expected<std::monostate, Error> sensor_interface_stop()
Stop packet reception.
- Returns:
std::monostate on success, Error on failure.
-
util::expected<std::monostate, Error> register_scan_callback(connections::UdpSocket::callback_t scan_callback)
Register or replace the callback invoked for each incoming packet.
- Parameters:
scan_callback – Callback receiving packet bytes and transport metadata.
- Returns:
std::monostate if callback is accepted, Error otherwise.
-
struct Error
Rich error payload for hardware interface operations.
Public Types
-
enum class Code : uint8_t
Coarse category for quick handling and branching.
Values:
-
enumerator CALLBACK_NOT_REGISTERED
Start requested before a callback was registered.
-
enumerator INVALID_CALLBACK
Empty callback passed to register_scan_callback.
-
enumerator INVALID_OPERATION
Operation is invalid in the current interface state.
-
enumerator SOCKET_OPEN_FAILED
UDP socket creation/bind/subscribe failed.
-
enumerator SOCKET_CLOSE_FAILED
UDP socket unsubscribe/teardown failed.
-
enumerator CALLBACK_NOT_REGISTERED
-
enum class Code : uint8_t
-
explicit SampleHwInterface(ConnectionConfiguration connection_configuration)