settings_media_buttons/
lib.rs1use fidl_fuchsia_ui_input::MediaButtonsEvent;
6
7#[derive(PartialEq, Eq, Copy, Clone, Debug)]
10pub struct MediaButtons {
11 pub mic_mute: Option<bool>,
12 pub camera_disable: Option<bool>,
13}
14
15impl MediaButtons {
16 fn new() -> Self {
17 Self { mic_mute: None, camera_disable: None }
18 }
19
20 pub fn set_mic_mute(&mut self, mic_mute: Option<bool>) {
21 self.mic_mute = mic_mute;
22 }
23
24 pub fn set_camera_disable(&mut self, camera_disable: Option<bool>) {
25 self.camera_disable = camera_disable;
26 }
27}
28
29impl From<MediaButtonsEvent> for MediaButtons {
30 fn from(event: MediaButtonsEvent) -> Self {
31 let mut buttons = MediaButtons::new();
32
33 if let Some(mic_mute) = event.mic_mute {
34 buttons.set_mic_mute(Some(mic_mute));
35 }
36 if let Some(camera_disable) = event.camera_disable {
37 buttons.set_camera_disable(Some(camera_disable));
38 }
39
40 buttons
41 }
42}
43
44#[derive(PartialEq, Clone, Debug)]
45pub enum Event {
46 OnButton(MediaButtons),
47}
48
49impl From<MediaButtons> for Event {
50 fn from(button_types: MediaButtons) -> Self {
51 Self::OnButton(button_types)
52 }
53}