@@ -710,7 +710,27 @@ static NfcCommand metroflip_scene_navigo_poller_callback(NfcGenericEvent event,
710
710
card -> navigo -> contracts [i - 1 ].zones_available = true;
711
711
}
712
712
713
- // 13.7. ContractValidityJourneys -- pas sûr de le mettre lui
713
+ // 13.7. ContractValidityJourneys
714
+ contract_key = "ContractValidityJourneys" ;
715
+ if (is_calypso_node_present (
716
+ bit_representation , contract_key , IntercodeContractStructure )) {
717
+ int positionOffset = get_calypso_node_offset (
718
+ bit_representation , contract_key , IntercodeContractStructure );
719
+ int start = positionOffset ,
720
+ end = positionOffset +
721
+ get_calypso_node_size (
722
+ contract_key , IntercodeContractStructure ) -
723
+ 1 ;
724
+ int decimal_value = bit_slice_to_dec (bit_representation , start , end );
725
+ // first 5 bits -> CounterStructureNumber
726
+ // last 8 bits -> CounterLastLoad
727
+ // other bits -> RFU
728
+ card -> navigo -> contracts [i - 1 ].counter .struct_number = decimal_value >>
729
+ 11 ;
730
+ card -> navigo -> contracts [i - 1 ].counter .last_load = decimal_value &
731
+ 0xFF ;
732
+ card -> navigo -> contracts [i - 1 ].counter_present = true;
733
+ }
714
734
715
735
// 15.0. ContractValiditySaleDate
716
736
contract_key = "ContractValiditySaleDate" ;
@@ -830,6 +850,12 @@ static NfcCommand metroflip_scene_navigo_poller_callback(NfcGenericEvent event,
830
850
831
851
// Ticket counts (contracts 1-4)
832
852
for (int i = 0 ; i < 4 ; i ++ ) {
853
+ if (card -> navigo -> contracts [i ].present == 0 ) {
854
+ continue ;
855
+ }
856
+ if (card -> navigo -> contracts [i ].counter_present == 0 ) {
857
+ continue ;
858
+ }
833
859
start = 0 ;
834
860
end = 5 ;
835
861
card -> navigo -> contracts [i ].counter .count = bit_slice_to_dec (
0 commit comments