![]() |
EduArt Sensor Ring Library 4.0.0
|
Factory for creating a SensorRing. More...
#include <SensorRingFactory.hpp>
Public Types | |
| using | EnumerationMap = std::unordered_map<com::ComInterfaceID, std::vector<board::EnumerationInformation> > |
| Per-interface enumeration results, keyed by interface ID. | |
Public Member Functions | |
| SensorRingFactory (ValidationMode mode=ValidationMode::Relaxed) | |
| Construct the factory with a validation mode. | |
| void | addInterface (com::SocketCanParams params) |
| Add a SocketCAN interface to scan during build(). | |
| void | addInterface (com::UsbTingoParams params) |
| Add a USBtingo interface to scan during build(). | |
| void | expectBoard (board::SensorBoardParams params={}) |
| Declare an expected board on the current interface. | |
| void | expectDevice (device::DeviceType type) |
| Declare an expected device type without overriding default parameters. | |
| void | expectDevice (device::VL53L8CX_Params params) |
| Declare an expected device on the most recently added board. | |
| void | expectDevice (device::TMF8829_Params params) |
| Declare an expected device on the most recently added board. | |
| void | expectDevice (device::HTPA32_Params params) |
| Declare an expected device on the most recently added board. | |
| void | expectDevice (device::WS2812b_Params params) |
| Declare an expected device on the most recently added board. | |
| void | expectDevice (device::DepthSensorParams params) |
| Declare an expected device by category (matches any sensor of that category). | |
| void | expectDevice (device::ThermalSensorParams params) |
| Declare an expected device by category (matches any sensor of that category). | |
| void | expectDevice (device::LightParams params) |
| Declare an expected device by category (matches any sensor of that category). | |
| void | setDefaultDeviceParams (device::VL53L8CX_Params params) |
| Set default params applied to a specific discovered device type that has no explicit params from expectDevice(). | |
| void | setDefaultDeviceParams (device::TMF8829_Params params) |
| Set default params applied to a specific discovered device type that has no explicit params from expectDevice(). | |
| void | setDefaultDeviceParams (device::HTPA32_Params params) |
| Set default params applied to a specific discovered device type that has no explicit params from expectDevice(). | |
| void | setDefaultDeviceParams (device::WS2812b_Params params) |
| Set default params applied to a specific discovered device type that has no explicit params from expectDevice(). | |
| void | setDefaultDeviceParams (device::DepthSensorParams params) |
| Set default params applied to an entire category of discovered devices. | |
| void | setDefaultDeviceParams (device::ThermalSensorParams params) |
| Set default params applied to an entire category of discovered devices. | |
| void | setDefaultDeviceParams (device::LightParams params) |
| Set default params applied to an entire category of discovered devices. | |
| std::unique_ptr< SensorRing > | build () |
| Enumerate hardware on all added interfaces, validate against expectations, and construct the SensorRing. | |
| EnumerationMap | enumerate () |
| Enumerate hardware on all added interfaces without building a SensorRing. | |
| const EnumerationMap & | getLatestEnumerationResult () const |
| Return the enumeration results from the last enumerate() or build() call. | |
| std::string | printTopology () const |
| Format the latest enumeration results as a human-readable topology string. | |
| void | reset () |
| Reset the factory to its initial state. Enumeration results are preserved. | |
Static Public Attributes | |
| static constexpr Version | MIN_FIRMWARE_VERSION = { 0, 9, 0 } |
| Minimum sensor board firmware version required by this library version. | |
Factory for creating a SensorRing.
Usage:
If no expectBoard() calls are made for an interface, build() operates in pure auto-discovery mode: every board found on the bus is used with default (or setDefaultDeviceParams) configuration.
When expectations are present, the validation mode controls how mismatches are handled:
|
explicit |
Construct the factory with a validation mode.
| [in] | mode | Validation mode (default: Relaxed). In Relaxed mode, mismatched boards are skipped instead of aborting. |
| void eduart::sensorring::SensorRingFactory::addInterface | ( | com::SocketCanParams | params | ) |
Add a SocketCAN interface to scan during build().
All subsequent expectBoard() calls apply to this interface until the next addInterface() call.
| [in] | params | SocketCAN configuration parameters. |
| void eduart::sensorring::SensorRingFactory::addInterface | ( | com::UsbTingoParams | params | ) |
Add a USBtingo interface to scan during build().
All subsequent expectBoard() calls apply to this interface until the next addInterface() call.
| [in] | params | USBtingo configuration parameters. |
| std::unique_ptr< SensorRing > eduart::sensorring::SensorRingFactory::build | ( | ) |
Enumerate hardware on all added interfaces, validate against expectations, and construct the SensorRing.
Uses the ValidationMode set in the constructor.
| EnumerationMap eduart::sensorring::SensorRingFactory::enumerate | ( | ) |
Enumerate hardware on all added interfaces without building a SensorRing.
Useful for interactive applications that want to discover connected boards before committing to a build. Results are stored and retrievable via getLatestEnumerationResult(). Also called internally by build().
| void eduart::sensorring::SensorRingFactory::expectBoard | ( | board::SensorBoardParams | params = {} | ) |
Declare an expected board on the current interface.
Boards are matched against enumeration results using the configured ValidationMode. Use expectDevice() after this call to declare which devices should be instantiated on this board.
If no expectDevice() calls follow, all devices reported by the hardware are instantiated with default (or setDefaultDeviceParams()) configuration.
| [in] | params | Board-level parameters (type, name, pose, etc.). |
| void eduart::sensorring::SensorRingFactory::expectDevice | ( | device::DepthSensorParams | params | ) |
Declare an expected device by category (matches any sensor of that category).
Use these when you don't care which specific sensor is present, only that a device of the given category exists. Default params (or hardware defaults) will be applied to whatever concrete device is discovered.
| params | Configuration for a generic device of that category. |
| void eduart::sensorring::SensorRingFactory::expectDevice | ( | device::DeviceType | type | ) |
Declare an expected device type without overriding default parameters.
Use this when you want to restrict which devices are instantiated on a board while still letting setDefaultDeviceParams() supply the effective configuration for the matched concrete device.
Supported values are concrete device types (e.g. VL53L8CX) and category wildcards (AnyDepth, AnyThermal, AnyLight).
| type | Device type to expect on the most recently added board. |
| void eduart::sensorring::SensorRingFactory::expectDevice | ( | device::HTPA32_Params | params | ) |
Declare an expected device on the most recently added board.
Only the device types declared via expectDevice() are instantiated for that board. The provided params override any defaults set via setDefaultDeviceParams().
Must be called after expectBoard(). Multiple expectDevice() calls accumulate devices for the same board.
| params | Configuration for a concrete device type. |
| void eduart::sensorring::SensorRingFactory::expectDevice | ( | device::LightParams | params | ) |
Declare an expected device by category (matches any sensor of that category).
Use these when you don't care which specific sensor is present, only that a device of the given category exists. Default params (or hardware defaults) will be applied to whatever concrete device is discovered.
| params | Configuration for a generic device of that category. |
| void eduart::sensorring::SensorRingFactory::expectDevice | ( | device::ThermalSensorParams | params | ) |
Declare an expected device by category (matches any sensor of that category).
Use these when you don't care which specific sensor is present, only that a device of the given category exists. Default params (or hardware defaults) will be applied to whatever concrete device is discovered.
| params | Configuration for a generic device of that category. |
| void eduart::sensorring::SensorRingFactory::expectDevice | ( | device::TMF8829_Params | params | ) |
Declare an expected device on the most recently added board.
Only the device types declared via expectDevice() are instantiated for that board. The provided params override any defaults set via setDefaultDeviceParams().
Must be called after expectBoard(). Multiple expectDevice() calls accumulate devices for the same board.
| params | Configuration for a concrete device type. |
| void eduart::sensorring::SensorRingFactory::expectDevice | ( | device::VL53L8CX_Params | params | ) |
Declare an expected device on the most recently added board.
Only the device types declared via expectDevice() are instantiated for that board. The provided params override any defaults set via setDefaultDeviceParams().
Must be called after expectBoard(). Multiple expectDevice() calls accumulate devices for the same board.
| params | Configuration for a concrete device type. |
| void eduart::sensorring::SensorRingFactory::expectDevice | ( | device::WS2812b_Params | params | ) |
Declare an expected device on the most recently added board.
Only the device types declared via expectDevice() are instantiated for that board. The provided params override any defaults set via setDefaultDeviceParams().
Must be called after expectBoard(). Multiple expectDevice() calls accumulate devices for the same board.
| params | Configuration for a concrete device type. |
| const EnumerationMap & eduart::sensorring::SensorRingFactory::getLatestEnumerationResult | ( | ) | const |
Return the enumeration results from the last enumerate() or build() call.
| std::string eduart::sensorring::SensorRingFactory::printTopology | ( | ) | const |
Format the latest enumeration results as a human-readable topology string.
| void eduart::sensorring::SensorRingFactory::setDefaultDeviceParams | ( | device::DepthSensorParams | params | ) |
Set default params applied to an entire category of discovered devices.
Sets a Category default (Priority 2). Applied when a discovered device of this category has no concrete default explicitly set.
Concrete params always override category params. Category params always override hard-coded defaults. Each call replaces any previously set default for this category.
| params | Default configuration applied to any generic device. |
| void eduart::sensorring::SensorRingFactory::setDefaultDeviceParams | ( | device::HTPA32_Params | params | ) |
Set default params applied to a specific discovered device type that has no explicit params from expectDevice().
Sets a Concrete default (Priority 1). These take precedence over any category-level defaults or hard-coded zero-initialised defaults.
This applies across all build paths (auto-discovery, configured boards without explicit device expectations, and wildcard resolution fallbacks). Each call replaces any previously set default for this specific type.
| params | Default configuration applied to the concrete device type. |
| void eduart::sensorring::SensorRingFactory::setDefaultDeviceParams | ( | device::LightParams | params | ) |
Set default params applied to an entire category of discovered devices.
Sets a Category default (Priority 2). Applied when a discovered device of this category has no concrete default explicitly set.
Concrete params always override category params. Category params always override hard-coded defaults. Each call replaces any previously set default for this category.
| params | Default configuration applied to any generic device. |
| void eduart::sensorring::SensorRingFactory::setDefaultDeviceParams | ( | device::ThermalSensorParams | params | ) |
Set default params applied to an entire category of discovered devices.
Sets a Category default (Priority 2). Applied when a discovered device of this category has no concrete default explicitly set.
Concrete params always override category params. Category params always override hard-coded defaults. Each call replaces any previously set default for this category.
| params | Default configuration applied to any generic device. |
| void eduart::sensorring::SensorRingFactory::setDefaultDeviceParams | ( | device::TMF8829_Params | params | ) |
Set default params applied to a specific discovered device type that has no explicit params from expectDevice().
Sets a Concrete default (Priority 1). These take precedence over any category-level defaults or hard-coded zero-initialised defaults.
This applies across all build paths (auto-discovery, configured boards without explicit device expectations, and wildcard resolution fallbacks). Each call replaces any previously set default for this specific type.
| params | Default configuration applied to the concrete device type. |
| void eduart::sensorring::SensorRingFactory::setDefaultDeviceParams | ( | device::VL53L8CX_Params | params | ) |
Set default params applied to a specific discovered device type that has no explicit params from expectDevice().
Sets a Concrete default (Priority 1). These take precedence over any category-level defaults or hard-coded zero-initialised defaults.
This applies across all build paths (auto-discovery, configured boards without explicit device expectations, and wildcard resolution fallbacks). Each call replaces any previously set default for this specific type.
| params | Default configuration applied to the concrete device type. |
| void eduart::sensorring::SensorRingFactory::setDefaultDeviceParams | ( | device::WS2812b_Params | params | ) |
Set default params applied to a specific discovered device type that has no explicit params from expectDevice().
Sets a Concrete default (Priority 1). These take precedence over any category-level defaults or hard-coded zero-initialised defaults.
This applies across all build paths (auto-discovery, configured boards without explicit device expectations, and wildcard resolution fallbacks). Each call replaces any previously set default for this specific type.
| params | Default configuration applied to the concrete device type. |