rusty_sonos/lib.rs
1#![warn(missing_docs)]
2
3//! # rusty-sonos
4//! A Rust library that allows you to discover and interact with Sonos speakers
5//!
6//! Connecting to a Sonos speaker:
7//! ```rust,no_run
8//! # tokio_test::block_on(async {
9//! # use std::net::Ipv4Addr;
10//! # use rusty_sonos::speaker::Speaker;
11//! # use std::str::FromStr;
12//! let ip_addr = Ipv4Addr::from_str("192.168.1.0").unwrap();
13//!
14//! let speaker = Speaker::new(ip_addr).await.unwrap();
15//! # })
16//! ```
17//!
18//! Discovering speakers on the current network:
19//! ```rust,no_run
20//! # tokio_test::block_on(async {
21//! # use rusty_sonos::discovery::discover_devices;
22//! # use std::time::Duration;
23//! // search for 2 seconds, with a read timeout of 5 seconds
24//! let devices = discover_devices(Duration::from_secs(2), Duration::from_secs(5)).await.unwrap();
25//!
26//! for device in devices {
27//! println!("{}, {}", device.friendly_name(), device.room_name())
28//! }
29//! # })
30//! ```
31//!
32//! Get information about a speaker at a certain IP address
33//! ```rust,no_run
34//! # tokio_test::block_on(async {
35//! # use std::net::Ipv4Addr;
36//! # use rusty_sonos::discovery::get_speaker_info;
37//! # use std::str::FromStr;
38//! let ip_addr = Ipv4Addr::from_str("192.168.1.0").unwrap();
39//!
40//! let info = get_speaker_info(ip_addr).await.unwrap();
41//! # })
42//! ```
43
44pub mod discovery;
45pub mod errors;
46pub mod responses;
47mod services;
48pub mod speaker;
49mod xml;