14#include <units/frequency.h>
15#include <units/time.h>
28 ctre::phoenix::StatusCode SendRequest(
const char *network, uint32_t deviceHash, std::shared_ptr<ControlRequest> &req)
const override
30 if (req.get() !=
this)
33 if (reqCast !=
nullptr)
39 req = std::make_shared<StrobeAnimation>(*
this);
43 return c_ctre_phoenix6_RequestControlStrobeAnimation(network, deviceHash,
UpdateFreqHz.to<
double>(),
LEDStartIndex,
LEDEndIndex,
Slot,
Color.
Red,
Color.
Green,
Color.
Blue,
Color.
White,
FrameRate.to<
double>());
153 Slot = std::move(newSlot);
168 Color = std::move(newColor);
219 std::stringstream ss;
220 ss <<
"Control: StrobeAnimation" << std::endl;
222 ss <<
" LEDEndIndex: " <<
LEDEndIndex << std::endl;
223 ss <<
" Slot: " <<
Slot << std::endl;
224 ss <<
" Color: " <<
Color << std::endl;
225 ss <<
" FrameRate: " <<
FrameRate.to<
double>() <<
" Hz" << std::endl;
236 std::map<std::string, std::string> controlInfo;
237 std::stringstream ss;
238 controlInfo[
"Name"] =
GetName();
239 ss <<
LEDStartIndex; controlInfo[
"LEDStartIndex"] = ss.str(); ss.str(std::string{});
240 ss <<
LEDEndIndex; controlInfo[
"LEDEndIndex"] = ss.str(); ss.str(std::string{});
241 ss <<
Slot; controlInfo[
"Slot"] = ss.str(); ss.str(std::string{});
242 ss <<
Color; controlInfo[
"Color"] = ss.str(); ss.str(std::string{});
243 ss <<
FrameRate.to<
double>(); controlInfo[
"FrameRate"] = ss.str(); ss.str(std::string{});
CTREXPORT int c_ctre_phoenix6_RequestControlStrobeAnimation(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 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 strobes the LEDs a specified color.
Definition StrobeAnimation.hpp:27
int Slot
The slot of this animation, within [0, 7].
Definition StrobeAnimation.hpp:62
StrobeAnimation & WithLEDStartIndex(int newLEDStartIndex)
Modifies this Control Request's LEDStartIndex parameter and returns itself for method-chaining and ea...
Definition StrobeAnimation.hpp:119
StrobeAnimation & WithSlot(int newSlot)
Modifies this Control Request's Slot parameter and returns itself for method-chaining and easier to u...
Definition StrobeAnimation.hpp:151
units::frequency::hertz_t UpdateFreqHz
The period at which this control will update at.
Definition StrobeAnimation.hpp:90
int LEDEndIndex
The index of the last LED this animation controls (inclusive).
Definition StrobeAnimation.hpp:57
StrobeAnimation & WithLEDEndIndex(int newLEDEndIndex)
Modifies this Control Request's LEDEndIndex parameter and returns itself for method-chaining and easi...
Definition StrobeAnimation.hpp:135
int LEDStartIndex
The index of the first LED this animation controls (inclusive).
Definition StrobeAnimation.hpp:52
units::frequency::hertz_t FrameRate
The frame rate of the animation, from [1, 500] Hz.
Definition StrobeAnimation.hpp:77
StrobeAnimation & WithUpdateFreqHz(units::frequency::hertz_t newUpdateFreqHz)
Sets the period at which this control will update at.
Definition StrobeAnimation.hpp:207
StrobeAnimation & WithFrameRate(units::frequency::hertz_t newFrameRate)
Modifies this Control Request's FrameRate parameter and returns itself for method-chaining and easier...
Definition StrobeAnimation.hpp:188
StrobeAnimation & WithColor(signals::RGBWColor newColor)
Modifies this Control Request's Color parameter and returns itself for method-chaining and easier to ...
Definition StrobeAnimation.hpp:166
std::string ToString() const override
Returns a string representation of the object.
Definition StrobeAnimation.hpp:217
StrobeAnimation(int LEDStartIndex, int LEDEndIndex)
Animation that strobes the LEDs a specified color.
Definition StrobeAnimation.hpp:104
std::map< std::string, std::string > GetControlInfo() const override
Gets information about this control request.
Definition StrobeAnimation.hpp:234
signals::RGBWColor Color
The color to use in the animation.
Definition StrobeAnimation.hpp:66
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