Struct wemo::Switch
[−]
[src]
pub struct Switch { pub serial_number: Option<String>, // some fields omitted }
Represents a Wemo Switch device.
Fields
serial_number: Option<String>
The device's unique serial number.
Methods
impl Switch
[src]
Functions for WeMo Switch.
fn new(url: Url) -> Switch
Switch CTOR.
fn from_static_ip(ip_address: IpAddr) -> Switch
Construct a device that lives behind a static IP address. We won't need to issue later SSDP searches to find or relocate the device.
fn from_static_ip_and_port(ip_address: IpAddr, port: u16) -> Switch
Also include port (ports are subject to change).
fn from_dynamic_ip(ip_address: IpAddr) -> Switch
Construct a device that lives behind a static IP address. We may need to relocate this device later if it changes IP by issuing SSDP searches.
fn from_dynamic_ip_and_port(ip_address: IpAddr, port: u16) -> Switch
Also include port (ports are subject to change).
fn from_url(url: &str) -> Result<Switch, ParseError>
Switch CTOR.
fn from_ip_and_port(ip_addr: &str, port: u16) -> Switch
Switch CTOR.
fn turn_on(&self, timeout: Duration) -> WemoResult
Turn the device on.
fn turn_on_with_retry(&self, timeout: Duration) -> WemoResult
Turn the device on.
fn turn_off(&self, timeout: Duration) -> WemoResult
Turn the device off.
fn turn_off_with_retry(&self, timeout: Duration) -> WemoResult
Turn the device off.
fn toggle(&self, timeout: Duration) -> WemoResult
Toggle the device on or off.
fn toggle_with_retry(&self, timeout: Duration) -> WemoResult
Toggle the device on or off.
fn get_state(&self, timeout: Duration) -> WemoResult
Get the current state of the device.
fn set_state(&self, state: WemoState, timeout: Duration) -> WemoResult
Set the current state of the device.
fn get_state_with_retry(&self, timeout: Duration) -> WemoResult
fn set_state_with_retry(
&self,
state: WemoState,
timeout: Duration
) -> WemoResult
&self,
state: WemoState,
timeout: Duration
) -> WemoResult
fn get_ip_address(&self) -> Option<IpAddr>
Returns the static IP if the Wemo was configured with a static IP, otherwise returns the last cached IP address (which may not be set).
fn get_port(&self) -> Option<u16>
Get the currently known port. If we haven't manually set the port or talked to the Wemo device yet, the port will not be set.
fn relocate(&self, timeout: Duration) -> Option<Switch>
Attempt to find the Switch on the network via SSDP. Both the IP address and port will be updated if they changed. (The IP address will not be updated if the device is configured to use a static IP.)
fn name(&self) -> String
Return the IP/port, name, or other identifier for logging. Not a useful format for converting into a URL.