ble-ledly
Customizable and extensible cross-platform high-level Bluetooth Low Energy light controller.

Provides out-of-the-box support for generic RGB led strips and BLE lamps and light bulbs. Designed to be extensible, allows to implement your own devices, communication protocol or both (See the readme file for more). Supports hardware specific animations (transferrable) and software non-transferrable animations.
Capabilities
Each device supports multiple capabilities available as featurs through conditional compilation in the .toml file.
= { = "0.3", = ["all"]}
Each capability provides a single point access to a specific device characteristic that can be manipulated through the publicly available set() method. All the methods are available through the standard API Capability::set(opts) or through more idiomatic methods as follow.
// standard
set.await?;
// idiomatic syntactic sugar
light.turn_on.await?;
| Capability | Description | Implemented? |
|---|---|---|
Light |
Light state (on/off) | ✅ |
Color |
Light Color (RGB) | ✅ |
Brightness |
Light white levels | ✅ |
HWAnimate |
Hardware specific animations (subjected to protocol) | ✅ |
SWAnimate |
Software animation (require continuous communication, but allows custom effect on any device) | ✅ |
Temperature |
Light temperature (K) |
Animations
Transferrable vs. Non-transferrable
Transferrable animations are built-in in the target ble device which takes care of driving the led(s); once the command is sent, no extra communication needed between the client and ble light controller. Non-transferrable animations bypass the controller's built-in effects and allow for higher degree of customization while providing support for legacy or cheap light controllers allowing to provide effects otherwise not available to the target device. As a consequence, this requires continuous connection between the controller and client.
Current support
| Animation | Capability | Color Support | Implemented? |
|---|---|---|---|
| Pulsating | HWAnimate | Red/Green/Blue | ✅ |
| Breathing | SWAnimate | RGB/Any | ✅ |
| Rainbow Pulsating | HWAnimate | N/A | |
| Pulsating Bicolor | HWAnimate | Red/Green, Red/Blue, Green/Blue | |
| Rainbow flashing | HWAnimate | N/A | |
| Cross-fade | SWAnimate | RGB/Any | |
| Rainbow jumping | HWAnimate | N/A | |
| Flashing | HWAnimate | Red, Green, Blue, Yellow, Purple, Cyan |
Extensibility
This library has been designed with extensibility in mind.
- It is possible to create your own device by implementing the
Devicetrait and use the built-in communication protocol. - You can add your own communication protocol by implementing the
Protocoltrait and use it to drive one of the built-in devices. - Create your own
deviceandcommunication protocol.
Usage
An example using built-in device LedDevice and GenericRGB communication protocol. For more examples, see the examples folder.
Minimal Configuration
async
Light controls
use *;
use *;
use *;
use GenericRGB;
use Controller;
use LedDevice;
use ;
use Error;
use Duration;
use time;
async
Contributing
Open a PR or issue
License
MIT