![]() |
EduArt Sensor Ring Library 4.0.0
|
Base class for light/LED actuator devices. More...
#include <Light.hpp>
Public Member Functions | |
| Light (DeviceID id, com::ComInterface *interface, com::ComEndpoint target) | |
| Construct a Light with Device params. | |
| ~Light () override=default | |
| Virtual destructor. | |
| virtual const LightParams & | getParams () const =0 |
| Get the current light parameters. | |
| virtual void | setLight (LightMode mode, std::uint8_t r=0, std::uint8_t g=0, std::uint8_t b=0)=0 |
| Set the light mode and color. | |
| Public Member Functions inherited from eduart::sensorring::device::Device | |
| Device (DeviceID id, com::ComInterface *interface, com::ComEndpoint target) | |
| Construct the device with identity and communication link. | |
| DeviceID | getDeviceID () const |
| Return the full device identifier (type + index). | |
| unsigned int | getHwIdx () const |
| Return the zero-based hardware board index on its bus (used for CAN addressing and protocol bitmasks). | |
| void | setDeviceIndex (unsigned int index) |
| Reassign the logical device index (DeviceID.index) without changing the hardware index. | |
| virtual bool | configure () |
| Apply post-reset runtime configuration for this device. | |
| void | setBoardContext (const board::SensorBoardParams *board_params) |
| Initialize board-level context pointer (non-owning). | |
| const board::SensorBoardParams * | getBoardContext () const |
| Return the board-level context pointer (non-owning). | |
| void | setPoseOffset (const math::Pose &offset) |
| Store a pose offset relative to the board centre. | |
| math::Pose | getPoseOffset () const |
| Return the stored pose offset relative to the board centre. | |
| math::Pose | getGlobalPose () const |
| Compute and return the global pose in the ring coordinate frame. | |
| Public Member Functions inherited from eduart::sensorring::ActionDispatcher | |
| void | setQueue (ActionQueue *queue) |
| void | clearQueue () |
| bool | isManaged () const |
| void | execute (Action action) |
| void | execute (std::string_view key, Action action) |
Static Public Member Functions | |
| static void | setAllLights (const std::vector< Light * > &devices, LightMode mode, std::uint8_t red, std::uint8_t green, std::uint8_t blue) |
| Broadcast a mode+color command to ALL WS2812b devices on ALL interfaces. | |
| Static Public Member Functions inherited from eduart::sensorring::ActionDispatcher | |
| static void | globalExecute (Action action) |
Additional Inherited Members | |
| Protected Member Functions inherited from eduart::sensorring::device::Device | |
| virtual void | comCallback (const com::ComEndpoint source, std::uint8_t command, const std::vector< std::uint8_t > &data)=0 |
| Protected Attributes inherited from eduart::sensorring::device::Device | |
| DeviceID | _id |
| unsigned int | _hw_idx |
| com::ComInterface * | _interface |
| const board::SensorBoardParams * | _board_params = nullptr |
| math::Pose | _offset |
| subscription::Subscription | _com_subscription |
Base class for light/LED actuator devices.
Inherits from Device (identity, pose, action queue). Users call setLight() to update the desired state. The concrete implementation enqueues a self-contained CAN command into the action queue, which the state machine drains and executes during the device_actions cycle.
| eduart::sensorring::device::Light::Light | ( | DeviceID | id, |
| com::ComInterface * | interface, | ||
| com::ComEndpoint | target ) |
|
pure virtual |
Get the current light parameters.
Implemented in eduart::sensorring::device::WS2812b_Device.
|
static |
Broadcast a mode+color command to ALL WS2812b devices on ALL interfaces.
Useful for turning off all lights (including unconfigured boards).
| [in] | devices | Vector of WS2812b devices to apply the command to. |
| [in] | mode | Light mode to apply. |
| [in] | red | Red channel value. |
| [in] | green | Green channel value. |
| [in] | blue | Blue channel value. |
|
pure virtual |
Set the light mode and color.
| [in] | mode | Light mode to apply. Not all modes require a color to be specified. |
| [in] | r | Red channel (0-255). |
| [in] | g | Green channel (0-255). |
| [in] | b | Blue channel (0-255). |
Implemented in eduart::sensorring::device::WS2812b_Device.