4 device
crate-kit edited this page 2026-11-14 04:21:21 +00:00

pmossdp > device

Module: device

Contents

Structs


pmossdp::device::SsdpDevice

Struct

Appareil annoncé par un SsdpServer, avec ses métadonnées SSDP.

SsdpDevice::new fabrique les types de notification (NT) habituels d'un appareil racine ; ils peuvent être complétés avec add_notification_type. Les types uuid:<uuid> et celui de l'appareil sont toujours présents ; seul upnp:rootdevice peut être retiré, avec without_root_device, pour une entité qui n'est pas un appareil UPnP.

Exemple

use pmossdp::SsdpDevice;

let mut device = SsdpDevice::new(
    "0f3c9a52-7b1e-4c43-9d57-2a1b6e0c8f10".into(),
    "urn:schemas-upnp-org:device:MediaRenderer:1".into(),
    "http://192.168.1.10:8080/desc.xml".into(),
    "Linux UPnP/1.1 MonApp/1.0".into(),
);
device.add_notification_type("urn:schemas-upnp-org:service:AVTransport:1".into());
assert_eq!(device.notification_types().len(), 4);
assert_eq!(device.uuid(), "0f3c9a52-7b1e-4c43-9d57-2a1b6e0c8f10");

Methods:

  • fn new(uuid: String, device_type: String, location: String, server: String) -> Self - Crée un appareil dont les types de notification sont uuid:<uuid>, upnp:rootdevice et
  • fn without_root_device(self: Self) -> Self - Retire upnp:rootdevice des types annoncés.
  • fn with_config_id(self: Self, config_id: u32) -> Self - Déclare l'appareil UPnP 1.1 : ses annonces, réponses et byebye portent alors
  • fn with_fixed_location(self: Self) -> Self - Garde la LOCATION telle qu'elle a été donnée sur tous les réseaux, au lieu d'y mettre
  • fn add_notification_type(self: & mut Self, nt: String) - Ajoute un type de notification (par exemple celui d'un service), sauf s'il est déjà présent.
  • fn uuid(self: &Self) -> &str - UUID de l'appareil, sans le préfixe uuid:.
  • fn device_type(self: &Self) -> &str - Type de l'appareil, par exemple urn:schemas-upnp-org:device:MediaRenderer:1.
  • fn location(self: &Self) -> &str - URL de la description XML de l'appareil (LOCATION).
  • fn location_for(self: &Self, local: Ipv4Addr) -> String - La LOCATION à donner à un point de contrôle qui joint cette machine par local : celle
  • fn server(self: &Self) -> &str - Identification du logiciel (SERVER).
  • fn notification_types(self: &Self) -> &[String] - Types de notification (NT) annoncés par l'appareil, dans l'ordre d'annonce.
  • fn config_id(self: &Self) -> Option<u32> - CONFIGID.UPNP.ORG déclaré par with_config_id, s'il y en a un.

Traits: Eq

Trait Implementations:

  • Clone
    • fn clone(self: &Self) -> Self
  • Debug
    • fn fmt(self: &Self, f: & mut $crate::fmt::Formatter) -> $crate::fmt::Result
  • PartialEq
    • fn eq(self: &Self, other: &Self) -> bool