C# Класс BlinkStickDotNet.BlinkStick

A model of the BlinkStick device itself
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
connectedToDriver bool

Открытые методы

Метод Описание
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

Защищенные методы

Метод Описание
SetInfoBlock ( byte id, byte data ) : void

Приватные методы

Метод Описание
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.

Описание методов

Blink() публичный Метод

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)
Результат void

Blink() публичный Метод

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)
Результат void

Blink() публичный Метод

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)
Результат void

Blink() публичный Метод

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)
Результат void

Blink() публичный Метод

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)
Результат void

Blink() публичный Метод

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)
Результат void

BlinkStick() публичный Метод

Initializes a new instance of the BlinkStick class.
public BlinkStick ( ) : System
Результат System

BlinkStickDeviceFromSerial() публичный статический Метод

public static BlinkStickDeviceFromSerial ( string serial ) : BlinkStickDeviceEnum
serial string
Результат BlinkStickDeviceEnum

CloseDevice() публичный Метод

Closes the connection to the device.
public CloseDevice ( ) : void
Результат void

Dispose() публичный Метод

Disposes of the device and closes the connection.
public Dispose ( ) : void
Результат void

Enable() публичный Метод

public Enable ( ) : void
Результат void

FindAll() публичный статический Метод

Find all BlinkStick devices.
public static FindAll ( ) : BlinkStickDotNet.BlinkStick[]
Результат BlinkStickDotNet.BlinkStick[]

FindBySerial() публичный статический Метод

Finds BlinkStick by serial number.
public static FindBySerial ( String serial ) : BlinkStick
serial String Serial number to search for
Результат BlinkStick

FindFirst() публичный статический Метод

Find first BlinkStick.
public static FindFirst ( ) : BlinkStick
Результат BlinkStick

GetColor() публичный Метод

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.
Результат System.Boolean

GetColor() публичный Метод

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.
Результат System.Boolean

GetColors() публичный Метод

Gets led data.
public GetColors ( byte &colorData ) : System.Boolean
colorData byte
Результат System.Boolean

GetInfoBlock() публичный Метод

Gets the info block.
public GetInfoBlock ( byte id, byte &data ) : System.Boolean
id byte Identifier.
data byte Data.
Результат System.Boolean

GetLedCount() публичный Метод

public GetLedCount ( ) : int
Результат int

GetMode() публичный Метод

Gets the mode on BlinkStick Pro.
public GetMode ( ) : int
Результат int

Morph() публичный Метод

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
Результат void

Morph() публичный Метод

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
Результат void

Morph() публичный Метод

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
Результат void

Morph() публичный Метод

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
Результат void

Morph() публичный Метод

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
Результат void

Morph() публичный Метод

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
Результат void

OnReceiveColor() публичный Метод

public OnReceiveColor ( byte index, byte &r, byte &g, byte &b ) : System.Boolean
index byte
r byte
g byte
b byte
Результат System.Boolean

OnSendColor() публичный Метод

public OnSendColor ( byte channel, byte index, byte r, byte g, byte b ) : System.Boolean
channel byte
index byte
r byte
g byte
b byte
Результат System.Boolean

OpenDevice() публичный Метод

Attempts to connect to a BlinkStick device. After a successful connection, a DeviceAttached event will normally be sent.
public OpenDevice ( ) : bool
Результат bool

OpenDevice() публичный Метод

Opens the device.
public OpenDevice ( HidDevice adevice ) : bool
adevice HidLibrary.HidDevice Pass the parameter of HidDevice to open it directly
Результат bool

Pulse() публичный Метод

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
Результат void

Pulse() публичный Метод

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
Результат void

Pulse() публичный Метод

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
Результат void

Pulse() публичный Метод

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
Результат void

Pulse() публичный Метод

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
Результат void

Pulse() публичный Метод

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
Результат void

SetColor() публичный Метод

Sets the color of the led.
public SetColor ( RgbColor color ) : void
color RgbColor Color as RgbColor class.
Результат void

SetColor() публичный Метод

Sets the color of the led.
public SetColor ( String color ) : void
color String Must be in #rrggbb format
Результат void

SetColor() публичный Метод

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
Результат void

SetColor() публичный Метод

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.
Результат void

SetColor() публичный Метод

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.
Результат void

SetColor() публичный Метод

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")
Результат void

SetColors() публичный Метод

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
Результат void

SetInfoBlock() защищенный Метод

protected SetInfoBlock ( byte id, byte data ) : void
id byte
data byte
Результат void

SetLedCount() публичный Метод

public SetLedCount ( byte count ) : void
count byte
Результат void

SetMode() публичный Метод

Sets the mode for BlinkStick Pro.
public SetMode ( byte mode ) : void
mode byte 0 - Normal, 1 - Inverse, 2 - WS2812
Результат void

Stop() публичный Метод

public Stop ( ) : void
Результат void

TurnOff() публичный Метод

Turn BlinkStick off.
public TurnOff ( ) : void
Результат void

WaitThread() публичный Метод

public WaitThread ( long milliseconds ) : System.Boolean
milliseconds long
Результат System.Boolean

Описание свойств

connectedToDriver защищенное свойство

protected bool connectedToDriver
Результат bool