C# Class BlinkStickDotNet.BlinkStick

A model of the BlinkStick device itself
Inheritance: IDisposable
Afficher le fichier Open project: arvydas/BlinkStickDotNet Class Usage Examples

Protected Properties

Свойство Type Description
connectedToDriver bool

Méthodes publiques

Méthode Description
Blink ( RgbColor color, int repeats = 1, int delay = 500 ) : void

Blink the LED.

Blink ( byte channel, byte index, RgbColor color, int repeats = 1, int delay = 500 ) : void

Blink the LED on BlinkStick Pro.

Blink ( byte channel, byte index, byte r, byte g, byte b, int repeats = 1, int delay = 500 ) : void

Blink the LED on BlinkStick Pro.

Blink ( byte r, byte g, byte b, int repeats = 1, int delay = 500 ) : void

Blink the LED.

Blink ( byte channel, byte index, string color, int repeats = 1, int delay = 500 ) : void

Blink the LED on BlinkStick Pro.

Blink ( string color, int repeats = 1, int delay = 500 ) : void

Blink the LED.

BlinkStick ( ) : System

Initializes a new instance of the BlinkStick class.

BlinkStickDeviceFromSerial ( string serial ) : BlinkStickDeviceEnum
CloseDevice ( ) : void

Closes the connection to the device.

Dispose ( ) : void

Disposes of the device and closes the connection.

Enable ( ) : void
FindAll ( ) : BlinkStickDotNet.BlinkStick[]

Find all BlinkStick devices.

FindBySerial ( String serial ) : BlinkStick

Finds BlinkStick by serial number.

FindFirst ( ) : BlinkStick

Find first BlinkStick.

GetColor ( byte &r, byte &g, byte &b ) : System.Boolean

Gets the color of the led.

GetColor ( byte index, byte &r, byte &g, byte &b ) : System.Boolean

Gets the color of the led.

GetColors ( byte &colorData ) : System.Boolean

Gets led data.

GetInfoBlock ( byte id, byte &data ) : System.Boolean

Gets the info block.

GetLedCount ( ) : int
GetMode ( ) : int

Gets the mode on BlinkStick Pro.

Morph ( RgbColor color, int duration = 1000, int steps = 50 ) : void

Morph from current color to new color.

Morph ( byte channel, byte index, RgbColor color, int duration = 1000, int steps = 50 ) : void

Morph from current color to new color on BlinkStick Pro.

Morph ( byte channel, byte index, byte r, byte g, byte b, int duration = 1000, int steps = 50 ) : void

Morph from current color to new color on BlinkStick Pro.

Morph ( byte r, byte g, byte b, int duration = 1000, int steps = 50 ) : void

Morph from current color to new color.

Morph ( byte channel, byte index, string color, int duration = 1000, int steps = 50 ) : void

Morph from current color to new color on BlinkStick Pro.

Morph ( string color, int duration = 1000, int steps = 50 ) : void

Morph from current color to new color.

OnReceiveColor ( byte index, byte &r, byte &g, byte &b ) : System.Boolean
OnSendColor ( byte channel, byte index, byte r, byte g, byte b ) : System.Boolean
OpenDevice ( ) : bool

Attempts to connect to a BlinkStick device. After a successful connection, a DeviceAttached event will normally be sent.

OpenDevice ( HidDevice adevice ) : bool

Opens the device.

Pulse ( RgbColor color, int repeats = 1, int duration = 1000, int steps = 50 ) : void

Pulse specified color.

Pulse ( byte channel, byte index, RgbColor color, int repeats = 1, int duration = 1000, int steps = 50 ) : void

Pulse specified color on BlinkStick Pro.

Pulse ( byte channel, byte index, byte r, byte g, byte b, int repeats = 1, int duration = 1000, int steps = 50 ) : void

Pulse specified color on BlinkStick Pro.

Pulse ( byte r, byte g, byte b, int repeats = 1, int duration = 1000, int steps = 50 ) : void

Pulse specified color.

Pulse ( byte channel, byte index, string color, int repeats = 1, int duration = 1000, int steps = 50 ) : void

Pulse specified color on BlinkStick Pro.

Pulse ( string color, int repeats = 1, int duration = 1000, int steps = 50 ) : void

Pulse specified color.

SetColor ( RgbColor color ) : void

Sets the color of the led.

SetColor ( String color ) : void

Sets the color of the led.

SetColor ( byte channel, byte index, RgbColor color ) : void

