Compare commits

..

6 Commits

2 changed files with 2 additions and 20 deletions

View File

@ -319,7 +319,6 @@ mod test_decode_ssv_memory {
1, 49,
];
let blocks = decode_ssv_memory(&bytes, bytes.len());
println!("{:#?}", blocks);
assert_eq!(blocks.len(), 2);
}
}

View File

@ -182,13 +182,10 @@ pub fn decode_zone_memoire(bytes: &[u8]) {
situations: Vec::new(),
};
println!("--- Decoding Zone Memoire ---");
println!("Taille de la zone mémoire: {}", bytes.len());
while current_pos_general < bytes.len() - 1 {
num_champ = 0;
current_groupe =
256 * bytes[current_pos_general] as i32 + bytes[current_pos_general + 1] as i32;
println!("-- Nouveau groupe : {}", current_groupe);
current_pos_general += 2;
let longueur_groupe: usize;
@ -201,13 +198,11 @@ pub fn decode_zone_memoire(bytes: &[u8]) {
acc + (256_i32.pow(i as u32) * bytes[current_pos_general] as i32) as usize
});
}
println!("--- Longueur groupe: {}", longueur_groupe);
current_pos_general += 1;
let mut current_pos_groupe = 0;
while current_pos_groupe < longueur_groupe {
num_champ += 1;
println!("---- Nouveau champ : {}", num_champ);
let longueur_champs: usize;
let nbre_octets_longueur: usize;
if bytes[current_pos_general] < 128 {
@ -221,7 +216,6 @@ pub fn decode_zone_memoire(bytes: &[u8]) {
acc + (256_i32.pow(i as u32) * bytes[current_pos_general] as i32) as usize
});
}
println!("----- Longueur champ: {}", longueur_champs);
let mut bytes_champ = vec![0; longueur_champs];
if longueur_champs > 0 {
@ -229,7 +223,6 @@ pub fn decode_zone_memoire(bytes: &[u8]) {
&bytes[current_pos_general + nbre_octets_longueur
..current_pos_general + nbre_octets_longueur + longueur_champs],
);
println!("----- Bytes du champ: {:?}", bytes_champ);
match current_groupe {
1 => match num_champ {
@ -381,27 +374,17 @@ pub fn decode_zone_memoire(bytes: &[u8]) {
String::from_utf8_lossy(&bytes_champ).to_string();
}
20 => {
carte_ps
.situations
.last_mut()
.unwrap()
.habilitation_à_signer_une_facture =
carte_ps.situations.last_mut().unwrap().habilitation_à_signer_une_facture =
String::from_utf8_lossy(&bytes_champ).to_string();
}
21 => {
carte_ps
.situations
.last_mut()
.unwrap()
.habilitation_à_signer_un_lot =
carte_ps.situations.last_mut().unwrap().habilitation_à_signer_un_lot =
String::from_utf8_lossy(&bytes_champ).to_string();
}
_ => (),
},
_ => (),
}
} else {
println!("----- Pas de bytes pour ce champ");
}
current_pos_general += longueur_champs + nbre_octets_longueur;