14#include <units/frequency.h>
15#include <units/time.h>
16#include <units/dimensionless.h>
30 ctre::phoenix::StatusCode SendRequest(
const char *network, uint32_t deviceHash, std::shared_ptr<ControlRequest> &req)
const override
32 if (req.get() !=
this)
35 if (reqCast !=
nullptr)
41 req = std::make_shared<TwinkleOffAnimation>(*
this);
45 return c_ctre_phoenix6_RequestControlTwinkleOffAnimation(network, deviceHash,
UpdateFreqHz.to<
double>(),
LEDStartIndex,
LEDEndIndex,
Slot,
Color.
Red,
Color.
Green,
Color.
Blue,
Color.
White,
MaxLEDsOnProportion.to<
double>(),
FrameRate.to<
double>());
160 Slot = std::move(newSlot);
175 Color = std::move(newColor);
241 std::stringstream ss;
242 ss <<
"Control: TwinkleOffAnimation" << std::endl;
244 ss <<
" LEDEndIndex: " <<
LEDEndIndex << std::endl;
245 ss <<
" Slot: " <<
Slot << std::endl;
246 ss <<
" Color: " <<
Color << std::endl;
248 ss <<
" FrameRate: " <<
FrameRate.to<
double>() <<
" Hz" << std::endl;
259 std::map<std::string, std::string> controlInfo;
260 std::stringstream ss;
261 controlInfo[
"Name"] =
GetName();
262 ss <<
LEDStartIndex; controlInfo[
"LEDStartIndex"] = ss.str(); ss.str(std::string{});
263 ss <<
LEDEndIndex; controlInfo[
"LEDEndIndex"] = ss.str(); ss.str(std::string{});
264 ss <<
Slot; controlInfo[
"Slot"] = ss.str(); ss.str(std::string{});
265 ss <<
Color; controlInfo[
"Color"] = ss.str(); ss.str(std::string{});
266 ss <<
MaxLEDsOnProportion.to<
double>(); controlInfo[
"MaxLEDsOnProportion"] = ss.str(); ss.str(std::string{});
267 ss <<
FrameRate.to<
double>(); controlInfo[
"FrameRate"] = ss.str(); ss.str(std::string{});
CTREXPORT int c_ctre_phoenix6_RequestControlTwinkleOffAnimation(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, double MaxLEDsOnProportion, double FrameRate)
Abstract Control Request class that other control requests extend for use.
Definition ControlRequest.hpp:30
std::string const & GetName() const
Definition ControlRequest.hpp:53
Animation that randomly turns on LEDs until it reaches the maximum count, and then turns them all off...
Definition TwinkleOffAnimation.hpp:29
TwinkleOffAnimation & WithSlot(int newSlot)
Modifies this Control Request's Slot parameter and returns itself for method-chaining and easier to u...
Definition TwinkleOffAnimation.hpp:158
units::frequency::hertz_t FrameRate
The frame rate of the animation, from [2, 1000] Hz.
Definition TwinkleOffAnimation.hpp:83
std::map< std::string, std::string > GetControlInfo() const override
Gets information about this control request.
Definition TwinkleOffAnimation.hpp:257
TwinkleOffAnimation(int LEDStartIndex, int LEDEndIndex)
Animation that randomly turns on LEDs until it reaches the maximum count, and then turns them all off...
Definition TwinkleOffAnimation.hpp:111
TwinkleOffAnimation & WithFrameRate(units::frequency::hertz_t newFrameRate)
Modifies this Control Request's FrameRate parameter and returns itself for method-chaining and easier...
Definition TwinkleOffAnimation.hpp:210
TwinkleOffAnimation & WithLEDEndIndex(int newLEDEndIndex)
Modifies this Control Request's LEDEndIndex parameter and returns itself for method-chaining and easi...
Definition TwinkleOffAnimation.hpp:142
int LEDEndIndex
The index of the last LED this animation controls (inclusive).
Definition TwinkleOffAnimation.hpp:59
TwinkleOffAnimation & WithUpdateFreqHz(units::frequency::hertz_t newUpdateFreqHz)
Sets the period at which this control will update at.
Definition TwinkleOffAnimation.hpp:229
std::string ToString() const override
Returns a string representation of the object.
Definition TwinkleOffAnimation.hpp:239
TwinkleOffAnimation & WithLEDStartIndex(int newLEDStartIndex)
Modifies this Control Request's LEDStartIndex parameter and returns itself for method-chaining and ea...
Definition TwinkleOffAnimation.hpp:126
TwinkleOffAnimation & WithMaxLEDsOnProportion(units::dimensionless::scalar_t newMaxLEDsOnProportion)
Modifies this Control Request's MaxLEDsOnProportion parameter and returns itself for method-chaining ...
Definition TwinkleOffAnimation.hpp:188
signals::RGBWColor Color
The color to use in the animation.
Definition TwinkleOffAnimation.hpp:68
TwinkleOffAnimation & WithColor(signals::RGBWColor newColor)
Modifies this Control Request's Color parameter and returns itself for method-chaining and easier to ...
Definition TwinkleOffAnimation.hpp:173
units::frequency::hertz_t UpdateFreqHz
The period at which this control will update at.
Definition TwinkleOffAnimation.hpp:96
int LEDStartIndex
The index of the first LED this animation controls (inclusive).
Definition TwinkleOffAnimation.hpp:54
units::dimensionless::scalar_t MaxLEDsOnProportion
The max proportion of LEDs that can be on, in the range [0.1, 1.0].
Definition TwinkleOffAnimation.hpp:72
int Slot
The slot of this animation, within [0, 7].
Definition TwinkleOffAnimation.hpp:64
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