Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Library in rust to discover sonos devices via ssdp (UPnP discovery)

License

Notifications You must be signed in to change notification settings

torbencarstens/sonos_discovery

Repository files navigation

CircleCI

Sonos discovery

Library in rust to discover sonos devices via ssdp (UPnP discovery)

Disclaimer

Only works on unix systems at the moment.

Windows support is planned for later versions.

Reason

socket only works on linux.

Usage

Unix systems only

Cargo.toml
sonos_discovery = "0.0.1"
Rust
extern crate sonos_discovery;

use sonos_discovery::Discover;
use std::net::IpAddr;

fn main() {
    let discovery: Discover = Discover::new().unwrap();
    // fn start(self, timeout: Option<u32>, device_count: Option<usize>)
    // timeout default: 5 | device_count: u32::MAX
    // Checks that {discovered_devices} < {device_count} && {elapsed_time} < {timeout}
    // Waits until 3 devices are found, or 5seconds have elapsed
    let sonos_ips: HashSet<IpAddr> = discovery.start(None, Some(3)).unwrap();
    for sonos_ip in sonos_ips {
        println!("{}", sonos_ip);
    }
}

TODO

Add crossplatform support (Windows)

  • Swap socket with a crossplatform library
  • Implement socket with the windows-api and make a simple crossplatform library

About

Library in rust to discover sonos devices via ssdp (UPnP discovery)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages