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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
//! System Registry & Feature Manifest
//!
//! This module serves as the authoritative source of truth for all capabilities,
//! commands, and architectural pathways in the CrabCamera system.
//!
//! # Core Philosophy
//! This registry acts as a compile-time and runtime map of "What Works" vs "What is Planned".
//! If a feature is listed here with status `Implemented`, it MUST work.
//! If a feature is listed as `Stub` or `Planned`, it is explicitly known to be incomplete.
//!
//! This prevents "Ghost Features" (vaporware) by forcing every feature to be registered
//! with its implementation status.
use serde::{Deserialize, Serialize};
/// Status of a system capability
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum FeatureStatus {
/// Fully implemented, tested, and ready for production
Implemented,
/// Implemented but requires more extensive testing
Beta,
/// Placeholder structure exists, but logic is incomplete (e.g. returns mock data)
Stub,
/// Not started, planned for future release
Planned,
/// Deprecated, will be removed
Deprecated,
}
/// Category of system capability
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum FeatureCategory {
/// Core camera operations (Open, Stream, Capture)
Core,
/// Advanced controls (Focus, Exposure, White Balance)
Controls,
/// Processing pipeline (Quality, Filters, Analysis)
Processing,
/// Recording and Encoding
Recording,
/// Integration (Tauri, Events, Permissions)
Integration,
}
/// Metadata for a system feature
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct FeatureManifest {
/// Unique identifier for the feature
pub id: &'static str,
/// Human-readable name
pub name: &'static str,
/// Current implementation status
pub status: FeatureStatus,
/// Feature category
pub category: FeatureCategory,
/// Where the implementation lives (module path)
pub path: &'static str,
/// Description of the feature
pub description: &'static str,
}
/// The Global System Registry
pub struct SystemRegistry;
impl SystemRegistry {
/// Get the complete manifest of system features
#[must_use]
pub fn get_manifest() -> Vec<FeatureManifest> {
let mut features = Self::capture_and_control_features();
features.extend(Self::quality_and_platform_features());
features
}
/// Capture and advanced-control feature descriptors.
fn capture_and_control_features() -> Vec<FeatureManifest> {
vec![
// Core Capture
FeatureManifest {
id: "capture.single",
name: "Single Photo Capture",
status: FeatureStatus::Implemented,
category: FeatureCategory::Core,
path: "src/commands/capture.rs",
description: "Capture a single frame from a camera source",
},
FeatureManifest {
id: "capture.sequence",
name: "Burst Sequence Capture",
status: FeatureStatus::Implemented,
category: FeatureCategory::Core,
path: "src/commands/capture.rs",
description: "Capture multiple frames in rapid succession",
},
FeatureManifest {
id: "capture.preview",
name: "Live Preview Stream",
status: FeatureStatus::Implemented,
category: FeatureCategory::Core,
path: "src/commands/capture.rs",
description: "Continuous frame streaming for UI preview",
},
FeatureManifest {
id: "capture.consolidated",
name: "Consolidated Capture",
status: FeatureStatus::Implemented,
category: FeatureCategory::Core,
path: "src/commands/capture.rs",
description:
"Unified capture command routing to single/sequence/quality-retry modes",
},
// Advanced Controls
FeatureManifest {
id: "controls.focus",
name: "Manual Focus Control",
status: FeatureStatus::Beta,
category: FeatureCategory::Controls,
path: "src/platform/mod.rs",
description: "Manual control of lens focus distance (Platform dependent)",
},
FeatureManifest {
id: "controls.exposure",
name: "Exposure Control",
status: FeatureStatus::Beta,
category: FeatureCategory::Controls,
path: "src/platform/mod.rs",
description: "Manual control of exposure time and ISO",
},
FeatureManifest {
id: "controls.batch",
name: "Batch Camera Settings",
status: FeatureStatus::Implemented,
category: FeatureCategory::Controls,
path: "src/commands/advanced.rs",
description:
"Apply multiple camera settings (focus/exposure/ISO/WB) in a single call",
},
]
}
/// Quality-engine and platform-driver feature descriptors.
fn quality_and_platform_features() -> Vec<FeatureManifest> {
vec![
// Quality Engine
FeatureManifest {
id: "quality.blur",
name: "Blur Analysis",
status: FeatureStatus::Implemented,
category: FeatureCategory::Processing,
path: "src/quality/blur.rs",
description: "Laplacian variance analysis for sharpness detection",
},
FeatureManifest {
id: "quality.exposure",
name: "Exposure Analysis",
status: FeatureStatus::Implemented,
category: FeatureCategory::Processing,
path: "src/quality/exposure.rs",
description: "Histogram analysis for over/under-exposure detection",
},
// Platform Drivers
FeatureManifest {
id: "platform.windows",
name: "Windows MediaFoundation Driver",
status: FeatureStatus::Implemented,
category: FeatureCategory::Core,
path: "src/platform/windows/mod.rs",
description: "Native Windows camera implementation",
},
FeatureManifest {
id: "platform.macos",
name: "MacOS AVFoundation Driver",
status: FeatureStatus::Beta,
category: FeatureCategory::Core,
path: "src/platform/macos.rs",
description: "Native MacOS camera implementation (Basic controls)",
},
FeatureManifest {
id: "platform.linux",
name: "Linux V4L2 Driver",
status: FeatureStatus::Beta,
category: FeatureCategory::Core,
path: "src/platform/linux.rs",
description: "Native Linux V4L2 camera implementation",
},
FeatureManifest {
id: "platform.linux.formats",
name: "Linux V4L2 Format Enumeration",
status: FeatureStatus::Beta,
category: FeatureCategory::Core,
path: "src/platform/linux.rs",
description:
"Real format enumeration via dev.enum_formats() with hardcoded fallback",
},
FeatureManifest {
id: "platform.windows.availability",
name: "Windows Camera Availability Check",
status: FeatureStatus::Beta,
category: FeatureCategory::Core,
path: "src/platform/windows/mod.rs",
description:
"Availability based on is_stream_open(); deeper hardware probe deferred",
},
]
}
/// Verify that all registered features point to valid code paths
/// (This acts as a compile-time check if we link symbols directly)
pub fn verify_linkage() {
// This function doesn't run logic, but referencing symbols ensures they exist
// at compile time. If a function is deleted, this registry will fail to compile.
use crate::commands;
// Linking Core Commands
let _ = commands::capture::capture_single_photo;
let _ = commands::capture::capture_photo_sequence;
let _ = commands::capture::capture;
let _ = commands::capture::start_camera_preview;
let _ = commands::capture::stop_camera_preview;
// Linking Advanced Commands
let _ = commands::advanced::apply_camera_settings;
// Linking Quality
let _ = crate::quality::BlurDetector::new;
let _ = crate::quality::ExposureAnalyzer::new;
// Linking Platform (Generic)
let _ = crate::platform::get_or_create_camera;
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_registry_integrity() {
// Ensure manifest generates without error
let manifest = SystemRegistry::get_manifest();
assert!(!manifest.is_empty());
// Verify linkage (compile-time check wrapped in test)
SystemRegistry::verify_linkage();
}
#[test]
fn test_no_stubs_in_production() {
let manifest = SystemRegistry::get_manifest();
for feature in manifest {
assert_ne!(
feature.status,
FeatureStatus::Stub,
"Feature '{}' is marked as Stub — either implement it or remove it from the manifest",
feature.name
);
}
}
}