PlayLEDPatternCommand
public struct PlayLEDPatternCommand : CommandRequest
Command to request the Gear to play an LED pattern.
Note that not all Gear components have LEDs, you can inspect Component.capabilities
.
See also
Commands
-
Errors thrown by
See morePlayLEDPatternCommand
.Declaration
Swift
public enum Error : Swift.Error
extension PlayLEDPatternCommand.Error: CustomStringConvertible
-
Available LED patterns.
See moreDeclaration
Swift
public enum LEDPatternType : CustomStringConvertible
-
Options for modifying LED Commands.
See moreDeclaration
Swift
public enum LEDPatternPlayType : CustomStringConvertible
-
PlayLEDPatternCommand response value is an empty Void to indicate success.
Declaration
Swift
public typealias Response = Void
-
Initializes a
PlayLEDPattern
command with a custom pattern.If the combined duration of Frames is less than
durationMs
, the pattern will be repeated untildurationMs
has elapsed.Declaration
Swift
public init( frames: [Frame], durationMs: Int, component: Component, patternType: LEDPatternType = .custom, isResumable: Bool = false, playPauseToggle: LEDPatternPlayType = .play, haltAll: Bool = false ) throws
Parameters
frames
The sequence of
Frame
s that make a pattern.durationMs
The length of time to repeat the frames for.
component
The component that the pattern will be played on.
patternType
The pattern of the LED to play.
isResumable
If
true
the Led Pattern will resume, if it is interrupted by anotherPlayLEDPatternCommand
playPauseToggle
Enables tag to make a decision whether to start the new pattern or stop an ongoing pattern.
haltAll
If
true
any Led Pattern that is playing will be stopped.Throws
if the component does not have an LED.
-
Initializes a
PlayLEDPattern
command with a predefined pattern.Declaration
Swift
public init( color: Color, durationMs: Int, component: Component, patternType: LEDPatternType = .solid, isResumable: Bool = false, playPauseToggle: LEDPatternPlayType = .play, haltAll: Bool = false ) throws
Parameters
color
The color to use for the pattern.
durationMs
The length of time to repeat the pattern for.
component
The component that the pattern will be played on.
patternType
The pattern of the LED to play.
isResumable
If
true
the Led Pattern will resume, if it is interrupted by anotherPlayLEDPatternCommand
playPauseToggle
Enables tag to make a decision whether to start the new pattern or stop an ongoing pattern.
haltAll
If
true
any Led Pattern that is playing will be stopped.Throws
if the component does not have an LED.
-
RGB representation of target color.
See moreDeclaration
Swift
public struct Color
-
Color and time duration for frame.
See moreDeclaration
Swift
public struct Frame