glow_control_lib/
lib.rs

1//! # Glow Control Library for Twinkly LEDs
2//!
3//! `glow-control-lib` is a Rust library for controlling Twinkly LED devices. It provides
4//! a set of APIs to interact with LED hardware, allowing users to discover devices,
5//! set device modes, control real-time lighting effects, and more.
6//!
7//! This library is designed to be used by command-line tools or other client applications
8//! that require control over LED lighting systems.
9//!
10//! ## Features
11//!
12//! - Device discovery on local networks
13//! - High-level control interfaces for device modes and settings
14//! - Real-time effect control and custom LED movie uploads
15//! - Utility functions for device authentication and communication
16//!
17//! ## Example
18//!
19//! Here is a simple example of how to use the library to discover Twinkly devices on your network:
20//!
21//! ```no_run
22//! use glow_control_lib::util::discovery::Discovery;
23//! use std::time::Duration;
24//!
25//! #[tokio::main]
26//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
27//!     // Discover devices with a 5-second timeout
28//!     let devices = Discovery::find_devices(Duration::from_secs(5)).await?;
29//!
30//!     // Iterate over the discovered devices and print their details
31//!     for device in devices {
32//!         println!("Found device: {:?}", device);
33//!     }
34//!
35//!     Ok(())
36//! }
37//! ```
38//!
39//! ## Disclaimer
40//!
41//! This project is not affiliated with, authorized by, endorsed by, or in any way officially connected
42//! with Twinkly or its affiliates. The official Twinkly website can be found at [https://www.twinkly.com](https://www.twinkly.com).
43//!
44//! ## License
45//!
46//! This project is dual-licensed under the MIT License and the Apache License, Version 2.0.
47//! You may choose to use either license, depending on your project needs.
48//! See the `LICENSE-MIT` and `LICENSE-APACHE` files for the full text of the licenses.
49// The `control_interface` module provides an interface for communicating with
50// LED devices. It includes methods for sending commands, querying device status,
51// and managing device settings.
52//
53// Example usage:
54//
55// ```
56// use glow_control_lib::control_interface::ControlInterface;
57// use glow_control_lib::control_interface::DeviceMode;
58//
59// #[tokio::main]
60// async fn main() {
61//     let control = ControlInterface::new("192.168.1.100", "AA:BB:CC:DD:EE:FF").await.unwrap();
62//     control.set_mode(DeviceMode::Color).await.unwrap();
63// }
64// ```
65pub mod control_interface;
66
67// The `led` module contains abstractions and utilities for working with LED colors,
68// patterns, and animations. It provides functionality to create and manipulate
69// color patterns, apply effects, and convert between different color models.
70//
71// Example usage:
72//
73// ```
74// use glow_control_lib::led::pattern::Pattern;
75// use glow_control_lib::led::led_color::LedColor;
76//
77// let led_color = LedColor::new();
78// let pattern = Pattern::make_color_spectrum_pattern(30, 0, 0.5, &led_color);
79// ```
80pub mod led;
81
82// The `util` module provides various utility functions and structures that support
83// the main functionality of the library. This includes authentication helpers,
84// device discovery mechanisms, and other shared resources used across the library.
85//
86// Example usage:
87//
88// ```
89// use glow_control_lib::util::discovery::Discovery;
90// use std::time::Duration;
91//
92// #[tokio::main]
93// async fn main() {
94//     let devices = Discovery::find_devices(Duration::from_secs(5)).await.unwrap();
95//     for device in devices {
96//         println!("Found device: {:?}", device);
97//     }
98// }
99// ```
100pub mod util;
101
102pub mod input_stream;