Compare commits

..

14 Commits

Author SHA1 Message Date
18dbbdb702 Merge pull request 'branche_ju_decodezonememoire' (#35) from branche_ju_decodezonememoire into feature_ssv_lire_carte_ps
Reviewed-on: #35
2024-08-01 22:53:06 +02:00
lienjukaisim
00bacf26e8 ssv_lire_carte_ps2 retourne un CartePS 2024-08-01 22:52:47 +02:00
266944b3da
fixup! feat: add FSV documentation, for easy access 2024-07-31 11:34:03 +02:00
7500eb8c88
feat: add FSV documentation, for easy access 2024-07-30 21:54:00 +02:00
7555d33d7e
feature: implement block and fields as Struct implementing (Try)From trait 2024-07-30 21:27:10 +02:00
dc6d41a1a2
feat: add read_element function for raw bloc or field parsing 2024-07-30 15:53:19 +02:00
b8123306b7
fixup! feat: add a function to read a "bloc / field size" in SSV memory 2024-07-30 15:18:33 +02:00
5ed52a657e
feat: add a function to read a "bloc / field size" in SSV memory 2024-07-30 15:15:52 +02:00
lienjukaisim
815333667a Commit 29-07-24 2024-07-29 22:00:09 +02:00
8017760499
fake: for git exercising 2024-07-29 21:55:29 +02:00
lienjukaisim
da3fe4993d Merge branch 'feature_ssv_lire_carte_ps' of https://forge.p4pillon.org/P4Pillon/Krys4lide into feature_ssv_lire_carte_ps 2024-07-29 21:44:33 +02:00
4fe5d9321a
fake: fake commit for exercising 2024-07-29 21:43:47 +02:00
lienjukaisim
06e1f3dff9 Co-authored-by: Florian Briand <Nabellaleen@users.noreply.github.com> 2024-07-29 21:43:15 +02:00
e319df5e59
feature: Add decode_zone_memoire function
Co-authored-by: julien.misiak
2024-07-29 20:36:14 +02:00
3 changed files with 2 additions and 21 deletions

View File

@ -1,5 +1,4 @@
name: Demande de fusion (Pull Request)
about: Créez une demande de fusion pour partager votre travail avec le reste de l'équipe
body:
- type: markdown
attributes:

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;