Reefact.LuxaforLightingDeviceController
2.0.0
Prefix Reserved
See the version list below for details.
dotnet add package Reefact.LuxaforLightingDeviceController --version 2.0.0
NuGet\Install-Package Reefact.LuxaforLightingDeviceController -Version 2.0.0
<PackageReference Include="Reefact.LuxaforLightingDeviceController" Version="2.0.0" />
<PackageVersion Include="Reefact.LuxaforLightingDeviceController" Version="2.0.0" />
<PackageReference Include="Reefact.LuxaforLightingDeviceController" />
paket add Reefact.LuxaforLightingDeviceController --version 2.0.0
#r "nuget: Reefact.LuxaforLightingDeviceController, 2.0.0"
#:package Reefact.LuxaforLightingDeviceController@2.0.0
#addin nuget:?package=Reefact.LuxaforLightingDeviceController&version=2.0.0
#tool nuget:?package=Reefact.LuxaforLightingDeviceController&version=2.0.0
Version française - Nederlandse versie - Svensk version - Deutsche Version - Versión española - Ελληνική έκδοση
Luxafor Device Controller
A .Net library that provides a simple API to control Luxafor devices.
Luxafor
Company Overview
Luxafor is a company that designs and sells products for office productivity, such as availability indicators and notification tools.
Their flagship product is an LED availability indicator that can be programmed to display different colors depending on the user's availability status.
Luxafor's goal is to provide users with a simple and effective way to signal their availability to co-workers and improve communication and collaboration in the workplace.
Quick overview of the devices
Here is a non-exhaustive list of Luxafor devices:
Luxafor Flag: an LED availability indicator that displays personal availabilityLuxafor Bluetooth: a wireless, software-controlled LED availability indicator that displays notifications and personal availabilityLuxafor Switch: a wireless, remote-controlled availability indicator that displays the availability of meeting rooms and workstations in real timeLuxafor Cube: a standalone LED availability indicator that displays meeting room availabilityLuxafor Pomodoro-Timer: a USB-powered LED timer that divides work into smaller time slots (see Pomodoro)Luxafor Orb: a wide angle USB LED availability indicatorLuxafor CO2 Monitor: a sensor that analyzes the air quality of a room and alerts you when it needs to be ventilatedLuxafor Mute Button: turn on/off the microphone with a single touch and indicate if you are available with the red/greenLuxafor Colorblind Flag: monochrome USB LED availability light eliminates distractions and boosts productivity
Integration
These different devices are designed to be driven manually ('mechanical') for some, semi-automatically (manual driving via software) / automatically (integration via software to tools like Teams, Skype, Cisco, Zappier or via Webhook) for others.
Presentation of the library
This library aims to allow the integration of USB LED devices into your in-house applications without having to go through the Luxafor server (webhook).
It targets .NET Standard 2.0 and .NET Framework 4.6.2, and is based on the library HidLibrary which makes it possible to enumerate and communicate with HID-compatible USB devices in .NET.
Windows only. The devices are driven through the Windows HID stack: the package installs on any platform, but the devices can only be enumerated and controlled on Windows.
Supported devices
The library drives the Luxafor devices identified by the vendor id 1240 (0x04D8) and the product id 62322 (0xF372), through their USB HID protocol.
| Device | Status |
|---|---|
Luxafor Orb |
Tested: the device used to develop and validate the library (6 addressable LEDs). |
Luxafor Flag |
Expected to work, not tested: same identifiers and same lighting protocol (6 addressable LEDs). |
Luxafor Mute Button, Luxafor Colorblind Flag |
Expected to work, not tested: the lighting commands are the same; the LED layout, the number of LEDs and the color rendering may differ. |
Luxafor Bluetooth, Luxafor Switch, Luxafor Cube, Luxafor Pomodoro-Timer, Luxafor CO2 Monitor |
Not supported: these devices are not driven through this USB HID protocol. |
Feedback about an untested device is very welcome: please open an issue.
Installation
dotnet add package Reefact.LuxaforLightingDeviceController
Getting started
The code below presents an example of basic use of the library for the control of a Luxafor Orb device.
[Fact]
public void french_sequence() {
using ILuxaforDevice orb = Luxafor.GetDevices().First();
for (var i = 0; i < 3; i++) {
orb.SetColor(BrightColor.Blue);
Thread.Sleep(500);
orb.SetColor(BrightColor.White);
Thread.Sleep(500);
orb.SetColor(BrightColor.Red);
Thread.Sleep(500);
orb.TurnOff();
Thread.Sleep(1000);
}
}
Line 3 shows how to connect to a single Orb connected to the machine's USB port. ILuxaforDevice implements IDisposable: the using statement releases the device handle at the end of the block.
Getting a device
IEnumerable<ILuxaforDevice> GetDevices(); // All the Luxafor devices connected to the USB ports (empty when none is plugged in)
ILuxaforDevice GetDevice(string devicePath); // The Luxafor device located at the given path
Luxafor.GetDevice throws a LuxaforDeviceNotFoundException when no device is found at the given path, when the device found there is not a supported Luxafor device, or when it is not connected anymore.
using ILuxaforDevice orb = Luxafor.GetDevice(@"\\?\hid#vid_04d8&pid_f372#...");
I will quickly go through all the possible commands to send to devices from the ILuxaforDevice.
Every command returns a bool: true when the device accepted the command, false when the write failed (device unplugged, taken by another application, ...). Invalid arguments throw (ArgumentNullException, ArgumentOutOfRangeException, InvalidEnumArgumentException).
Turn off
bool TurnOff(); // Turns off all the LEDs of the device
bool TurnOff(TargetedLeds targetedLeds); // Turn off the targeted LEDs of the device
Set a single color
bool SetColor(BrightColor color); // Turns on the device's LEDs in a custom color.
bool SetColor(TargetedLeds targetedLeds, BrightColor color); // Turns on the targeted device LEDs in a custom color.
Make a transition (fade)
bool FadeColor(BrightColor color, FadeDuration duration); // Make a transition from all the LEDs of the device to a custom color
bool FadeColor(TargetedLeds targetedLeds, BrightColor color, FadeDuration duration); // Performs a transition from the targeted device LEDs to a custom color
Flashing (strobe effect)
bool Strobe(BrightColor color, Speed speed, Repeat repeat); // Flashes all the LEDs of the device in a custom color
bool Strobe(TargetedLeds targetedLeds, BrightColor color, Speed speed, Repeat repeat); // Flashes the targeted device LEDs in a custom color
Waves / built-in patterns
bool PlayPattern(WavePattern wavePattern, BrightColor color, Speed speed, Repeat repeat); // Starts a wave pattern that targets all the LEDs of the device based on a custom color
bool PlayPattern(BuiltInPattern pattern, Repeat repeat); // Starts an embedded pattern that targets all LEDs on the device
Send a command
It is possible to create custom commands called LightingCommand so that they can be reused in the code:
var command = LightingCommand.CreateStrobeCommand(TargetedLeds.All, BrightColor.Yellow, Speed.FromByte(20), Repeat.Count(3));
The Send method allows you to use these commands.
bool Send(LightingCommand command); // Send a command to the device
Colors
BrightColor.Red; // and Green, Blue, Yellow, Cyan, Magenta, White, Black
BrightColor.From("#0F11A8"); // From its hexadecimal representation
BrightColor.From(15, 17, 168); // From its red, green and blue components
Building the library
dotnet build -c Release
dotnet test -c Release
dotnet pack Reefact.LuxaforLightingDeviceController -c Release -o artifacts
License
This library is distributed under the Apache-2.0 license.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- hidlibrary (>= 3.3.40)
-
.NETStandard 2.0
- hidlibrary (>= 3.3.40)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
See the CHANGELOG.md file of the repository.