Mise en place d'un bus d'événements pour les serveurs de médias.

This commit is contained in:
2025-12-01 23:10:16 +01:00
parent ea1774f216
commit aeb9332387
12 changed files with 9436 additions and 9 deletions

View File

@@ -6,7 +6,7 @@ use axum::{
};
use std::{
collections::HashMap,
sync::{Arc, RwLock},
sync::{Arc, RwLock}, time::Duration,
};
use tracing::info;
use xmltree::{Element, EmitterConfig, XMLNode};
@@ -17,6 +17,8 @@ use crate::{
services::ServiceInstance,
};
const DEFAULT_NOTIFY_INTERVAL: Duration = Duration::from_secs(1);
/// Instance d'un device UPnP.
///
/// Représente une instance concrète d'un device UPnP, avec ses services instanciés
@@ -304,6 +306,8 @@ impl DeviceInstance {
.register_urls(server)
.await
.map_err(|e| DeviceError::UrlRegistrationError(e.to_string()))?;
// Start the periodic notifier so buffered state changes are flushed to subscribers.
let _ = service.start_notifier(DEFAULT_NOTIFY_INTERVAL);
}
// Enregistrer les sous-devices

View File

@@ -125,6 +125,7 @@ pub struct ServiceInstance {
seqid: Arc<Mutex<HashMap<String, u32>>>,
}
impl std::fmt::Debug for ServiceInstance {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("ServiceInstance")