Skip to content

Commit

Permalink
export values of signal (#136)
Browse files Browse the repository at this point in the history
-- TODO: import values also
  • Loading branch information
ebroecker committed Feb 25, 2018
1 parent 53e47b2 commit 7d39573
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions canmatrix/cmjson.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ def dump(db, f, **options):
attribs = {}
for attribute in db.signalDefines:
attribs[attribute] = signal.attribute(db,attribute)

values = {}
for key in signal.values:
values[key] = signal.values[key]
if not signal.is_little_endian:
if motorolaBitFormat == "msb":
startBit = signal.getStartbit(bitNumbering=1)
Expand All @@ -120,6 +124,7 @@ def dump(db, f, **options):
else: # motorolaBitFormat == "lsb"
startBit = signal.getStartbit(bitNumbering=1, startLittle=True)


signalDict = {
"name": signal.name,
"start_bit": startBit,
Expand All @@ -131,6 +136,7 @@ def dump(db, f, **options):
"is_float": signal.is_float,
"comment": signal.comment,
"attributes": attribs,
"values": values
}
if signal.multiplex is not None:
signalDict["multiplex"] = signal.multiplex
Expand Down

0 comments on commit 7d39573

Please sign in to comment.