1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// use crate::hardware::{CameraSettings, CameraError};
// use image::RgbaImage;
// use std::sync::{Arc, Mutex};
//mod custom;
//use custom::CustomCamera;
pub use StandardOsCamera as OsCamera;
// #[derive(Clone, Debug)]
// pub enum OsCamera {
// Standard(StandardOsCamera),
// //Custom(CustomCamera)
// }
// impl OsCamera {
// pub fn new() -> Self {StandardOsCamera::new()
// .map(OsCamera::Standard)
// .map_err(|_| CameraError::FailedToGetFrame)
// }
// pub fn existing() -> Option<Self> {
// StandardOsCamera::existing().map(OsCamera::Standard)
// }
// pub fn new_custom() -> Result<Self, CameraError> {
// Ok(OsCamera::Custom(CustomCamera::new()))
// }
// pub fn frame(&self) -> Result<RgbaImage, CameraError> {
// match self {
// OsCamera::Standard(c) => c.frame().ok_or(CameraError::FailedToGetFrame),
// OsCamera::Custom(c) => c.frame().ok_or(CameraError::FailedToGetFrame)
// }
// }
// //pub fn toggle_flashlight(&self) {
// // // let _ = match self {
// // // OsCamera::Standard(_) => {},
// // // OsCamera::Custom(c) => c.toggle_flashlight()
// // // };
// //}
// pub fn settings(&self) -> Option<Arc<Mutex<CameraSettings>>> {
// match self {
// OsCamera::Standard(_) => None,
// OsCamera::Custom(c) => Some(c.settings())
// }
// }
// pub fn stop(self) {
// match self {
// OsCamera::Standard(s) => s.stop(),
// OsCamera::Custom(c) => c.stop()
// }
// }
// }