Skip to navigation

hololink::module::ChannelConfigurationInterfaceV1

View as Markdown

A Module provides one of these to update EnumerationMetadata based on requests from the application layer.

This service provides device-specific implementation for various configurations that are requested by the application layer. Applications usually call methods on Adapter to modify EnumerationMetadata (e.g. Adapter::use_sensor); many of these work by loading up this device-specific object and calling the appropriate method here. This allows the module to set up the values needed by other module services which will be instantiated later. The framework puts no restrictions on the name/value pairs that can be stored in EnumerationMetadata, Module instances are free to coordinate using this as they wish.

For example, an application can change the sensor number a specific data path transports:

The call to adapter.use_sensor results in loading this service from the module and calling use_sensor on it.

#include <hololink/module/channel_configuration.hpp>

Example

adapter = hololink_module.Adapter.get_adapter()
discovery_timeout_s = 30
enumeration_metadata = adapter.wait_for_channel(hololink="192.168.0.2", discovery_timeout_s)
# By default, this first channel publishes data from sensor 0.
# Let's change it to publish data from sensor 1.
sensor_number = 1
adapter.use_sensor(enumeration_metadata, sensor_number)
...

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


Methods

use_sensor

virtual void hololink::module::ChannelConfigurationInterfaceV1::use_sensor(
int64_t sensor_number
)

Select the physical sensor to be used with this data channel.

Following device enumeration, EnumerationMetadata includes device-specific information about which data channel to use and which sensor is to be transported over that channel. You can modify this default behavior and listen to a different sensor by calling Adapter::use_sensor, which delegates to this method.

Each HSB implementation is able to do what it wants here, but typically data_plane, sensor, sensor_number, the SIF, VP and HIF address fields, and the frame-end event are adjusted.

Throws: std::runtime_error if sensor_number is invalid.

Parameters

metadata
EnumerationMetadata &

Announcement to rewrite in place.

sensor_number
int64_t

Zero-based index of the sensor to describe.

is_sensor_valid

virtual bool hololink::module::ChannelConfigurationInterfaceV1::is_sensor_valid(
int64_t sensor_number
) const

Returns true if sensor_number is valid for this configuration.

Returns: True if sensor_number is valid.

Parameters

sensor_number
int64_t

Sensor number to test.

use_mtu

virtual void hololink::module::ChannelConfigurationInterfaceV1::use_mtu(
uint32_t mtu
)

Set the data-plane MTU.

Suggest an MTU for use with this data channel; the implementation is allowed to do any of these:

  • use the specific value you’ve passed here,
  • adjust that value based on e.g. GPU page size, NIC constraints, or RDMA requirements
  • stick with it’s default value, ignoring this suggestion entirely

If the MTU isn’t supported by all links in the network chain, the result is undefined. If the implementation doesn’t ignore this setting, then no data plane packets larger than the given MTU will be sent.

Parameters

metadata
EnumerationMetadata &

Encapsulates connection parameters

mtu
uint32_t

Data-plane MTU, in bytes.

use_multicast

virtual void hololink::module::ChannelConfigurationInterfaceV1::use_multicast(
std::string address,
uint16_t port
)

Set a multicast destination for the data plane.

Parameters

metadata
EnumerationMetadata &

Encapsulates configuration data.

address
std::string

Multicast group address.

port
uint16_t

Destination UDP port to send to.

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<ChannelConfigurationInterfaceV1> hololink::module::ChannelConfigurationInterfaceV1::get_service(
std::shared_ptr<Module> module,
bool allow_null = false
)

Fetch the instance a module publishes.

Returns: The module’s channel configuration service.

Throws: std::runtime_error if the module publishes no channel configuration 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 channel configuration service.

for_each_type_id

static bool hololink::module::Service<ChannelConfigurationInterfaceV1>::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.