mirror of
https://github.com/librespot-org/librespot.git
synced 2024-11-08 16:45:43 +00:00
Add functions for sending commands to other clients.
This commit is contained in:
parent
677173d01b
commit
08cb429a0c
1 changed files with 32 additions and 0 deletions
32
src/spirc.rs
32
src/spirc.rs
|
@ -113,6 +113,38 @@ impl SpircManager {
|
|||
pub fn devices(&self) -> HashMap<String, String> {
|
||||
self.0.lock().unwrap().devices.clone()
|
||||
}
|
||||
|
||||
pub fn send_play(&mut self, recipient: &str) {
|
||||
let mut internal = self.0.lock().unwrap();
|
||||
send_cmd(&mut *internal,
|
||||
protocol::spirc::MessageType::kMessageTypePlay,
|
||||
Some(recipient),
|
||||
None);
|
||||
}
|
||||
|
||||
pub fn send_pause(&mut self, recipient: &str) {
|
||||
let mut internal = self.0.lock().unwrap();
|
||||
send_cmd(&mut *internal,
|
||||
protocol::spirc::MessageType::kMessageTypePause,
|
||||
Some(recipient),
|
||||
None);
|
||||
}
|
||||
|
||||
pub fn send_prev(&mut self, recipient: &str) {
|
||||
let mut internal = self.0.lock().unwrap();
|
||||
send_cmd(&mut *internal,
|
||||
protocol::spirc::MessageType::kMessageTypePrev,
|
||||
Some(recipient),
|
||||
None);
|
||||
}
|
||||
|
||||
pub fn send_next(&mut self, recipient: &str) {
|
||||
let mut internal = self.0.lock().unwrap();
|
||||
send_cmd(&mut *internal,
|
||||
protocol::spirc::MessageType::kMessageTypeNext,
|
||||
Some(recipient),
|
||||
None);
|
||||
}
|
||||
}
|
||||
|
||||
impl SpircInternal {
|
||||
|
|
Loading…
Reference in a new issue