11use log:: warn;
22use serde:: { Deserialize , Serialize } ;
3+ use serde_repr:: { Deserialize_repr , Serialize_repr } ;
34
45use rayhunter:: Device ;
56use rayhunter:: analysis:: analyzer:: AnalyzerConfig ;
67
78use crate :: error:: RayhunterError ;
9+
10+ #[ repr( u8 ) ]
11+ #[ derive( Debug , Clone , Copy , PartialEq , Serialize_repr , Deserialize_repr ) ]
12+ #[ cfg_attr( feature = "apidocs" , derive( utoipa:: ToSchema ) ) ]
13+ pub enum GpsMode {
14+ Disabled = 0 ,
15+ Fixed = 1 ,
16+ Api = 2 ,
17+ }
18+
19+ #[ repr( u8 ) ]
20+ #[ derive( Debug , Clone , Copy , PartialEq , Serialize_repr , Deserialize_repr ) ]
21+ #[ cfg_attr( feature = "apidocs" , derive( utoipa:: ToSchema ) ) ]
22+ pub enum UiLevel {
23+ Invisible = 0 ,
24+ Subtle = 1 ,
25+ Demo = 2 ,
26+ EffLogo = 3 ,
27+ HighVisibility = 4 ,
28+ TransFlag = 128 ,
29+ }
30+
31+ #[ repr( u8 ) ]
32+ #[ derive( Debug , Clone , Copy , PartialEq , Serialize_repr , Deserialize_repr ) ]
33+ #[ cfg_attr( feature = "apidocs" , derive( utoipa:: ToSchema ) ) ]
34+ pub enum KeyInputMode {
35+ Disabled = 0 ,
36+ DoubleTapPower = 1 ,
37+ }
838use crate :: notifications:: NotificationType ;
939
1040/// The structure of a valid rayhunter configuration
@@ -21,11 +51,11 @@ pub struct Config {
2151 /// Internal device name
2252 pub device : Device ,
2353 /// UI level
24- pub ui_level : u8 ,
54+ pub ui_level : UiLevel ,
2555 /// Colorblind mode
2656 pub colorblind_mode : bool ,
2757 /// Key input mode
28- pub key_input_mode : u8 ,
58+ pub key_input_mode : KeyInputMode ,
2959 /// ntfy.sh URL
3060 pub ntfy_url : Option < String > ,
3161 /// Vector containing the types of enabled notifications
@@ -34,8 +64,8 @@ pub struct Config {
3464 pub analyzers : AnalyzerConfig ,
3565 pub min_space_to_start_recording_mb : u64 ,
3666 pub min_space_to_continue_recording_mb : u64 ,
37- /// GPS mode: 0=Disabled, 1=Fixed coordinates, 2=API endpoint
38- pub gps_mode : u8 ,
67+ /// GPS mode
68+ pub gps_mode : GpsMode ,
3969 /// Fixed latitude used when gps_mode=1
4070 pub gps_fixed_latitude : Option < f64 > ,
4171 /// Fixed longitude used when gps_mode=1
@@ -49,15 +79,15 @@ impl Default for Config {
4979 port : 8080 ,
5080 debug_mode : false ,
5181 device : Device :: Orbic ,
52- ui_level : 1 ,
82+ ui_level : UiLevel :: Subtle ,
5383 colorblind_mode : false ,
54- key_input_mode : 0 ,
84+ key_input_mode : KeyInputMode :: Disabled ,
5585 analyzers : AnalyzerConfig :: default ( ) ,
5686 ntfy_url : None ,
5787 enabled_notifications : vec ! [ NotificationType :: Warning , NotificationType :: LowBattery ] ,
5888 min_space_to_start_recording_mb : 1 ,
5989 min_space_to_continue_recording_mb : 1 ,
60- gps_mode : 0 ,
90+ gps_mode : GpsMode :: Disabled ,
6191 gps_fixed_latitude : None ,
6292 gps_fixed_longitude : None ,
6393 }
0 commit comments