Sets the color of the led.

SetColor ( byte r, byte g, byte b ) : void

Sets the color of the led.

SetColor ( byte channel, byte index, byte r, byte g, byte b ) : void

Sets the color of the led.

SetColor ( byte channel, byte index, string color ) : void

Sets the color of the led.

SetColors ( byte channel, byte colorData ) : void

Send a packet of data to LEDs

SetLedCount ( byte count ) : void
SetMode ( byte mode ) : void

Sets the mode for BlinkStick Pro.

Stop ( ) : void
TurnOff ( ) : void

Turn BlinkStick off.

WaitThread ( long milliseconds ) : System.Boolean

Méthodes protégées

Méthode Description
SetInfoBlock ( byte id, byte data ) : void

Private Methods

Méthode Description
CheckRequiresSoftwareColorPatch ( ) : void

Checks if BlinkStick requires software color patch due to hardware bug.

Dispose ( bool disposing ) : void

Closes any connected devices.

GetFeature ( byte buffer ) : void
GetInfoBlock ( byte id, string &data ) : System.Boolean
InternalSetColor ( byte channel, byte index, byte r, byte g, byte b ) : void

Automatically sets the color of the device using either BlinkStick or BlinkStick Pro API

OpenCurrentDevice ( ) : bool

Opens the current device.

SetFeature ( byte buffer ) : void
SetInfoBlock ( byte id, string data ) : void

Sets the info block.

Method Details

Blink() public méthode

Blink the LED.
public Blink ( RgbColor color, int repeats = 1, int delay = 500 ) : void
color RgbColor Must be in #rrggbb format or named color ("red", "green", "blue")
repeats int How many times to repeat (default 1)
delay int Delay delay between on/off sequences (default 500)
Résultat void

Blink() public méthode

Blink the LED on BlinkStick Pro.
public Blink ( byte channel, byte index, RgbColor color, int repeats = 1, int delay = 500 ) : void
channel byte Channel (0 - R, 1 - G, 2 - B)
index byte Index of the LED
color RgbColor Color parameter as RgbColor class instance
repeats int How many times to repeat (default 1)
delay int Delay delay between on/off sequences (default 500)
Résultat void

Blink() public méthode

Blink the LED on BlinkStick Pro.
public Blink ( byte channel, byte index, byte r, byte g, byte b, int repeats = 1, int delay = 500 ) : void
channel byte Channel (0 - R, 1 - G, 2 - B)
index byte Index of the LED
r byte The red component.
g byte The green component.
b byte The blue component.
repeats int How many times to repeat (default 1)
delay int Delay delay between on/off sequences (default 500)
Résultat void

Blink() public méthode

Blink the LED.
public Blink ( byte r, byte g, byte b, int repeats = 1, int delay = 500 ) : void
r byte The red component.
g byte The green component.
b byte The blue component.
repeats int How many times to repeat (default 1)
delay int Delay delay between on/off sequences (default 500)
Résultat void

Blink() public méthode

Blink the LED on BlinkStick Pro.
public Blink ( byte channel, byte index, string color, int repeats = 1, int delay = 500 ) : void
channel byte Channel (0 - R, 1 - G, 2 - B)
index byte Index of the LED
color string Must be in #rrggbb format or named color ("red", "green", "blue")
repeats int How many times to repeat (default 1)
delay int Delay delay between on/off sequences (default 500)
Résultat void

Blink() public méthode

Blink the LED.
public Blink ( string color, int repeats = 1, int delay = 500 ) : void
color string Must be in #rrggbb format or named color ("red", "green", "blue")
repeats int How many times to repeat (default 1)
delay int Delay delay between on/off sequences (default 500)
Résultat void

BlinkStick() public méthode

Initializes a new instance of the BlinkStick class.
public BlinkStick ( ) : System
Résultat System

BlinkStickDeviceFromSerial() public static méthode

public static BlinkStickDeviceFromSerial ( string serial ) : BlinkStickDeviceEnum
serial string
Résultat BlinkStickDeviceEnum

CloseDevice() public méthode

Closes the connection to the device.
public CloseDevice ( ) : void
Résultat void

Dispose() public méthode

Disposes of the device and closes the connection.
public Dispose ( ) : void
Résultat void

Enable() public méthode

public Enable ( ) : void
Résultat void

FindAll() public static méthode

Find all BlinkStick devices.
public static FindAll ( ) : BlinkStickDotNet.BlinkStick[]
Résultat BlinkStickDotNet.BlinkStick[]

