1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
//! Internal implementation detail of [`sonos-sdk`](https://crates.io/crates/sonos-sdk). Not intended for direct use.
//!
//! Sonos State Management
//!
//! A sync-first state management system for Sonos devices.
//!
//! # Features
//!
//! - **Sync API**: All operations are synchronous - no async/await required
//! - **Type-safe State**: Strongly typed properties with automatic change detection
//! - **Change Events**: Blocking iterator over property changes
//! - **Watch Pattern**: Register for property changes, iterate to receive them
//!
//! # Quick Start
//!
//! ```rust,ignore
//! use sonos_state::{StateManager, Volume, SpeakerId};
//! use sonos_discovery;
//!
//! // Create state manager (sync - no .await!)
//! let manager = StateManager::new()?;
//!
//! // Add discovered devices
//! let devices = sonos_discovery::get();
//! manager.add_devices(devices)?;
//!
//! // Get current property value
//! let speaker_id = SpeakerId::new("RINCON_123");
//! if let Some(vol) = manager.get_property::<Volume>(&speaker_id) {
//! println!("Current volume: {}%", vol.0);
//! }
//!
//! // Watch for changes
//! manager.register_watch(&speaker_id, "volume");
//!
//! // Blocking iteration over changes
//! for event in manager.iter() {
//! println!("{} changed on {}", event.property_key, event.speaker_id);
//! if let Some(vol) = manager.get_property::<Volume>(&event.speaker_id) {
//! println!("New volume: {}%", vol.0);
//! }
//! }
//! ```
//!
//! # Non-blocking Iteration
//!
//! ```rust,ignore
//! // Check for events without blocking
//! for event in manager.iter().try_iter() {
//! println!("Event: {:?}", event);
//! }
//!
//! // Wait with timeout
//! if let Some(event) = manager.iter().recv_timeout(Duration::from_secs(1)) {
//! println!("Got event: {:?}", event);
//! }
//! ```
// Core modules
// Event decoding
// Event processing
pub
// Sync-first API
// Error types
// ============================================================================
// Re-exports - Main API
// ============================================================================
// State manager
pub use ;
// Change iterator
pub use ChangeIterator;
// Properties
pub use ;
// Model types
pub use ;
// Event decoder
pub use ;
// Error types
pub use ;
// ============================================================================
// Prelude
// ============================================================================
/// Commonly used types for convenient importing