pub struct Service { /* private fields */ }
Expand description

A UPnP Service is the description of endpoints on a device for performing actions and reading the service definition. For a list of actions and state variables the service provides, take a look at scpd.

Implementations

Returns the URN of this service.

Returns the Service Identifier.

Fetches the SCPD of this service.

Execute some UPnP Action on this service. The URL is usually obtained by the device this service was found on. The payload is xml-formatted data.

Example usage:
use rupnp::ssdp::URN;
use rupnp::Device;

let urn = URN::service("schemas-upnp-org", "RenderingControl", 1);

let device = Device::from_url( some_url ).await?;
let service = device.find_service(&urn)
    .expect("service exists");

let args = "<InstanceID>0</InstanceID><Channel>Master</Channel>";
let response = service.action(device.url(), "GetVolume", args).await?;

let volume = response
    .get("CurrentVolume")
    .expect("exists");

println!("Volume: {}", volume);

Subscribe for state variable changes.

It returns the SID which can be used to unsubscribe to the service and a stream of responses.

Each response is a HashMap of the state variables.

Example usage:
let (_sid, stream) = service.subscribe(device.url(), 300).await?;

while let Some(state_vars) = stream.try_next().await? {
    for (key, value) in state_vars {
        println!("{} => {}", key, value);
    }
}

Renew a subscription made with the subscribe method.

When the sid is invalid, the control point will respond with a 412 Preconditition failed.

Unsubscribe from further event notifications.

The SID is usually obtained by the subscribe method.

When the sid is invalid, the control point will respond with a 412 Preconditition failed.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more