修改该了关于info信息为json内部管理 该项目只适用于windows或linux 修改了c++及相应的rust代码 不适用于arm

This commit is contained in:
xin
2025-06-17 17:02:35 +08:00
parent a500813e45
commit ae30c24a8f
10 changed files with 464 additions and 218 deletions

View File

@ -13,12 +13,15 @@ pub const Target_Spectral_Type_DN:u8 = 0x00;
pub const Target_Spectral_Type_Rad:u8 = 0x01;
pub const Target_Spectral_Type_Ref:u8 = 0x02;
pub const Target_Spectral_Type_IRad:u8 = 0x03;
pub const Target_Spectral_Type_CaliFile:u8 = 0x04;
pub const Target_Spectral_Type_CaliFile_Gain:u8 = 0x04;
pub const Target_Spectral_Type_FlatRef:u8 = 0x05;
pub const Target_Spectral_Type_DarkDN:u8 = 0x06;
pub const Target_Spectral_Type_FlatDN:u8 = 0x07;
pub const Target_LAMP_VALUE_SCALED:u8 = 0x08;
use serde_json::json;
#[derive(Debug, Clone, PartialEq)]
@ -293,26 +296,26 @@ impl SpectralData {
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct OtherInfo {
pub info_type: u8,
pub data: Vec<u8>, // Assuming the data is variable length
}
// #[derive(Debug, Clone, PartialEq)]
// pub struct OtherInfo {
// pub info_type: u8,
// pub data: Vec<u8>, // Assuming the data is variable length
// }
impl OtherInfo {
pub fn new() -> Self {
OtherInfo {
info_type: 0,
data: Vec::new(),
}
}
}
// impl OtherInfo {
// pub fn new() -> Self {
// OtherInfo {
// info_type: 0,
// data: Vec::new(),
// }
// }
// }
#[derive(Debug, Clone, PartialEq)]
pub struct OneIRISData {
pub spectral_data_section: Vec<SpectralData>,
pub spectral_info_section: Vec<SpectralInfo>,
pub other_info_section: Vec<OtherInfo>,
pub spectral_info_section: Vec<serde_json::Value>, // Using serde_json::Value for flexibility
pub other_info_section: Vec<serde_json::Value>,
pub image_info_section: Vec<ImageInfo>,
}
@ -327,20 +330,21 @@ impl OneIRISData {
}
}
#[derive(Debug, Clone, PartialEq)]
pub struct SpectralInfo {
pub sensor_id: String,
pub wave_coeff: [f64; 4],
}
// #[derive(Debug, Clone, PartialEq)]
// pub struct SpectralInfo {
// pub sensor_id: String,
// pub wave_coeff: [f64; 4],
// }
impl SpectralInfo {
pub fn new() -> Self {
SpectralInfo {
sensor_id: String::new(),
wave_coeff: [0.0; 4],
}
}
}
// impl SpectralInfo {
// pub fn new() -> Self {
// SpectralInfo {
// sensor_id: String::new(),
// wave_coeff: [0.0; 4],
// }
// }
// }
#[derive(Debug, Clone, PartialEq)]
pub struct ImageInfo {
@ -384,19 +388,19 @@ mod tests {
assert!(data.spectral_data.is_empty());
}
#[test]
fn test_spectral_info() {
let info = SpectralInfo::new();
assert_eq!(info.sensor_id, "");
assert_eq!(info.wave_coeff, [0.0; 4]);
}
// #[test]
// fn test_spectral_info() {
// let info = SpectralInfo::new();
// assert_eq!(info.sensor_id, "");
// assert_eq!(info.wave_coeff, [0.0; 4]);
// }
#[test]
fn test_other_info() {
let info = OtherInfo::new();
assert_eq!(info.info_type, 0);
assert!(info.data.is_empty());
}
// #[test]
// fn test_other_info() {
// let info = OtherInfo::new();
// assert_eq!(info.info_type, 0);
// assert!(info.data.is_empty());
// }
#[test]
fn test_image_info() {