Skip to main content

UPnPOperation

Trait UPnPOperation 

Source
pub trait UPnPOperation {
    type Request: Serialize + Validate;
    type Response: for<'de> Deserialize<'de>;

    const SERVICE: Service;
    const ACTION: &'static str;

    // Required methods
    fn build_payload(request: &Self::Request) -> Result<String, ValidationError>;
    fn parse_response(xml: &Element) -> Result<Self::Response, ApiError>;

    // Provided methods
    fn dependencies() -> &'static [&'static str] { ... }
    fn can_batch_with<T: UPnPOperation>() -> bool { ... }
    fn metadata() -> OperationMetadata { ... }
}
Expand description

Enhanced UPnP operation trait with composability support

This trait extends the original SonosOperation concept with:

  • Composability: operations can be chained, batched, or made conditional
  • Validation: flexible validation strategy with boundary and comprehensive levels
  • Dependencies: operations can declare dependencies on other operations
  • Batching: operations can indicate whether they can be batched with others

Required Associated Constants§

Source

const SERVICE: Service

The UPnP service this operation belongs to

Source

const ACTION: &'static str

The SOAP action name for this operation

Required Associated Types§

Source

type Request: Serialize + Validate

The request type for this operation, must be serializable and validatable

Source

type Response: for<'de> Deserialize<'de>

The response type for this operation, must be deserializable

Required Methods§

Source

fn build_payload(request: &Self::Request) -> Result<String, ValidationError>

Build the SOAP payload from the request data with validation

This method validates the request according to the validation level and then constructs the XML payload for the SOAP envelope.

§Arguments
  • request - The typed request data
§Returns

A string containing the XML payload or a validation error

Source

fn parse_response(xml: &Element) -> Result<Self::Response, ApiError>

Parse the SOAP response XML into the typed response

This method extracts the relevant data from the SOAP response XML and converts it into the strongly-typed response structure.

§Arguments
  • xml - The parsed XML element containing the response data
§Returns

The typed response data or an error if parsing fails

Provided Methods§

Source

fn dependencies() -> &'static [&'static str]

Get the list of operations this operation depends on

This is used for operation ordering and dependency resolution in batch and sequence operations.

§Returns

A slice of action names that must be executed before this operation

Source

fn can_batch_with<T: UPnPOperation>() -> bool

Check if this operation can be batched with another operation

Some operations may have conflicts or dependencies that prevent them from being executed in parallel.

§Type Parameters
  • T - Another UPnP operation type to check compatibility with
§Returns

True if the operations can be safely executed in parallel

Source

fn metadata() -> OperationMetadata

Get human-readable operation metadata

This is useful for debugging, logging, and SDK development

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl UPnPOperation for AddURIToQueueOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "AddURIToQueue"

Source§

type Request = AddURIToQueueOperationRequest

Source§

type Response = AddURIToQueueResponse

Source§

impl UPnPOperation for BackupQueueOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "BackupQueue"

Source§

type Request = BackupQueueOperationRequest

Source§

type Response = ()

Source§

impl UPnPOperation for BecomeCoordinatorOfStandaloneGroupOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "BecomeCoordinatorOfStandaloneGroup"

Source§

type Request = BecomeCoordinatorOfStandaloneGroupOperationRequest

Source§

type Response = BecomeCoordinatorOfStandaloneGroupResponse

Source§

impl UPnPOperation for ConfigureSleepTimerOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "ConfigureSleepTimer"

Source§

type Request = ConfigureSleepTimerOperationRequest

Source§

type Response = ()

Source§

impl UPnPOperation for CreateSavedQueueOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "CreateSavedQueue"

Source§

type Request = CreateSavedQueueOperationRequest

Source§

type Response = CreateSavedQueueResponse

Source§

impl UPnPOperation for DelegateGroupCoordinationToOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "DelegateGroupCoordinationTo"

Source§

type Request = DelegateGroupCoordinationToOperationRequest

Source§

type Response = ()

Source§

impl UPnPOperation for GetCrossfadeModeOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "GetCrossfadeMode"

Source§

type Request = GetCrossfadeModeOperationRequest

Source§

type Response = GetCrossfadeModeResponse

Source§

impl UPnPOperation for GetCurrentTransportActionsOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "GetCurrentTransportActions"

Source§

type Request = GetCurrentTransportActionsOperationRequest

Source§

type Response = GetCurrentTransportActionsResponse

Source§

impl UPnPOperation for GetDeviceCapabilitiesOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "GetDeviceCapabilities"

Source§

type Request = GetDeviceCapabilitiesOperationRequest

Source§

type Response = GetDeviceCapabilitiesResponse

Source§

impl UPnPOperation for GetMediaInfoOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "GetMediaInfo"

Source§

type Request = GetMediaInfoOperationRequest

Source§

type Response = GetMediaInfoResponse

Source§

impl UPnPOperation for GetPositionInfoOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "GetPositionInfo"

Source§

type Request = GetPositionInfoOperationRequest

Source§

type Response = GetPositionInfoResponse

Source§

