Skip to main content

Crate qonductor

Crate qonductor 

Source
Expand description

§Qonductor

Rust implementation of the Qobuz Connect protocol.

§Quick Start

use qonductor::{SessionManager, DeviceConfig, SessionEvent, Command, Notification, msg};

#[tokio::main]
async fn main() -> qonductor::Result<()> {
    let mut manager = SessionManager::start(7864).await?;
    let mut session = manager.add_device(DeviceConfig::new("Living Room", "your_app_id")).await?;

    tokio::spawn(async move { manager.run().await });

    while let Some(event) = session.recv().await {
        match event {
            SessionEvent::Command(cmd) => match cmd {
                Command::SetState { cmd, respond } => {
                    respond.send(msg::QueueRendererState { /* ... */ });
                }
                Command::SetActive { respond, .. } => {
                    respond.send(ActivationState { /* ... */ });
                }
                Command::Heartbeat { respond } => {
                    respond.send(None);
                }
            },
            SessionEvent::Notification(n) => match n {
                Notification::Connected => println!("Connected!"),
                _ => {}
            },
        }
    }
    Ok(())
}

Re-exports§

pub use manager::SessionManager;
pub use event::ActivationState;
pub use event::Command;
pub use event::Notification;
pub use event::Responder;
pub use event::SessionEvent;
pub use session::DeviceSession;
pub use session::SessionCommand;
pub use proto::qconnect::BufferState;
pub use proto::qconnect::DeviceType;
pub use proto::qconnect::LoopMode;
pub use proto::qconnect::PlayingState;
pub use config::AudioQuality;
pub use config::DeviceConfig;
pub use error::Error;
pub use types::*;

Modules§

config
Configuration types for Qonductor devices.
credentials
Qobuz app credentials scraping.
error
Error types for qonductor.
event
Session event types for Qobuz Connect.
manager
High-level session management for Qobuz Connect.
msg
Re-exports of protobuf types with friendlier names.
proto
Generated protobuf types.
session
Device session handle for bidirectional communication.
types
Core data types for qonductor.

Traits§

DeviceTypeExt
Extension trait to get mDNS string representation for DeviceType.

Functions§

format_qconnect_message
Format a QConnectMessage for debug logging, showing only the populated field.

Type Aliases§

Result
Result type for qonductor operations.