FindBySerial() public static méthode

Finds BlinkStick by serial number.
public static FindBySerial ( String serial ) : BlinkStick
serial String Serial number to search for
Résultat BlinkStick

FindFirst() public static méthode

Find first BlinkStick.
public static FindFirst ( ) : BlinkStick
Résultat BlinkStick

GetColor() public méthode

Gets the color of the led.
public GetColor ( byte &r, byte &g, byte &b ) : System.Boolean
r byte The red component.
g byte The green component.
b byte The blue component.
Résultat System.Boolean

GetColor() public méthode

Gets the color of the led.
public GetColor ( byte index, byte &r, byte &g, byte &b ) : System.Boolean
index byte
r byte The red component.
g byte The green component.
b byte The blue component.
Résultat System.Boolean

GetColors() public méthode

Gets led data.
public GetColors ( byte &colorData ) : System.Boolean
colorData byte
Résultat System.Boolean

GetInfoBlock() public méthode

Gets the info block.
public GetInfoBlock ( byte id, byte &data ) : System.Boolean
id byte Identifier.
data byte Data.
Résultat System.Boolean

GetLedCount() public méthode

public GetLedCount ( ) : int
Résultat int

GetMode() public méthode

Gets the mode on BlinkStick Pro.
public GetMode ( ) : int
Résultat int

Morph() public méthode

Morph from current color to new color.
public Morph ( RgbColor color, int duration = 1000, int steps = 50 ) : void
color RgbColor Must be in #rrggbb format or named color ("red", "green", "blue")
duration int How long should the morph last
steps int How many steps for color changes
Résultat void

Morph() public méthode

Morph from current color to new color on BlinkStick Pro.
public Morph ( byte channel, byte index, RgbColor color, int duration = 1000, int steps = 50 ) : void
channel byte Channel (0 - R, 1 - G, 2 - B)
index byte Index of the LED
color RgbColor Color parameter as RgbColor class instance
duration int How long should the morph last
steps int How many steps for color changes
Résultat void

Morph() public méthode

Morph from current color to new color on BlinkStick Pro.
public Morph ( byte channel, byte index, byte r, byte g, byte b, int duration = 1000, int steps = 50 ) : void
channel byte Channel (0 - R, 1 - G, 2 - B)
index byte Index of the LED
r byte The red component.
g byte The green component.
b byte The blue component.
duration int How long should the morph last
steps int How many steps for color changes
Résultat void

Morph() public méthode

Morph from current color to new color.
public Morph ( byte r, byte g, byte b, int duration = 1000, int steps = 50 ) : void
r byte The red component.
g byte The green component.
b byte The blue component.
duration int How long should the morph last
steps int How many steps for color changes
Résultat void

Morph() public méthode

Morph from current color to new color on BlinkStick Pro.
public Morph ( byte channel, byte index, string color, int duration = 1000, int steps = 50 ) : void
channel byte Channel (0 - R, 1 - G, 2 - B)
index byte Index of the LED
color string Must be in #rrggbb format or named color ("red", "green", "blue")
duration int How long should the morph last
steps int How many steps for color changes
Résultat void

Morph() public méthode

Morph from current color to new color.
public Morph ( string color, int duration = 1000, int steps = 50 ) : void
color string Must be in #rrggbb format or named color ("red", "green", "blue")
duration int How long should the morph last
steps int How many steps for color changes
Résultat void

OnReceiveColor() public méthode

public OnReceiveColor ( byte index, byte &r, byte &g, byte &b ) : System.Boolean
index byte
r byte
g byte
b byte
Résultat System.Boolean

OnSendColor() public méthode

public OnSendColor ( byte channel, byte index, byte r, byte g, byte b ) : System.Boolean
channel byte
index byte
r byte
g byte
b byte
Résultat System.Boolean

OpenDevice() public méthode

Attempts to connect to a BlinkStick device. After a successful connection, a DeviceAttached event will normally be sent.
public OpenDevice ( ) : bool
Résultat bool

OpenDevice() public méthode

Opens the device.
public OpenDevice ( HidDevice adevice ) : bool
adevice HidLibrary.HidDevice Pass the parameter of HidDevice to open it directly
Résultat bool

Pulse() public méthode

Pulse specified color.
public Pulse ( RgbColor color, int repeats = 1, int duration = 1000, int steps = 50 ) : void
color RgbColor Must be in #rrggbb format or named color ("red", "green", "blue")
repeats int
duration int How long should the morph last
steps int How many steps for color changes
Résultat void