impl UPnPOperation for GetRemainingSleepTimerDurationOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "GetRemainingSleepTimerDuration"

Source§

type Request = GetRemainingSleepTimerDurationOperationRequest

Source§

type Response = GetRemainingSleepTimerDurationResponse

Source§

impl UPnPOperation for GetRunningAlarmPropertiesOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "GetRunningAlarmProperties"

Source§

type Request = GetRunningAlarmPropertiesOperationRequest

Source§

type Response = GetRunningAlarmPropertiesResponse

Source§

impl UPnPOperation for GetTransportInfoOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "GetTransportInfo"

Source§

type Request = GetTransportInfoOperationRequest

Source§

type Response = GetTransportInfoResponse

Source§

impl UPnPOperation for GetTransportSettingsOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "GetTransportSettings"

Source§

type Request = GetTransportSettingsOperationRequest

Source§

type Response = GetTransportSettingsResponse

Source§

impl UPnPOperation for NextOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "Next"

Source§

type Request = NextOperationRequest

Source§

type Response = ()

Source§

impl UPnPOperation for PauseOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "Pause"

Source§

type Request = PauseOperationRequest

Source§

type Response = ()

Source§

impl UPnPOperation for PlayOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "Play"

Source§

type Request = PlayOperationRequest

Source§

type Response = ()

Source§

impl UPnPOperation for PreviousOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "Previous"

Source§

type Request = PreviousOperationRequest

Source§

type Response = ()

Source§

impl UPnPOperation for RemoveAllTracksFromQueueOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "RemoveAllTracksFromQueue"

Source§

type Request = RemoveAllTracksFromQueueOperationRequest

Source§

type Response = ()

Source§

impl UPnPOperation for RemoveTrackFromQueueOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "RemoveTrackFromQueue"

Source§

type Request = RemoveTrackFromQueueOperationRequest

Source§

type Response = ()

Source§

impl UPnPOperation for RemoveTrackRangeFromQueueOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "RemoveTrackRangeFromQueue"

Source§

type Request = RemoveTrackRangeFromQueueOperationRequest

Source§

type Response = RemoveTrackRangeFromQueueResponse

Source§

impl UPnPOperation for SaveQueueOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "SaveQueue"

Source§

type Request = SaveQueueOperationRequest

Source§

type Response = SaveQueueResponse

Source§

impl UPnPOperation for SeekOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "Seek"

Source§

type Request = SeekOperationRequest

Source§

type Response = ()

Source§

impl UPnPOperation for SetAVTransportURIOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "SetAVTransportURI"

Source§

type Request = SetAVTransportURIOperationRequest

Source§

type Response = ()

Source§

impl UPnPOperation for SetCrossfadeModeOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "SetCrossfadeMode"

Source§

type Request = SetCrossfadeModeOperationRequest

Source§

type Response = ()

Source§

impl UPnPOperation for SetNextAVTransportURIOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "SetNextAVTransportURI"

Source§

type Request = SetNextAVTransportURIOperationRequest

Source§

type Response = ()

Source§

impl UPnPOperation for SetPlayModeOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "SetPlayMode"

Source§

type Request = SetPlayModeOperationRequest

Source§

type Response = ()

Source§

impl UPnPOperation for SnoozeAlarmOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "SnoozeAlarm"

Source§

type Request = SnoozeAlarmOperationRequest

Source§

type Response = ()

Source§

impl UPnPOperation for StopOperation

Source§

const SERVICE: Service = crate::service::Service::AVTransport

Source§

const ACTION: &'static str = "Stop"

Source§

type Request = StopOperationRequest

Source§

type Response = ()

Source§

impl UPnPOperation for AddMemberOperation

Source§

const SERVICE: Service = crate::service::Service::GroupManagement

Source§

const ACTION: &'static str = "AddMember"

Source§

type Request = AddMemberOperationRequest

Source§

type Response = AddMemberResponse

Source§

impl UPnPOperation for RemoveMemberOperation

Source§

const SERVICE: Service = crate::service::Service::GroupManagement

Source§

const ACTION: &'static str = "RemoveMember"

Source§

type Request = RemoveMemberOperationRequest

Source§

type Response = ()

Source§

impl UPnPOperation for ReportTrackBufferingResultOperation

Source§

const SERVICE: Service = crate::service::Service::GroupManagement

Source§

const ACTION: &'static str = "ReportTrackBufferingResult"

Source§

type Request = ReportTrackBufferingResultOperationRequest

Source§

type Response = ()

Source§

impl UPnPOperation for SetSourceAreaIdsOperation

Source§

const SERVICE: Service = crate::service::Service::GroupManagement

Source§

const ACTION: &'static str = "SetSourceAreaIds"

Source§

type Request = SetSourceAreaIdsOperationRequest

Source§

type Response = ()

Source§

impl UPnPOperation for GetGroupMuteOperation

Source§

const SERVICE: Service = crate::service::Service::GroupRenderingControl

Source§

const ACTION: &'static str = "GetGroupMute"

Source§

type Request = GetGroupMuteOperationRequest

Source§

type Response = GetGroupMuteResponse

