Skip to content

Commit

Permalink
find compumethods and contraints also in ARXML-4.4 (#351)
Browse files Browse the repository at this point in the history
  • Loading branch information
ebroecker authored Apr 25, 2019
1 parent 3f97d38 commit 7793b9b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/canmatrix/canmatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ def pack_bitstring(length, is_float, value, signed):
x = bytearray(struct.pack(float_type, value))
bitstring = ''.join('{:08b}'.format(b) for b in x)
else:
b = '{:0{}b}'.format((2<<length )+ value, length)
b = '{:0{}b}'.format(int((2<<length )+ value), length)
bitstring = b[-length:]

return bitstring
Expand Down
16 changes: 13 additions & 3 deletions src/canmatrix/formats/arxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1005,9 +1005,19 @@ def get_signals(signal_array, frame, root_or_cache, ns, multiplex_id, float_fact

datatype = get_child(system_signal, "DATA-TYPE", root_or_cache, ns)
if datatype is None: # AR4?
data_constr = get_child(isignal, "DATA-CONSTR", root_or_cache, ns)
compu_method = get_child(isignal, "COMPU-METHOD", root_or_cache, ns)
base_type = get_child(isignal, "BASE-TYPE", root_or_cache, ns)
data_constr = None
compu_method = None
base_type = None
for test_signal in [isignal, system_signal]:
if data_constr is None:
data_constr = get_child(test_signal, "DATA-CONSTR", root_or_cache, ns)
if compu_method is None:
compu_method = get_child(test_signal, "COMPU-METHOD", root_or_cache, ns)
if base_type is None:
base_type = get_child(test_signal, "BASE-TYPE", root_or_cache, ns)



lower = get_child(data_constr, "LOWER-LIMIT", root_or_cache, ns)
upper = get_child(data_constr, "UPPER-LIMIT", root_or_cache, ns)
encoding = None # TODO - find encoding in AR4
Expand Down

0 comments on commit 7793b9b

Please sign in to comment.