implemente le squelette de pmomediaserver
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
use crate::connectionmanager::variables::CURRENTCONNECTIONIDS;
|
||||
use pmoupnp::define_action;
|
||||
|
||||
define_action! {
|
||||
pub static GETCURRENTCONNECTIONIDS = "GetCurrentConnectionIDs" {
|
||||
out "ConnectionIDs" => CURRENTCONNECTIONIDS,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
use crate::connectionmanager::variables::{
|
||||
A_ARG_TYPE_CONNECTIONID, A_ARG_TYPE_RCSID, A_ARG_TYPE_AVTRANSPORTID,
|
||||
A_ARG_TYPE_PROTOCOLINFO, A_ARG_TYPE_DIRECTION, A_ARG_TYPE_CONNECTIONSTATUS,
|
||||
};
|
||||
use pmoupnp::define_action;
|
||||
|
||||
define_action! {
|
||||
pub static GETCURRENTCONNECTIONINFO = "GetCurrentConnectionInfo" {
|
||||
in "ConnectionID" => A_ARG_TYPE_CONNECTIONID,
|
||||
out "RcsID" => A_ARG_TYPE_RCSID,
|
||||
out "AVTransportID" => A_ARG_TYPE_AVTRANSPORTID,
|
||||
out "ProtocolInfo" => A_ARG_TYPE_PROTOCOLINFO,
|
||||
out "PeerConnectionManager" => A_ARG_TYPE_CONNECTIONID,
|
||||
out "PeerConnectionID" => A_ARG_TYPE_CONNECTIONID,
|
||||
out "Direction" => A_ARG_TYPE_DIRECTION,
|
||||
out "Status" => A_ARG_TYPE_CONNECTIONSTATUS,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
use crate::connectionmanager::variables::{SOURCEPROTOCOLINFO, SINKPROTOCOLINFO};
|
||||
use pmoupnp::define_action;
|
||||
|
||||
define_action! {
|
||||
pub static GETPROTOCOLINFO = "GetProtocolInfo" {
|
||||
out "Source" => SOURCEPROTOCOLINFO,
|
||||
out "Sink" => SINKPROTOCOLINFO,
|
||||
}
|
||||
}
|
||||
7
pmomediaserver/src/connectionmanager/actions/mod.rs
Normal file
7
pmomediaserver/src/connectionmanager/actions/mod.rs
Normal file
@@ -0,0 +1,7 @@
|
||||
mod getprotocolinfo;
|
||||
mod getcurrentconnectionids;
|
||||
mod getcurrentconnectioninfo;
|
||||
|
||||
pub use getprotocolinfo::GETPROTOCOLINFO;
|
||||
pub use getcurrentconnectionids::GETCURRENTCONNECTIONIDS;
|
||||
pub use getcurrentconnectioninfo::GETCURRENTCONNECTIONINFO;
|
||||
99
pmomediaserver/src/connectionmanager/mod.rs
Normal file
99
pmomediaserver/src/connectionmanager/mod.rs
Normal file
@@ -0,0 +1,99 @@
|
||||
//! # ConnectionManager Service - Service de gestion des connexions UPnP
|
||||
//!
|
||||
//! Ce module implémente le service ConnectionManager:1 selon la spécification UPnP AV.
|
||||
//! Le service ConnectionManager gère les connexions entre MediaServer et MediaRenderer,
|
||||
//! et expose les protocoles et formats supportés.
|
||||
//!
|
||||
//! ## Fonctionnalités
|
||||
//!
|
||||
//! Le service ConnectionManager permet :
|
||||
//! - **Énumération des protocoles** : GetProtocolInfo
|
||||
//! - **Gestion des connexions** : GetCurrentConnectionIDs, GetCurrentConnectionInfo
|
||||
//! - Support des formats audio (MP3, FLAC, WAV, etc.)
|
||||
//!
|
||||
//! ## Conformité UPnP
|
||||
//!
|
||||
//! Cette implémentation suit la spécification **UPnP ConnectionManager:1 Service Template**.
|
||||
//! Toutes les actions obligatoires (Required) sont implémentées :
|
||||
//!
|
||||
//! - ✅ GetProtocolInfo
|
||||
//! - ✅ GetCurrentConnectionIDs
|
||||
//! - ✅ GetCurrentConnectionInfo
|
||||
//!
|
||||
//! ## Variables d'état
|
||||
//!
|
||||
//! Le service expose les variables d'état conformes à la spécification :
|
||||
//!
|
||||
//! ### Informations de protocole
|
||||
//! - [`SOURCEPROTOCOLINFO`] : Protocoles source supportés (http-get:*:audio/mpeg:*, etc.)
|
||||
//! - [`SINKPROTOCOLINFO`] : Protocoles sink (vide pour un server)
|
||||
//! - [`CURRENTCONNECTIONIDS`] : IDs des connexions actives
|
||||
//!
|
||||
//! ### Arguments
|
||||
//! - [`A_ARG_TYPE_CONNECTIONID`] : ID de connexion
|
||||
//! - [`A_ARG_TYPE_CONNECTIONSTATUS`] : Statut de connexion
|
||||
//! - [`A_ARG_TYPE_DIRECTION`] : Direction (Input/Output)
|
||||
//! - [`A_ARG_TYPE_PROTOCOLINFO`] : Information de protocole
|
||||
//! - [`A_ARG_TYPE_RCSID`] : ID RenderingControl
|
||||
//! - [`A_ARG_TYPE_AVTRANSPORTID`] : ID AVTransport
|
||||
//!
|
||||
//! ## Différences avec MediaRenderer
|
||||
//!
|
||||
//! Pour un MediaServer :
|
||||
//! - **SourceProtocolInfo** : Liste des protocoles que le server peut **fournir** (Output)
|
||||
//! - **SinkProtocolInfo** : Vide (le server ne **consomme** pas de contenu)
|
||||
//!
|
||||
//! Pour un MediaRenderer (inverse) :
|
||||
//! - **SourceProtocolInfo** : Vide (le renderer ne fournit pas de contenu)
|
||||
//! - **SinkProtocolInfo** : Liste des protocoles que le renderer peut **consommer** (Input)
|
||||
//!
|
||||
//! ## Examples
|
||||
//!
|
||||
//! ```rust
|
||||
//! use pmomediaserver::connectionmanager::CONNECTIONMANAGER;
|
||||
//!
|
||||
//! // Accéder au service
|
||||
//! let service = &*CONNECTIONMANAGER;
|
||||
//! println!("Service: {}", service.name());
|
||||
//! println!("Type: {}", service.service_type());
|
||||
//! ```
|
||||
//!
|
||||
//! ## Références
|
||||
//!
|
||||
//! - [UPnP ConnectionManager:1 Service Template](https://upnp.org/specs/av/UPnP-av-ConnectionManager-v1-Service.pdf)
|
||||
//! - [UPnP AV Architecture](https://upnp.org/specs/av/)
|
||||
|
||||
use pmoupnp::define_service;
|
||||
|
||||
pub mod variables;
|
||||
pub mod actions;
|
||||
|
||||
use actions::{GETCURRENTCONNECTIONIDS, GETCURRENTCONNECTIONINFO, GETPROTOCOLINFO};
|
||||
use variables::{
|
||||
A_ARG_TYPE_AVTRANSPORTID, A_ARG_TYPE_CONNECTIONID, A_ARG_TYPE_CONNECTIONSTATUS,
|
||||
A_ARG_TYPE_DIRECTION, A_ARG_TYPE_PROTOCOLINFO, A_ARG_TYPE_RCSID,
|
||||
CURRENTCONNECTIONIDS, SINKPROTOCOLINFO, SOURCEPROTOCOLINFO
|
||||
};
|
||||
|
||||
// Service ConnectionManager:1 conforme à la spécification UPnP AV pour MediaServer
|
||||
// Voir la documentation du module pour plus de détails
|
||||
define_service! {
|
||||
pub static CONNECTIONMANAGER = "ConnectionManager" {
|
||||
variables: [
|
||||
A_ARG_TYPE_AVTRANSPORTID,
|
||||
A_ARG_TYPE_CONNECTIONID,
|
||||
A_ARG_TYPE_CONNECTIONSTATUS,
|
||||
A_ARG_TYPE_DIRECTION,
|
||||
A_ARG_TYPE_PROTOCOLINFO,
|
||||
A_ARG_TYPE_RCSID,
|
||||
CURRENTCONNECTIONIDS,
|
||||
SINKPROTOCOLINFO,
|
||||
SOURCEPROTOCOLINFO,
|
||||
],
|
||||
actions: [
|
||||
GETCURRENTCONNECTIONIDS,
|
||||
GETCURRENTCONNECTIONINFO,
|
||||
GETPROTOCOLINFO,
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
use pmoupnp::define_variable;
|
||||
|
||||
define_variable! {
|
||||
pub static A_ARG_TYPE_AVTRANSPORTID: I4 = "A_ARG_TYPE_AVTransportID" {
|
||||
evented: false,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
use pmoupnp::define_variable;
|
||||
|
||||
define_variable! {
|
||||
pub static A_ARG_TYPE_CONNECTIONID: I4 = "A_ARG_TYPE_ConnectionID" {
|
||||
evented: false,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
use pmoupnp::define_variable;
|
||||
|
||||
define_variable! {
|
||||
pub static A_ARG_TYPE_CONNECTIONSTATUS: String = "A_ARG_TYPE_ConnectionStatus" {
|
||||
allowed: ["OK", "ContentFormatMismatch", "InsufficientBandwidth", "UnreliableChannel", "Unknown"],
|
||||
evented: false,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
use pmoupnp::define_variable;
|
||||
|
||||
define_variable! {
|
||||
pub static A_ARG_TYPE_DIRECTION: String = "A_ARG_TYPE_Direction" {
|
||||
allowed: ["Input", "Output"],
|
||||
evented: false,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
use pmoupnp::define_variable;
|
||||
|
||||
define_variable! {
|
||||
pub static A_ARG_TYPE_PROTOCOLINFO: String = "A_ARG_TYPE_ProtocolInfo" {
|
||||
evented: false,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
use pmoupnp::define_variable;
|
||||
|
||||
define_variable! {
|
||||
pub static A_ARG_TYPE_RCSID: I4 = "A_ARG_TYPE_RcsID" {
|
||||
evented: false,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
use pmoupnp::define_variable;
|
||||
|
||||
define_variable! {
|
||||
pub static CURRENTCONNECTIONIDS: String = "CurrentConnectionIDs" {
|
||||
evented: true,
|
||||
}
|
||||
}
|
||||
19
pmomediaserver/src/connectionmanager/variables/mod.rs
Normal file
19
pmomediaserver/src/connectionmanager/variables/mod.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
mod a_arg_type_connectionid;
|
||||
mod a_arg_type_connectionstatus;
|
||||
mod a_arg_type_direction;
|
||||
mod a_arg_type_protocolinfo;
|
||||
mod a_arg_type_rcsid;
|
||||
mod a_arg_type_avtransportid;
|
||||
mod currentconnectionids;
|
||||
mod sourceprotocolinfo;
|
||||
mod sinkprotocolinfo;
|
||||
|
||||
pub use a_arg_type_connectionid::A_ARG_TYPE_CONNECTIONID;
|
||||
pub use a_arg_type_connectionstatus::A_ARG_TYPE_CONNECTIONSTATUS;
|
||||
pub use a_arg_type_direction::A_ARG_TYPE_DIRECTION;
|
||||
pub use a_arg_type_protocolinfo::A_ARG_TYPE_PROTOCOLINFO;
|
||||
pub use a_arg_type_rcsid::A_ARG_TYPE_RCSID;
|
||||
pub use a_arg_type_avtransportid::A_ARG_TYPE_AVTRANSPORTID;
|
||||
pub use currentconnectionids::CURRENTCONNECTIONIDS;
|
||||
pub use sourceprotocolinfo::SOURCEPROTOCOLINFO;
|
||||
pub use sinkprotocolinfo::SINKPROTOCOLINFO;
|
||||
@@ -0,0 +1,8 @@
|
||||
use pmoupnp::define_variable;
|
||||
|
||||
// Pour un MediaServer, SinkProtocolInfo est vide (le server ne consomme pas de contenu)
|
||||
define_variable! {
|
||||
pub static SINKPROTOCOLINFO: String = "SinkProtocolInfo" {
|
||||
evented: true,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
use pmoupnp::define_variable;
|
||||
|
||||
// Pour un MediaServer, SourceProtocolInfo liste les protocoles qu'il peut servir
|
||||
define_variable! {
|
||||
pub static SOURCEPROTOCOLINFO: String = "SourceProtocolInfo" {
|
||||
evented: true,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user