[−][src]Struct sonos_discovery::Discover
Discover
type
Used for discovering sonos devices in the local network via the simple service discovery protocol (ssdp). The ssd-protocol works via udp sockets. First a certain search-message is sent to the multicast address (239.255.255.250:1900).
All answer from upnp (universal plug and play) ready devices are processed and filtered ("Sonos" is in the reply).
Methods
impl Discover
[src]
pub fn new() -> Result<Self>
[src]
Creates a new Discovery
. Uses the default socket on the default ipv4 multicast address (239.255.255.250:1900).
Examples
use sonos_discovery::Discovery; let discovery: Discovery = Discovery::new().unwrap();
pub fn with_address(address: SocketAddr) -> Result<Self>
[src]
Creates a new Discovery
with a custom multicast address.
pub fn start(
&self,
timeout: Option<u32>,
device_count: Option<usize>
) -> Result<Vec<IpAddr>>
[src]
&self,
timeout: Option<u32>,
device_count: Option<usize>
) -> Result<Vec<IpAddr>>
Start discovering devices.
Examples
In this example the search will stop if3 devices have been discovered or the default timeout (5s) is reached. This is useful if you know the amount of speakers you have and want to reduce the search time.
use sonos_discovery::Discovery; let devices: Vec<IpAddr> = Discovery::new().unwrap().start(None, Some(3)).unwrap();
Trait Implementations
Auto Trait Implementations
impl Send for Discover
impl Sync for Discover
impl Unpin for Discover
impl UnwindSafe for Discover
impl RefUnwindSafe for Discover
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,