15#include <units/frequency.h>
16#include <units/time.h>
29 ctre::phoenix::StatusCode SendRequest(
const char *network, uint32_t deviceHash, std::shared_ptr<ControlRequest> &req)
const override
31 if (req.get() !=
this)
34 if (reqCast !=
nullptr)
40 req = std::make_shared<ColorFlowAnimation>(*
this);
44 return c_ctre_phoenix6_RequestControlColorFlowAnimation(network, deviceHash,
UpdateFreqHz.to<
double>(),
LEDStartIndex,
LEDEndIndex,
Slot,
Color.
Red,
Color.
Green,
Color.
Blue,
Color.
White,
Direction.
value,
FrameRate.to<
double>());
178 Slot = std::move(newSlot);
193 Color = std::move(newColor);
259 std::stringstream ss;
260 ss <<
"Control: ColorFlowAnimation" << std::endl;
262 ss <<
" LEDEndIndex: " <<
LEDEndIndex << std::endl;
263 ss <<
" Slot: " <<
Slot << std::endl;
264 ss <<
" Color: " <<
Color << std::endl;
265 ss <<
" Direction: " <<
Direction << std::endl;
266 ss <<
" FrameRate: " <<
FrameRate.to<
double>() <<
" Hz" << std::endl;
277 std::map<std::string, std::string> controlInfo;
278 std::stringstream ss;
279 controlInfo[
"Name"] =
GetName();
280 ss <<
LEDStartIndex; controlInfo[
"LEDStartIndex"] = ss.str(); ss.str(std::string{});
281 ss <<
LEDEndIndex; controlInfo[
"LEDEndIndex"] = ss.str(); ss.str(std::string{});
282 ss <<
Slot; controlInfo[
"Slot"] = ss.str(); ss.str(std::string{});
283 ss <<
Color; controlInfo[
"Color"] = ss.str(); ss.str(std::string{});
284 ss <<
Direction; controlInfo[
"Direction"] = ss.str(); ss.str(std::string{});
285 ss <<
FrameRate.to<
double>(); controlInfo[
"FrameRate"] = ss.str(); ss.str(std::string{});
CTREXPORT int c_ctre_phoenix6_RequestControlColorFlowAnimation(const char *canbus, uint32_t ecuEncoding, double updateFrequency, int LEDStartIndex, int LEDEndIndex, int Slot, int Color_Red, int Color_Green, int Color_Blue, int Color_White, int Direction, double FrameRate)
Animation that gradually lights the entire LED strip one LED at a time.
Definition ColorFlowAnimation.hpp:28
ColorFlowAnimation & WithFrameRate(units::frequency::hertz_t newFrameRate)
Modifies this Control Request's FrameRate parameter and returns itself for method-chaining and easier...
Definition ColorFlowAnimation.hpp:228
ColorFlowAnimation & WithDirection(signals::AnimationDirectionValue newDirection)
Modifies this Control Request's Direction parameter and returns itself for method-chaining and easier...
Definition ColorFlowAnimation.hpp:206
units::frequency::hertz_t UpdateFreqHz
The period at which this control will update at.
Definition ColorFlowAnimation.hpp:100
std::map< std::string, std::string > GetControlInfo() const override
Gets information about this control request.
Definition ColorFlowAnimation.hpp:275
int LEDStartIndex
The index of the first LED this animation controls (inclusive).
Definition ColorFlowAnimation.hpp:55
ColorFlowAnimation & WithLEDEndIndex(int newLEDEndIndex)
Modifies this Control Request's LEDEndIndex parameter and returns itself for method-chaining and easi...
Definition ColorFlowAnimation.hpp:160
units::frequency::hertz_t FrameRate
The frame rate of the animation, from [2, 1000] Hz.
Definition ColorFlowAnimation.hpp:87
signals::RGBWColor Color
The color to use in the animation.
Definition ColorFlowAnimation.hpp:72
ColorFlowAnimation & WithColor(signals::RGBWColor newColor)
Modifies this Control Request's Color parameter and returns itself for method-chaining and easier to ...
Definition ColorFlowAnimation.hpp:191
ColorFlowAnimation & WithLEDStartIndex(int newLEDStartIndex)
Modifies this Control Request's LEDStartIndex parameter and returns itself for method-chaining and ea...
Definition ColorFlowAnimation.hpp:141
int Slot
The slot of this animation, within [0, 7].
Definition ColorFlowAnimation.hpp:68
std::string ToString() const override
Returns a string representation of the object.
Definition ColorFlowAnimation.hpp:257
int LEDEndIndex
The index of the last LED this animation controls (inclusive).
Definition ColorFlowAnimation.hpp:63
ColorFlowAnimation & WithUpdateFreqHz(units::frequency::hertz_t newUpdateFreqHz)
Sets the period at which this control will update at.
Definition ColorFlowAnimation.hpp:247
ColorFlowAnimation(int LEDStartIndex, int LEDEndIndex)
Animation that gradually lights the entire LED strip one LED at a time.
Definition ColorFlowAnimation.hpp:123
signals::AnimationDirectionValue Direction
The direction of the animation.
Definition ColorFlowAnimation.hpp:76
ColorFlowAnimation & WithSlot(int newSlot)
Modifies this Control Request's Slot parameter and returns itself for method-chaining and easier to u...
Definition ColorFlowAnimation.hpp:176
Abstract Control Request class that other control requests extend for use.
Definition ControlRequest.hpp:30
std::string const & GetName() const
Definition ControlRequest.hpp:53
Direction of the animation.
Definition SpnEnums.hpp:6388
int value
Definition SpnEnums.hpp:6390
static constexpr int Forward
The animation starts at the specified LED start index and moves towards the LED end index.
Definition SpnEnums.hpp:6396
Represents an RGBW color that can be applied to an LED.
Definition RGBWColor.hpp:27
uint8_t Green
The green component of the color, within [0, 255].
Definition RGBWColor.hpp:36
uint8_t Blue
The blue component of the color, within [0, 255].
Definition RGBWColor.hpp:40
uint8_t White
The white component of the color, within [0, 255].
Definition RGBWColor.hpp:45
uint8_t Red
The red component of the color, within [0, 255].
Definition RGBWColor.hpp:32
Status codes reported by APIs, including OK, warnings, and errors.
Definition StatusCodes.h:27
Definition Diff_PositionDutyCycle_Position.hpp:15