(&self)
| 123 | } |
| 124 | |
| 125 | fn export_state(&self) -> Result<serde_json::Value> { |
| 126 | use serde_json::json; |
| 127 | |
| 128 | // 使用我们定义的常量 |
| 129 | let exp = self.dev.control(CID_EXPOSURE_ABSOLUTE).ok(); |
| 130 | let gain = self.dev.control(CID_GAIN).ok(); |
| 131 | |
| 132 | Ok(json!({ |
| 133 | "backend": "v4l2", |
| 134 | // 这里的 Value 实现了 Debug,可以直接 format! |
| 135 | "exposure": exp.map(|v| format!("{:?}", v.value)), |
| 136 | "gain": gain.map(|v| format!("{:?}", v.value)), |
| 137 | })) |
| 138 | } |
| 139 | } |
nothing calls this directly
no outgoing calls
no test coverage detected