//! # D-Bus interface proxy for: `org.mpris.MediaPlayer2.Player` //! //! This code was generated by `zbus-xmlgen` `4.1.0` from D-Bus introspection data. //! Source: `Interface '/org/mpris/MediaPlayer2' from service 'org.mpris.MediaPlayer2.playerctld' on system bus`. //! //! You may prefer to adapt it, instead of using it verbatim. //! //! More information can be found in the [Writing a client proxy] section of the zbus //! documentation. //! //! This type implements the [D-Bus standard interfaces], (`org.freedesktop.DBus.*`) for which the //! following zbus API can be used: //! //! * [`zbus::fdo::PropertiesProxy`] //! * [`zbus::fdo::IntrospectableProxy`] //! * [`zbus::fdo::PeerProxy`] //! //! Consequently `zbus-xmlgen` did not generate code for the above interfaces. //! //! [Writing a client proxy]: https://dbus2.github.io/zbus/client.html //! [D-Bus standard interfaces]: https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces, use zbus::{ proxy, zvariant::{OwnedValue, Type}, }; #[derive(Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Type)] pub enum PlaybackStatus { Playing, Paused, #[default] Stopped, } impl TryFrom for PlaybackStatus { type Error = zbus::Error; fn try_from(value: OwnedValue) -> Result { match value.downcast_ref()? { "Playing" => Ok(Self::Playing), "Paused" => Ok(Self::Paused), "Stopped" => Ok(Self::Stopped), _ => Err(zbus::Error::InvalidField), } } } #[proxy( interface = "org.mpris.MediaPlayer2.Player", default_service = "org.mpris.MediaPlayer2.playerctld", default_path = "/org/mpris/MediaPlayer2" )] trait Player { /// Next method fn next(&self) -> zbus::Result<()>; /// OpenUri method fn open_uri(&self, uri: &str) -> zbus::Result<()>; /// Pause method fn pause(&self) -> zbus::Result<()>; /// Play method fn play(&self) -> zbus::Result<()>; /// PlayPause method fn play_pause(&self) -> zbus::Result<()>; /// Previous method fn previous(&self) -> zbus::Result<()>; /// Seek method fn seek(&self, offset: i64) -> zbus::Result<()>; /// SetPosition method fn set_position( &self, track_id: &zbus::zvariant::ObjectPath<'_>, offset: i64, ) -> zbus::Result<()>; /// Stop method fn stop(&self) -> zbus::Result<()>; /// Seeked signal #[zbus(signal)] fn seeked(&self, position: i64) -> zbus::Result<()>; /// CanControl property #[zbus(property)] fn can_control(&self) -> zbus::Result; /// CanGoNext property #[zbus(property)] fn can_go_next(&self) -> zbus::Result; /// CanGoPrevious property #[zbus(property)] fn can_go_previous(&self) -> zbus::Result; /// CanPause property #[zbus(property)] fn can_pause(&self) -> zbus::Result; /// CanPlay property #[zbus(property)] fn can_play(&self) -> zbus::Result; /// CanSeek property #[zbus(property)] fn can_seek(&self) -> zbus::Result; /// LoopStatus property #[zbus(property)] fn loop_status(&self) -> zbus::Result; #[zbus(property)] fn set_loop_status(&self, value: &str) -> zbus::Result<()>; /// MaximumRate property #[zbus(property)] fn maximum_rate(&self) -> zbus::Result; /// Metadata property #[zbus(property)] fn metadata( &self, ) -> zbus::Result>; /// MinimumRate property #[zbus(property)] fn minimum_rate(&self) -> zbus::Result; /// PlaybackStatus property #[zbus(property)] fn playback_status(&self) -> zbus::Result; /// Position property #[zbus(property)] fn position(&self) -> zbus::Result; /// Rate property #[zbus(property)] fn rate(&self) -> zbus::Result; #[zbus(property)] fn set_rate(&self, value: f64) -> zbus::Result<()>; /// Shuffle property #[zbus(property)] fn shuffle(&self) -> zbus::Result; #[zbus(property)] fn set_shuffle(&self, value: bool) -> zbus::Result<()>; /// Volume property #[zbus(property)] fn volume(&self) -> zbus::Result; #[zbus(property)] fn set_volume(&self, value: f64) -> zbus::Result<()>; }