Pulse() public méthode

Pulse specified color on BlinkStick Pro.
public Pulse ( byte channel, byte index, RgbColor color, int repeats = 1, int duration = 1000, int steps = 50 ) : void
channel byte Channel (0 - R, 1 - G, 2 - B)
index byte Index of the LED
color RgbColor Color parameter as RgbColor class instance
repeats int
duration int How long should the morph last
steps int How many steps for color changes
Résultat void

Pulse() public méthode

Pulse specified color on BlinkStick Pro.
public Pulse ( byte channel, byte index, byte r, byte g, byte b, int repeats = 1, int duration = 1000, int steps = 50 ) : void
channel byte Channel (0 - R, 1 - G, 2 - B)
index byte Index of the LED
r byte The red component.
g byte The green component.
b byte The blue component.
repeats int
duration int How long should the morph last
steps int How many steps for color changes
Résultat void

Pulse() public méthode

Pulse specified color.
public Pulse ( byte r, byte g, byte b, int repeats = 1, int duration = 1000, int steps = 50 ) : void
r byte The red component.
g byte The green component.
b byte The blue component.
repeats int
duration int How long should the morph last
steps int How many steps for color changes
Résultat void

Pulse() public méthode

Pulse specified color on BlinkStick Pro.
public Pulse ( byte channel, byte index, string color, int repeats = 1, int duration = 1000, int steps = 50 ) : void
channel byte Channel (0 - R, 1 - G, 2 - B)
index byte Index of the LED
color string Must be in #rrggbb format or named color ("red", "green", "blue")
repeats int
duration int How long should the morph last
steps int How many steps for color changes
Résultat void

Pulse() public méthode

Pulse specified color.
public Pulse ( string color, int repeats = 1, int duration = 1000, int steps = 50 ) : void
color string Must be in #rrggbb format or named color ("red", "green", "blue")
repeats int
duration int How long should the morph last
steps int How many steps for color changes
Résultat void

SetColor() public méthode

Sets the color of the led.
public SetColor ( RgbColor color ) : void
color RgbColor Color as RgbColor class.
Résultat void

SetColor() public méthode

Sets the color of the led.
public SetColor ( String color ) : void
color String Must be in #rrggbb format
Résultat void

SetColor() public méthode

Sets the color of the led.
public SetColor ( byte channel, byte index, RgbColor color ) : void
channel byte Channel (0 - R, 1 - G, 2 - B)
index byte Index of the LED
color RgbColor Color parameter as RgbColor class instance
Résultat void

SetColor() public méthode

Sets the color of the led.
public SetColor ( byte r, byte g, byte b ) : void
r byte The red component.
g byte The green component.
b byte The blue component.
Résultat void

SetColor() public méthode

Sets the color of the led.
public SetColor ( byte channel, byte index, byte r, byte g, byte b ) : void
channel byte Channel (0 - R, 1 - G, 2 - B)
index byte Index of the LED
r byte The red component.
g byte The green component.
b byte The blue component.
Résultat void

SetColor() public méthode

Sets the color of the led.
public SetColor ( byte channel, byte index, string color ) : void
channel byte Channel (0 - R, 1 - G, 2 - B)
index byte Index of the LED
color string Must be in #rrggbb format or named color ("red", "green", "blue")
Résultat void

SetColors() public méthode

Send a packet of data to LEDs
public SetColors ( byte channel, byte colorData ) : void
channel byte Channel (0 - R, 1 - G, 2 - B)
colorData byte
Résultat void

SetInfoBlock() protected méthode

protected SetInfoBlock ( byte id, byte data ) : void
id byte
data byte
Résultat void

SetLedCount() public méthode

public SetLedCount ( byte count ) : void
count byte
Résultat void

SetMode() public méthode

Sets the mode for BlinkStick Pro.
public SetMode ( byte mode ) : void
mode byte 0 - Normal, 1 - Inverse, 2 - WS2812
Résultat void

Stop() public méthode

public Stop ( ) : void
Résultat void

TurnOff() public méthode

Turn BlinkStick off.
public TurnOff ( ) : void
Résultat void

WaitThread() public méthode

public WaitThread ( long milliseconds ) : System.Boolean
milliseconds long
Résultat System.Boolean

Property Details

connectedToDriver protected_oe property

protected bool connectedToDriver
Résultat bool