@@ -245,8 +245,7 @@ def create_output_port(parent, frame, ecu_name, prefix=""):
245245def create_secoc_configuration (frame , auth_info_tx_length_def , freshness_value_tx_length_def , data_id_def , freshness_value_length_def , spdu ):
246246 auth_info_tx_length = int (frame .attribute ("SCP_AuthInfoTxLength" )) if frame .attribute ("SCP_AuthInfoTxLength" ) is not None else int (auth_info_tx_length_def )
247247 freshness_value_tx_length = int (frame .attribute ("SCP_FreshnessValueTxLength" )) if frame .attribute ("SCP_FreshnessValueTxLength" ) is not None else int (freshness_value_tx_length_def )
248- secoc_pdu_length = frame .size + (auth_info_tx_length // 8 ) + (freshness_value_tx_length // 8 )
249- create_sub_element_fx (spdu , "BYTE-LENGTH" , str (secoc_pdu_length ))
248+ create_sub_element_fx (spdu , "BYTE-LENGTH" , str (frame .size ))
250249 create_sub_element_fx (spdu , "PDU-TYPE" , "OTHER" )
251250 manufac_extansion = create_sub_element_te (spdu , "MANUFACTURER-EXTENSION" )
252251 sec_props = create_sub_element_te (manufac_extansion , "SECURITY-PROPERTIES" )
@@ -657,12 +656,13 @@ def dump(db, f, **options):
657656
658657 frame_triggerings = create_sub_element_fx (channel , "FRAME-TRIGGERINGS" )
659658 for frame in db .frames :
660- # Create regular frame triggering
661- create_frame_triggering (frame_triggerings , frame )
662-
663659 # Create secured frame triggering if applicable
664660 if frame .attribute ("SC_Message" ) and frame .attribute ("SC_Message" ).lower () == "yes" :
665661 create_frame_triggering (frame_triggerings , frame , prefix = "S" )
662+ else :
663+ # Create regular frame triggering
664+ create_frame_triggering (frame_triggerings , frame )
665+
666666
667667 #
668668 # ECUS
@@ -709,11 +709,13 @@ def dump(db, f, **options):
709709 outputs = create_sub_element_fx (connector , "OUTPUTS" )
710710 for frame in db .frames :
711711 if bu .name in frame .transmitters :
712- # Create regular output port
713- create_output_port (outputs , frame , bu .name )
714712 # Create secured output port if applicable
715713 if frame .attribute ("SC_Message" ) and frame .attribute ("SC_Message" ).lower () == "yes" :
716714 create_output_port (outputs , frame , bu .name , prefix = "S" )
715+ else :
716+ # Create regular output port
717+ create_output_port (outputs , frame , bu .name )
718+
717719
718720 # ignore CONTROLLERS/CONTROLLER
719721
@@ -729,7 +731,12 @@ def dump(db, f, **options):
729731 pdu = create_sub_element_fx (pdus , "PDU" )
730732 pdu .set ("ID" , "PDU_" + frame .name )
731733 create_short_name_desc (pdu , "PDU_" + frame .name , frame .comment )
732- create_sub_element_fx (pdu , "BYTE-LENGTH" , str (frame .size )) # DLC
734+ byte_length = frame .size
735+ if frame .attribute ("SC_Message" ) and frame .attribute ("SC_Message" ).lower () == "yes" :
736+ auth_info_tx_length = int (frame .attribute ("SCP_AuthInfoTxLength" )) if frame .attribute ("SCP_AuthInfoTxLength" ) is not None else int (auth_info_tx_length_def )
737+ freshness_value_tx_length = int (frame .attribute ("SCP_FreshnessValueTxLength" )) if frame .attribute ("SCP_FreshnessValueTxLength" ) is not None else int (freshness_value_tx_length_def )
738+ byte_length = frame .size - ((auth_info_tx_length + freshness_value_tx_length ) // 8 )
739+ create_sub_element_fx (pdu , "BYTE-LENGTH" , str (byte_length )) # DLC
733740 if frame .attribute ("NmAsrMessage" ) and frame .attribute ("NmAsrMessage" ).lower () == "yes" :
734741 create_sub_element_fx (pdu , "PDU-TYPE" , "NM" )
735742 else :
@@ -868,12 +875,13 @@ def dump(db, f, **options):
868875 #
869876 frames = create_sub_element_fx (elements , "FRAMES" )
870877 for frame in db .frames :
871- # Create regular frame
872- create_frame_element (frames , frame )
873-
874878 # Create secured frame if applicable
875879 if frame .attribute ("SC_Message" ) and frame .attribute ("SC_Message" ).lower () == "yes" :
876880 create_frame_element (frames , frame , prefix = "S" )
881+ else :
882+ # Create regular frame
883+ create_frame_element (frames , frame )
884+
877885
878886 #
879887 # FUNCTIONS
0 commit comments