filled out match arms for incoming buttons

This commit is contained in:
Nickiel12 2021-12-18 23:33:24 -08:00
parent 2cee2afdb2
commit fa315fa9a3

View file

@ -7,6 +7,7 @@ pub enum StateUpdate {
StreamRunning(bool), StreamRunning(bool),
StreamIsMuted(bool), StreamIsMuted(bool),
ComputerSoundIsOn(bool), ComputerSoundIsOn(bool),
ComputerMediaDoPause(bool),
ChangeSceneOnChangeSlideHotkey(bool), ChangeSceneOnChangeSlideHotkey(bool),
SceneIsAugmented(bool), SceneIsAugmented(bool),
TimerCanRun(bool), TimerCanRun(bool),
@ -25,8 +26,32 @@ impl StateUpdate {
"button" => { "button" => {
let value = &incoming_json["button"]; let value = &incoming_json["button"];
match value.as_str().unwrap() { match value.as_str().unwrap() {
//Master Scenes
"Scene_Camera" => {StateUpdate::Scene(Scenes::Camera)} "Scene_Camera" => {StateUpdate::Scene(Scenes::Camera)}
"Scene_Screen" => {StateUpdate::Scene(Scenes::Screen)}
"Augmented" => {StateUpdate::SceneIsAugmented(incoming_json["data"].as_bool().unwrap())},
//Slide changing behavior
"Auto_Change_To_Camera" => {StateUpdate::TimerCanRun(incoming_json["data"].as_bool().unwrap())}
"Change_With_Clicker" => {StateUpdate::ChangeSceneOnChangeSlideHotkey(incoming_json["data"].as_bool().unwrap())},
//Extra Toggles
"Toggle_Computer_Volume" => {StateUpdate::ComputerSoundIsOn(incoming_json["data"].as_bool().unwrap())},
"Toggle_Stream_Volume" => {StateUpdate::StreamIsMuted(incoming_json["data"].as_bool().unwrap())},
"Media_Pause_Play" => {StateUpdate::ComputerMediaDoPause(incoming_json["data"].as_bool().unwrap())},
//SubScenes
"Camera_None" => {StateUpdate::SubScene(SubScenes::CameraDefault)},
"Camera_Top_Right" => {StateUpdate::SubScene(SubScenes::CameraWithUpperRight)},
"Camera_Bottom_Right" => {StateUpdate::SubScene(SubScenes::CameraWithLowerRight)},
"Camera_Bottom_Left" => {StateUpdate::SubScene(SubScenes::CameraWithLargeUpperRight)},
"Screen_None" => {StateUpdate::SubScene(SubScenes::ScreenDefault)},
"Screen_Top_Right" => {StateUpdate::SubScene(SubScenes::ScreenWithUpperRight)},
"Screen_Bottom_Right" => {StateUpdate::SubScene(SubScenes::ScreenWithLowerRight)},
//Unimplemented
"Next_Slide" |
"Prev_Slide" |
_ => {panic!("trying to use a button type I don't know!")} _ => {panic!("trying to use a button type I don't know!")}
} }
}, },