Skip to navigation

hololink::module::EnumerationInterfaceV1

View as Markdown

A loadable Module supplements device EnumerationMetadata through this service.

Devices typically announce themselves via BOOTP messages which carry a specific set of identification and configuration information, like device UUID and HSB-IP version (“compat_id”). That’s usually not enough information for most applications to work– for example, the number of sensors and data channels on the system determine the addressing for the specific channels within the device. This service allows the device module, which is loaded via UUID and compat_id, to update EnumerationMetadata with other appropriate configuration data for this device. This supplemented enumeration metadata is passed up to the application layer, and will be used to direct construction of services used on the device.

#include <hololink/module/enumeration.hpp>

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


Methods

update_metadata

virtual hololink_module_status_t hololink::module::EnumerationInterfaceV1::update_metadata(
const uint8_t *raw_packet,
size_t raw_packet_len
)

Complete the metadata describing an announced device.

Called once per announcement, before the announcement reaches the application; announcements decoded from bootp messages arrive on the Reactor thread.

Returns: HOLOLINK_MODULE_OK once the metadata is complete; HOLOLINK_MODULE_ENUMERATION_SKIPPED to decline the device, which withholds the announcement from the application and lets enumeration of other devices continue; any other status reports a failure, which the Adapter raises as a std::runtime_error.

Parameters

metadata
EnumerationMetadata &

Announcement to complete in place.

raw_packet
const uint8_t *

The bootp packet metadata was decoded from; a module whose devices carry vendor-specific bytes needs it to complete the metadata. Null when the announcement did not come from a packet.

raw_packet_len
size_t

Length of raw_packet, in bytes.

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

Fetch a module’s EnumerationInterfaceV1 instance.

Returns: The module’s enumeration service.

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

for_each_type_id

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