Skip to content

Commit 41d0dad

Browse files
committed
extract most of relevant flexray info (#432)
not yet integraded - only extracted by now
1 parent dccbfce commit 41d0dad

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/canmatrix/formats/arxml.py

+14-8
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ def get_element_name(parent, ns):
895895
def get_sys_signals(sys_signal, sys_signal_array, frame, group_id, ns):
896896
# type: (_Element, typing.Sequence[_Element], canmatrix.Frame, int, str) -> None
897897
members = [get_element_name(signal, ns) for signal in sys_signal_array]
898-
frame.add_signal_group(get_element_name(sys_signal, ns), 1, members) # todo use group_id instead of 1?
898+
frame.add_signal_group(get_element_name(sys_signal, ns), group_id, members) # todo use group_id instead of 1?
899899

900900

901901
def decode_compu_method(compu_method, root_or_cache, ns, float_factory):
@@ -1625,6 +1625,8 @@ def decode_ethernet_helper(root, root_or_cache, ns, float_factory):
16251625
def decode_flexray_helper(root, root_or_cache, ns, float_factory):
16261626
found_matrixes = {}
16271627
fcs = root.findall('.//' + ns + 'FLEXRAY-CLUSTER')
1628+
frame_counter = 0
1629+
16281630
for fc in fcs:
16291631
physical_channels = fc.findall('.//' + ns + "FLEXRAY-PHYSICAL-CHANNEL")
16301632
for pc in physical_channels:
@@ -1635,22 +1637,26 @@ def decode_flexray_helper(root, root_or_cache, ns, float_factory):
16351637

16361638
frames = pc.findall('.//' + ns + "FLEXRAY-FRAME-TRIGGERING")
16371639
for frame in frames:
1638-
slotId = int(get_child(frame, "SLOT-ID", root_or_cache, ns).text)
1639-
1640+
slot_id = int(get_child(frame, "SLOT-ID", root_or_cache, ns).text)
1641+
base_cycle = get_child(frame, "BASE-CYCLE", root_or_cache, ns)
16401642
ipdu_triggerings = get_children(frame, "I-PDU-TRIGGERING", root_or_cache, ns)
1641-
#pc.findall('.//' + ns + "I-PDU-TRIGGERING")
1642-
1643-
#network_endpoints = pc.findall('.//' + ns + "NETWORK-ENDPOINT")
1643+
frame_repetition_cycle = find_children_by_path(frame, "CYCLE-REPETITION/CYCLE-REPETITION", root_or_cache, ns)[0]
1644+
network_endpoints = pc.findall('.//' + ns + "NETWORK-ENDPOINT")
1645+
frame_size = int(find_children_by_path(frame, "FRAME/FRAME-LENGTH", root_or_cache, ns)[0].text)
16441646
for ipdu_triggering in ipdu_triggerings:
1647+
ipdu_triggering_name = get_element_name(ipdu_triggering, ns)
16451648
ipdu = get_child(ipdu_triggering, "I-PDU", root_or_cache, ns)
1649+
pdu_type = get_child(ipdu_triggering, "I-PDU-REF", root_or_cache, ns).attrib["DEST"]
1650+
ipdu_length = int(get_child(ipdu, "LENGTH", root_or_cache, ns).text)
1651+
pdu_port_type = get_child(ipdu_triggering, "I-PDU-PORT-REF", root_or_cache, ns).attrib["DEST"]
16461652
ipdu_name = get_element_name(ipdu, ns)
1647-
target_frame = canmatrix.Frame(name = ipdu_name, arbitration_id=slotId)
1653+
frame_counter += 1;
1654+
target_frame = canmatrix.Frame(name = ipdu_name, arbitration_id=frame_counter, size=ipdu_length)
16481655
pdu_sig_mapping = get_children(ipdu, "I-SIGNAL-TO-I-PDU-MAPPING", root_or_cache, ns)
16491656
get_signals(pdu_sig_mapping, target_frame, root_or_cache, ns, None, float_factory)
16501657
db.add_frame(target_frame)
16511658
return found_matrixes
16521659

1653-
16541660
def decode_can_helper(root, root_or_cache, ns, float_factory, ignore_cluster_info):
16551661
found_matrixes = {}
16561662
if ignore_cluster_info is True:

0 commit comments

Comments
 (0)