Blink1Device

Represents a physical device.

To get a reference to a device, one should call either open, openByPath, openBySerial or openByIndex. After being done with the device, please call close to release OS resources.

class Blink1Device {}

Members

Functions

close
void close()

Closes this device.

disableServerDown
void disableServerDown()

Disables the serverDown mode.

enableServerDown
void enableServerDown(Duration timeout, bool stayLit, ubyte startPosition, ubyte endPosition)

Enables the blink1's dead man's trigger. This will play the pattern on the LED when pokeServerDown hasn't been called after timeout has been passed.

fadeToHSV
void fadeToHSV(ubyte h, ubyte s, ubyte v, Duration dur, LED led)

Fades the color to the specified value with the given duration.

fadeToRGB
void fadeToRGB(ubyte r, ubyte g, ubyte b, Duration dur, LED led)

Fades the color to the specified value with the given duration.

getFwVersion
string getFwVersion()

Returns the firmware version as a string in the form of v{major}.{minor}

getFwVersionInt
int getFwVersionInt()

Returns the firmware version integer.

getStartupParameters
StartupParameters getStartupParameters()

Reads the startup parameters of the device.

play
void play(ubyte start, ubyte end, ubyte count)
void play(ubyte start)

Plays a stored pattern. The end and count parameters are only supported on MK2 and later devices.

pokeServerDown
void pokeServerDown()

Notifies the LED the "server" is still running, so it won't turn on.

readNote
ubyte[] readNote(ubyte id)

Reads a note from the device.

readPatternLine
PatternLine readPatternLine(ubyte pos)

Reads the stored pattern line at position pos.

readPlayState
PlayState readPlayState()

Read the play state. Supported on MK2 devices and later.

savePattern
void savePattern()

Saves the pattern in the device's ram to nonvolatile memory. Only works on MK2 devices with firmware 204 or later, or later devices.

setHSV
void setHSV(ubyte h, ubyte s, ubyte v)

Immediatelty changes the color to the given value

setRGB
void setRGB(ubyte r, ubyte g, ubyte b)

Immediatelty changes the color to the given value

setStartupParameters
void setStartupParameters(BootMode bootMode, ubyte playStart, ubyte playEnd, ubyte playCount)
void setStartupParameters(StartupParameters params)

Sets the startup parameters

stop
void stop()

Stop playing whatever pattern the device is playing.

writeNote
void writeNote(ubyte id, ubyte[] note)

Writes a note with the given id.

writePatternLine
void writePatternLine(ubyte pos, PatternLine patternLine)

Writes a pattern line to the device.

writePatternLineHSV
void writePatternLineHSV(ubyte pos, ubyte h, ubyte s, ubyte v, Duration duration, LED led)

Writes a pattern line to the device.

writePatternLineRGB
void writePatternLineRGB(ubyte pos, ubyte r, ubyte g, ubyte b, Duration duration, LED led)

Writes a pattern line to the device.

Properties

blocking
bool blocking [@property setter]

Enables/disables blocking mode

blocking
bool blocking [@property getter]

Returns if blocking mode is enabled.

defaultDuration
Duration defaultDuration [@property setter]

Sets the default duration for fade animations if no duration parameter is given.

defaultDuration
Duration defaultDuration [@property getter]

Gets the default duration for fade animations if no duration parameter is given.

maxPatterns
int maxPatterns [@property getter]

Returns the maximum amount of patterns this device may hold.

path
string path [@property getter]

The path of this device

serial
string serial [@property getter]

The serial number of this device.

type
Blink1Type type [@property getter]

Gets the device type of this device.

Static functions

connectedDeviceCount
int connectedDeviceCount()

Returns the amount of detected Blink1 devices.

open
Blink1Device open()

Opens the first found default Blink1Device. No guarantees are given which one is found first.

openByIndex
Blink1Device openByIndex(uint index)

Opens the device by the given index.

openByPath
Blink1Device openByPath(string path)

Obtains a Blink1 device by the OS-specific path.

openBySerial
Blink1Device openBySerial(string serial)

Opens the device by the given serial number.

Variables

m_cachedIndex
int m_cachedIndex;

The index of our device within the blink1 library's cache.

m_device
blink1_device* m_device;

Our "handle" to the blink led.

maxNoteSize
auto maxNoteSize;
Undocumented in source.
maxNotes
auto maxNotes;

The maximum amount of notes that this device may hold.

Meta