Source§

impl UPnPOperation for GetGroupVolumeOperation

Source§

const SERVICE: Service = crate::service::Service::GroupRenderingControl

Source§

const ACTION: &'static str = "GetGroupVolume"

Source§

type Request = GetGroupVolumeOperationRequest

Source§

type Response = GetGroupVolumeResponse

Source§

impl UPnPOperation for SetGroupMuteOperation

Source§

const SERVICE: Service = crate::service::Service::GroupRenderingControl

Source§

const ACTION: &'static str = "SetGroupMute"

Source§

type Request = SetGroupMuteOperationRequest

Source§

type Response = ()

Source§

impl UPnPOperation for SetGroupVolumeOperation

Source§

const SERVICE: Service = crate::service::Service::GroupRenderingControl

Source§

const ACTION: &'static str = "SetGroupVolume"

Source§

type Request = SetGroupVolumeOperationRequest

Source§

type Response = ()

Source§

impl UPnPOperation for SetRelativeGroupVolumeOperation

Source§

const SERVICE: Service = crate::service::Service::GroupRenderingControl

Source§

const ACTION: &'static str = "SetRelativeGroupVolume"

Source§

type Request = SetRelativeGroupVolumeOperationRequest

Source§

type Response = SetRelativeGroupVolumeResponse

Source§

impl UPnPOperation for SnapshotGroupVolumeOperation

Source§

const SERVICE: Service = crate::service::Service::GroupRenderingControl

Source§

const ACTION: &'static str = "SnapshotGroupVolume"

Source§

type Request = SnapshotGroupVolumeOperationRequest

Source§

type Response = ()

Source§

impl UPnPOperation for GetBassOperation

Source§

const SERVICE: Service = crate::service::Service::RenderingControl

Source§

const ACTION: &'static str = "GetBass"

Source§

type Request = GetBassOperationRequest

Source§

type Response = GetBassResponse

Source§

impl UPnPOperation for GetLoudnessOperation

Source§

const SERVICE: Service = crate::service::Service::RenderingControl

Source§

const ACTION: &'static str = "GetLoudness"

Source§

type Request = GetLoudnessOperationRequest

Source§

type Response = GetLoudnessResponse

Source§

impl UPnPOperation for GetMuteOperation

Source§

const SERVICE: Service = crate::service::Service::RenderingControl

Source§

const ACTION: &'static str = "GetMute"

Source§

type Request = GetMuteOperationRequest

Source§

type Response = GetMuteResponse

Source§

impl UPnPOperation for GetTrebleOperation

Source§

const SERVICE: Service = crate::service::Service::RenderingControl

Source§

const ACTION: &'static str = "GetTreble"

Source§

type Request = GetTrebleOperationRequest

Source§

type Response = GetTrebleResponse

Source§

impl UPnPOperation for GetVolumeOperation

Source§

const SERVICE: Service = crate::service::Service::RenderingControl

Source§

const ACTION: &'static str = "GetVolume"

Source§

type Request = GetVolumeOperationRequest

Source§

type Response = GetVolumeResponse

Source§

impl UPnPOperation for SetBassOperation

Source§

const SERVICE: Service = crate::service::Service::RenderingControl

Source§

const ACTION: &'static str = "SetBass"

Source§

type Request = SetBassOperationRequest

Source§

type Response = ()

Source§

impl UPnPOperation for SetLoudnessOperation

Source§

const SERVICE: Service = crate::service::Service::RenderingControl

Source§

const ACTION: &'static str = "SetLoudness"

Source§

type Request = SetLoudnessOperationRequest

Source§

type Response = ()

Source§

impl UPnPOperation for SetMuteOperation

Source§

const SERVICE: Service = crate::service::Service::RenderingControl

Source§

const ACTION: &'static str = "SetMute"

Source§

type Request = SetMuteOperationRequest

Source§

type Response = ()

Source§

impl UPnPOperation for SetRelativeVolumeOperation

Source§

const SERVICE: Service = crate::service::Service::RenderingControl

Source§

const ACTION: &'static str = "SetRelativeVolume"

Source§

type Request = SetRelativeVolumeOperationRequest

Source§

type Response = SetRelativeVolumeResponse

Source§

impl UPnPOperation for SetTrebleOperation

Source§

const SERVICE: Service = crate::service::Service::RenderingControl

Source§

const ACTION: &'static str = "SetTreble"

Source§

type Request = SetTrebleOperationRequest

Source§

type Response = ()

Source§

impl UPnPOperation for SetVolumeOperation

Source§

const SERVICE: Service = crate::service::Service::RenderingControl

Source§

const ACTION: &'static str = "SetVolume"

Source§

type Request = SetVolumeOperationRequest

Source§

type Response = ()

Source§

impl UPnPOperation for GetZoneGroupStateOperation

Source§

const SERVICE: Service = crate::service::Service::ZoneGroupTopology

Source§

const ACTION: &'static str = "GetZoneGroupState"

Source§

type Request = GetZoneGroupStateOperationRequest

Source§

type Response = GetZoneGroupStateResponse