Skip to navigation

hololink::module::FrameMetadataInterfaceV1

View as Markdown

Decode the block of metadata the device sends with each frame.

Along with a frame’s data, the device transmits a block of metadata associated with that frame. A receiver reserves block_size() bytes for the block when it sizes the buffer it receives frames into, then passes the received block to decode() to read the values out of it.

The device writes the block in its own layout; use this service to deserialize it.

#include <hololink/module/frame_metadata.hpp>

Inherits from: hololink::module::Service< FrameMetadataInterfaceV1 > (public)


Methods

block_size

virtual size_t hololink::module::FrameMetadataInterfaceV1::block_size() const

The size of a frame’s metadata block, in bytes.

A receiver adds this to the space it reserves for each frame, and hands decode() a block this size. The value doesn’t change while the service is in use.

Returns: Size of the metadata block, in bytes.

decode

virtual hololink_module_status_t hololink::module::FrameMetadataInterfaceV1::decode(
const void *host_memory,
size_t host_memory_size_bytes,
FrameMetadata &out_metadata
) const

Deserialize received frame metadata into out_metadata.

Returns: HOLOLINK_MODULE_OK, or HOLOLINK_MODULE_INVALID_PARAMETER when fewer than block_size() bytes are available at host_memory.

Parameters

host_memory
const void *

The metadata block received with a frame, in host memory.

host_memory_size_bytes
size_t

Bytes available at host_memory.

out_metadata
FrameMetadata &

What the device reported about the frame.

module

std::shared_ptr<Module> hololink::module::ServiceBase::module() const

The Module that this service was published from.

The service holds no strong reference to its Module, so this does not extend the Module’s lifetime.

Returns: The owning Module, or an empty pointer if the service has not been published or its Module no longer exists.


Static methods

get_service

static std::shared_ptr<FrameMetadataInterfaceV1> hololink::module::FrameMetadataInterfaceV1::get_service(
std::shared_ptr<Module> module,
bool allow_null = false
)

Fetch a module’s FrameMetadataInterfaceV1 instance.

Returns: The module’s frame metadata service.

Throws: std::runtime_error if the module publishes no frame metadata service and allow_null is false.

Parameters

module
std::shared_ptr<Module>

The module that claims the device, from Adapter::get_module.

allow_null
boolDefaults to false

Return an empty pointer, rather than throwing, when the module publishes no frame metadata service.

for_each_type_id

static bool hololink::module::Service<FrameMetadataInterfaceV1>::for_each_type_id(
Callback &&cb
)

Iterate over every type_id supported by this instance.

The callback signature is bool(const char*) — returning false halts the walk; true continues. Iteration is depth-first, so you’ll see the most specific implementation types first.


Inner classes

FrameMetadata

struct hololink::module::FrameMetadataInterfaceV1::FrameMetadata

What the device reported about one received frame.

NameTypeDescription
flagsuint32_tDevice-reported status of the frame.
psnuint32_tPacket sequence number the frame ended on.
crcuint32_tCRC the device computed over the frame data.
frame_numberuint16_tFrame counter, as the device numbers frames.
timestamp_suint64_tDevice time when the frame’s first sample data was received.
timestamp_nsuint32_tNanoseconds part of timestamp_s.
bytes_writtenuint64_tFrame data the device wrote, in bytes.
metadata_suint64_tDevice time when the metadata block itself was sent.
metadata_nsuint32_tNanoseconds part of metadata_s.