A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita
audio
rust
zig
deno
mpris
rockbox
mpd
1use async_graphql::*;
2use serde::{Deserialize, Serialize};
3
4#[derive(Default, Clone, Serialize, Deserialize)]
5pub struct Device {
6 pub id: String,
7 pub name: String,
8 pub host: String,
9 pub ip: String,
10 pub port: u16,
11 pub service: String,
12 pub app: String,
13 pub is_connected: bool,
14 pub base_url: Option<String>,
15 pub is_cast_device: bool,
16 pub is_source_device: bool,
17 pub is_current_device: bool,
18}
19
20#[Object]
21impl Device {
22 async fn id(&self) -> &str {
23 &self.id
24 }
25
26 async fn name(&self) -> &str {
27 &self.name
28 }
29
30 async fn host(&self) -> &str {
31 &self.host
32 }
33
34 async fn ip(&self) -> &str {
35 &self.ip
36 }
37
38 async fn port(&self) -> i32 {
39 self.port as i32
40 }
41
42 async fn service(&self) -> &str {
43 &self.service
44 }
45
46 async fn app(&self) -> &str {
47 &self.app
48 }
49
50 async fn is_connected(&self) -> bool {
51 self.is_connected
52 }
53
54 async fn base_url(&self) -> Option<&str> {
55 self.base_url.as_deref()
56 }
57
58 async fn is_cast_device(&self) -> bool {
59 self.is_cast_device
60 }
61
62 async fn is_source_device(&self) -> bool {
63 self.is_source_device
64 }
65
66 async fn is_current_device(&self) -> bool {
67 self.is_current_device
68 }
69}