(
Path(udid): Path<String>,
Json(payload): Json<CameraSwitchRequest>,
)
| 2630 | } |
| 2631 | |
| 2632 | async fn switch_camera_source( |
| 2633 | Path(udid): Path<String>, |
| 2634 | Json(payload): Json<CameraSwitchRequest>, |
| 2635 | ) -> Result<Json<Value>, AppError> { |
| 2636 | if android::is_android_id(&udid) { |
| 2637 | return Err(AppError::bad_request( |
| 2638 | "Camera simulation is only supported for iOS simulators.", |
| 2639 | )); |
| 2640 | } |
| 2641 | let status = |
| 2642 | task::spawn_blocking(move || camera::switch_camera(&udid, payload.source, payload.mirror)) |
| 2643 | .await |
| 2644 | .map_err(|error| AppError::internal(format!("Camera task failed. {error}")))??; |
| 2645 | Ok(json(status)) |
| 2646 | } |
| 2647 | |
| 2648 | async fn stop_camera(Path(udid): Path<String>) -> Result<Json<Value>, AppError> { |
| 2649 | if android::is_android_id(&udid) { |
nothing calls this directly
no test coverage detected