updated to use new json format

This commit is contained in:
Nickiel12 2021-12-20 15:23:53 -08:00
parent dd11b732e4
commit 607cc0a2fe

View file

@ -29,9 +29,30 @@ impl StateUpdate {
let value = &incoming_json["update"];
match value.as_str().unwrap() {
//Master Scenes
"Scene" => {
let scene = incoming_json["data"].as_str().unwrap();
match scene {
"Scene_Camera" => {StateUpdate::Scene(Scenes::Camera)}
"Scene_Screen" => {StateUpdate::Scene(Scenes::Screen)}
"Scene_Is_Augmented" => {StateUpdate::SceneIsAugmented(incoming_json["data"].as_bool().unwrap())},
_ => {panic!("unknown Scene! {}", scene)}
}
}
//SubScenes
"SubScene" => {
let subscene = incoming_json["data"].as_str().unwrap();
match subscene {
"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)},
_ => {panic!("unkown SubScene! {}", subscene)}
}
}
//Slide changing behavior
"Timer_Can_Run" => {StateUpdate::TimerCanRun(incoming_json["data"].as_bool().unwrap())}
@ -46,14 +67,6 @@ impl StateUpdate {
"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)},
"all" => {StateUpdate::UpdateClient},