@@ -429,7 +429,7 @@ def dump(dbs, f, **options):
429
429
signalRef .set ('DEST' , 'I-SIGNAL' )
430
430
431
431
createSubElement (signalToPduMapping , 'START-POSITION' ,
432
- str (signal .getStartbit ( bitNumbering = 1 )))
432
+ str (signal .get_startbit ( bit_numbering = 1 )))
433
433
# missing: TRANSFER-PROPERTY: PENDING/...
434
434
435
435
for group in frame .signalGroups :
@@ -663,7 +663,7 @@ def dump(dbs, f, **options):
663
663
elements = createSubElement (arPackage , 'ELEMENTS' )
664
664
for name in dbs :
665
665
db = dbs [name ]
666
- for ecu in db .boardUnits :
666
+ for ecu in db .ecus :
667
667
ecuInstance = createSubElement (elements , 'ECU-INSTANCE' )
668
668
createSubElement (ecuInstance , 'SHORT-NAME' , ecu .name )
669
669
if ecu .comment :
@@ -961,7 +961,7 @@ def getSysSignals(syssignal, syssignalarray, Bo, Id, ns):
961
961
members = []
962
962
for signal in syssignalarray :
963
963
members .append (arGetName (signal , ns ))
964
- Bo .addSignalGroup (arGetName (syssignal , ns ), 1 , members )
964
+ Bo .add_signal_group (arGetName (syssignal , ns ), 1 , members )
965
965
966
966
967
967
def decodeCompuMethod (compuMethod , arDict , ns , float_factory ):
@@ -1179,7 +1179,7 @@ def getSignals(signalarray, Bo, xmlRoot, ns, multiplexId, float_factory):
1179
1179
1180
1180
if startBit is not None :
1181
1181
newSig = Signal (name .text ,
1182
- startBit = int (startBit .text ),
1182
+ start_bit = int (startBit .text ),
1183
1183
size = int (length .text ),
1184
1184
is_little_endian = is_little_endian ,
1185
1185
is_signed = is_signed ,
@@ -1198,30 +1198,30 @@ def getSignals(signalarray, Bo, xmlRoot, ns, multiplexId, float_factory):
1198
1198
1199
1199
if newSig .is_little_endian == 0 :
1200
1200
# startbit of motorola coded signals are MSB in arxml
1201
- newSig .setStartbit (int (startBit .text ), bitNumbering = 1 )
1201
+ newSig .set_startbit (int (startBit .text ), bitNumbering = 1 )
1202
1202
1203
1203
# save signal, to determin receiver-ECUs for this signal later
1204
1204
signalRxs [syssignal ] = newSig
1205
1205
1206
1206
if baseType is not None :
1207
1207
temp = arGetChild (baseType , "SHORT-NAME" , xmlRoot , ns )
1208
1208
if temp is not None and "boolean" == temp .text :
1209
- newSig .addValues (1 , "TRUE" )
1210
- newSig .addValues (0 , "FALSE" )
1209
+ newSig .add_values (1 , "TRUE" )
1210
+ newSig .add_values (0 , "FALSE" )
1211
1211
1212
1212
1213
1213
if initvalue is not None and initvalue .text is not None :
1214
1214
initvalue .text = canmatrix .utils .guess_value (initvalue .text )
1215
1215
newSig ._initValue = int (initvalue .text )
1216
- newSig .addAttribute ("GenSigStartValue" , str (newSig ._initValue ))
1216
+ newSig .add_attribute ("GenSigStartValue" , str (newSig ._initValue ))
1217
1217
else :
1218
1218
newSig ._initValue = 0
1219
1219
1220
1220
for key , value in list (values .items ()):
1221
- newSig .addValues (key , value )
1221
+ newSig .add_values (key , value )
1222
1222
if sig_long_name is not None :
1223
- newSig .addAttribute ("LongName" , sig_long_name )
1224
- Bo .addSignal (newSig )
1223
+ newSig .add_attribute ("LongName" , sig_long_name )
1224
+ Bo .add_signal (newSig )
1225
1225
1226
1226
1227
1227
def getFrame (frameTriggering , xmlRoot , multiplexTranslation , ns , float_factory ):
@@ -1251,7 +1251,7 @@ def getFrame(frameTriggering, xmlRoot, multiplexTranslation, ns, float_factory):
1251
1251
newFrame = Frame (arGetName (frameR , ns ), id = idNum , size = int (dlc .text ))
1252
1252
comment = getDesc (frameR , xmlRoot , ns )
1253
1253
if comment is not None :
1254
- newFrame .addComment (comment )
1254
+ newFrame .add_comment (comment )
1255
1255
else :
1256
1256
# without frameinfo take short-name of frametriggering and dlc = 8
1257
1257
logger .debug ("Frame %s has no FRAME-REF" % (sn ))
@@ -1276,11 +1276,11 @@ def getFrame(frameTriggering, xmlRoot, multiplexTranslation, ns, float_factory):
1276
1276
if selectorByteOrder .text == 'MOST-SIGNIFICANT-BYTE-LAST' :
1277
1277
is_little_endian = True
1278
1278
is_signed = False # unsigned
1279
- multiplexor = Signal ("Multiplexor" ,startBit = int (selectorStart .text ),size = int (selectorLen .text ),
1279
+ multiplexor = Signal ("Multiplexor" ,start_bit = int (selectorStart .text ),size = int (selectorLen .text ),
1280
1280
is_little_endian = is_little_endian ,multiplex = "Multiplexor" )
1281
1281
1282
1282
multiplexor ._initValue = 0
1283
- newFrame .addSignal (multiplexor )
1283
+ newFrame .add_signal (multiplexor )
1284
1284
staticPart = arGetChild (pdu , "STATIC-PART" , xmlRoot , ns )
1285
1285
ipdu = arGetChild (staticPart , "I-PDU" , xmlRoot , ns )
1286
1286
if ipdu is not None :
@@ -1307,7 +1307,7 @@ def getFrame(frameTriggering, xmlRoot, multiplexTranslation, ns, float_factory):
1307
1307
getSignals (pdusigmapping ,newFrame ,xmlRoot ,ns ,selectorId .text , float_factory )
1308
1308
1309
1309
if newFrame .comment is None :
1310
- newFrame .addComment (getDesc (pdu , xmlRoot , ns ))
1310
+ newFrame .add_comment (getDesc (pdu , xmlRoot , ns ))
1311
1311
1312
1312
if extEle is not None :
1313
1313
if extEle .text == 'EXTENDED' :
@@ -1328,39 +1328,39 @@ def getFrame(frameTriggering, xmlRoot, multiplexTranslation, ns, float_factory):
1328
1328
timePeriod = arGetChild (cyclicTiming , "TIME-PERIOD" , xmlRoot , ns )
1329
1329
1330
1330
if cyclicTiming is not None and eventTiming is not None :
1331
- newFrame .addAttribute ("GenMsgSendType" , "cyclicAndSpontanX" ) # CycleAndSpontan
1331
+ newFrame .add_attribute ("GenMsgSendType" , "cyclicAndSpontanX" ) # CycleAndSpontan
1332
1332
if minimumDelay is not None :
1333
- newFrame .addAttribute ("GenMsgDelayTime" , str (int (float_factory (minimumDelay .text ) * 1000 )))
1333
+ newFrame .add_attribute ("GenMsgDelayTime" , str (int (float_factory (minimumDelay .text ) * 1000 )))
1334
1334
if repeats is not None :
1335
- newFrame .addAttribute ("GenMsgNrOfRepetitions" , repeats .text )
1335
+ newFrame .add_attribute ("GenMsgNrOfRepetitions" , repeats .text )
1336
1336
elif cyclicTiming is not None :
1337
- newFrame .addAttribute ("GenMsgSendType" , "cyclicX" ) # CycleX
1337
+ newFrame .add_attribute ("GenMsgSendType" , "cyclicX" ) # CycleX
1338
1338
if minimumDelay is not None :
1339
- newFrame .addAttribute ("GenMsgDelayTime" , str (int (float_factory (minimumDelay .text ) * 1000 )))
1339
+ newFrame .add_attribute ("GenMsgDelayTime" , str (int (float_factory (minimumDelay .text ) * 1000 )))
1340
1340
if repeats is not None :
1341
- newFrame .addAttribute ("GenMsgNrOfRepetitions" , repeats .text )
1341
+ newFrame .add_attribute ("GenMsgNrOfRepetitions" , repeats .text )
1342
1342
else :
1343
- newFrame .addAttribute ("GenMsgSendType" , "spontanX" ) # Spontan
1343
+ newFrame .add_attribute ("GenMsgSendType" , "spontanX" ) # Spontan
1344
1344
if minimumDelay is not None :
1345
- newFrame .addAttribute ("GenMsgDelayTime" , str (int (float_factory (minimumDelay .text ) * 1000 )))
1345
+ newFrame .add_attribute ("GenMsgDelayTime" , str (int (float_factory (minimumDelay .text ) * 1000 )))
1346
1346
if repeats is not None :
1347
- newFrame .addAttribute ("GenMsgNrOfRepetitions" , repeats .text )
1347
+ newFrame .add_attribute ("GenMsgNrOfRepetitions" , repeats .text )
1348
1348
1349
1349
if startingTime is not None :
1350
1350
value = arGetChild (startingTime , "VALUE" , xmlRoot , ns )
1351
- newFrame .addAttribute ("GenMsgStartDelayTime" ,str (int (float_factory (value .text ) * 1000 )))
1351
+ newFrame .add_attribute ("GenMsgStartDelayTime" , str (int (float_factory (value .text ) * 1000 )))
1352
1352
elif cyclicTiming is not None :
1353
1353
value = arGetChild (timeOffset , "VALUE" , xmlRoot , ns )
1354
1354
if value is not None :
1355
- newFrame .addAttribute ("GenMsgStartDelayTime" ,str (int (float_factory (value .text ) * 1000 )))
1355
+ newFrame .add_attribute ("GenMsgStartDelayTime" , str (int (float_factory (value .text ) * 1000 )))
1356
1356
1357
1357
value = arGetChild (repeatingTime , "VALUE" , xmlRoot , ns )
1358
1358
if value is not None :
1359
- newFrame .addAttribute ("GenMsgCycleTime" ,str (int (float_factory (value .text ) * 1000 )))
1359
+ newFrame .add_attribute ("GenMsgCycleTime" , str (int (float_factory (value .text ) * 1000 )))
1360
1360
elif cyclicTiming is not None :
1361
1361
value = arGetChild (timePeriod , "VALUE" , xmlRoot , ns )
1362
1362
if value is not None :
1363
- newFrame .addAttribute ("GenMsgCycleTime" ,str (int (float_factory (value .text ) * 1000 )))
1363
+ newFrame .add_attribute ("GenMsgCycleTime" , str (int (float_factory (value .text ) * 1000 )))
1364
1364
1365
1365
1366
1366
# pdusigmappings = arGetChild(pdu, "SIGNAL-TO-PDU-MAPPINGS", arDict, ns)
@@ -1471,9 +1471,9 @@ def processEcu(ecu, db, arDict, multiplexTranslation, ns):
1471
1471
for out in outFrame :
1472
1472
if out in multiplexTranslation :
1473
1473
out = multiplexTranslation [out ]
1474
- frame = db .frameByName (out )
1474
+ frame = db .frame_by_name (out )
1475
1475
if frame is not None :
1476
- frame .addTransmitter (arGetName (ecu , ns ))
1476
+ frame .add_transmitter (arGetName (ecu , ns ))
1477
1477
else :
1478
1478
pass
1479
1479
@@ -1488,13 +1488,13 @@ def processEcu(ecu, db, arDict, multiplexTranslation, ns):
1488
1488
# signal.receiver.append(recname)
1489
1489
# else:
1490
1490
# print "in not found: " + inf
1491
- bu = BoardUnit (arGetName (ecu , ns ))
1491
+ bu = ecu (arGetName (ecu , ns ))
1492
1492
if nmAddress is not None :
1493
- bu .addAttribute ("NWM-Stationsadresse" , nmAddress .text )
1494
- bu .addAttribute ("NWM-Knoten" , "ja" )
1493
+ bu .add_attribute ("NWM-Stationsadresse" , nmAddress .text )
1494
+ bu .add_attribute ("NWM-Knoten" , "ja" )
1495
1495
else :
1496
- bu .addAttribute ("NWM-Stationsadresse" , "0" )
1497
- bu .addAttribute ("NWM-Knoten" , "nein" )
1496
+ bu .add_attribute ("NWM-Stationsadresse" , "0" )
1497
+ bu .add_attribute ("NWM-Knoten" , "nein" )
1498
1498
return bu
1499
1499
1500
1500
def ecuc_extract_signal (signal_node , ns ):
@@ -1522,7 +1522,7 @@ def ecuc_extract_signal(signal_node, ns):
1522
1522
signal_type = (attribute .getparent ().find (".//" + ns + "VALUE" ).text )
1523
1523
if attribute .text .endswith ("ComTimeout" ):
1524
1524
timeout = int (attribute .getparent ().find (".//" + ns + "VALUE" ).text )
1525
- return canmatrix .Signal (arGetName (signal_node ,ns ), startBit = start_bit , size = size , is_little_endian = is_little )
1525
+ return canmatrix .Signal (arGetName (signal_node ,ns ), start_bit = start_bit , size = size , is_little_endian = is_little )
1526
1526
1527
1527
def extract_cm_from_ecuc (com_module , search_point , ns ):
1528
1528
db = CanMatrix ()
@@ -1531,16 +1531,16 @@ def extract_cm_from_ecuc(com_module, search_point, ns):
1531
1531
if definition .text .endswith ("ComIPdu" ):
1532
1532
container = definition .getparent ()
1533
1533
frame = canmatrix .Frame (arGetName (container , ns ))
1534
- db .addFrame (frame )
1534
+ db .add_frame (frame )
1535
1535
allReferences = arGetChildren (container ,"ECUC-REFERENCE-VALUE" ,search_point ,ns )
1536
1536
for reference in allReferences :
1537
1537
value = arGetChild (reference ,"VALUE" ,search_point ,ns )
1538
1538
if value is not None :
1539
1539
signal_definition = value .find ('./' + ns + "DEFINITION-REF" )
1540
1540
if signal_definition .text .endswith ("ComSignal" ):
1541
1541
signal = ecuc_extract_signal (value ,ns )
1542
- frame .addSignal (signal )
1543
- db .recalcDLC (strategy = "max" )
1542
+ frame .add_signal (signal )
1543
+ db .recalc_dlc (strategy = "max" )
1544
1544
return {"" : db }
1545
1545
1546
1546
def load (file , ** options ):
@@ -1616,18 +1616,18 @@ def load(file, **options):
1616
1616
for cc in ccs :
1617
1617
db = CanMatrix ()
1618
1618
# Defines not jet imported...
1619
- db .addBUDefines ("NWM-Stationsadresse" , 'HEX 0 63' )
1620
- db .addBUDefines ("NWM-Knoten" , 'ENUM "nein","ja"' )
1621
- db .addSignalDefines ("LongName" , 'STRING' )
1622
- db .addFrameDefines ("GenMsgCycleTime" , 'INT 0 65535' )
1623
- db .addFrameDefines ("GenMsgDelayTime" , 'INT 0 65535' )
1624
- db .addFrameDefines ("GenMsgNrOfRepetitions" , 'INT 0 65535' )
1625
- db .addFrameDefines ("GenMsgStartValue" , 'STRING' )
1626
- db .addFrameDefines ("GenMsgStartDelayTime" , 'INT 0 65535' )
1627
- db .addFrameDefines (
1619
+ db .add_ecu_defines ("NWM-Stationsadresse" , 'HEX 0 63' )
1620
+ db .add_ecu_defines ("NWM-Knoten" , 'ENUM "nein","ja"' )
1621
+ db .add_signal_defines ("LongName" , 'STRING' )
1622
+ db .add_frame_defines ("GenMsgCycleTime" , 'INT 0 65535' )
1623
+ db .add_frame_defines ("GenMsgDelayTime" , 'INT 0 65535' )
1624
+ db .add_frame_defines ("GenMsgNrOfRepetitions" , 'INT 0 65535' )
1625
+ db .add_frame_defines ("GenMsgStartValue" , 'STRING' )
1626
+ db .add_frame_defines ("GenMsgStartDelayTime" , 'INT 0 65535' )
1627
+ db .add_frame_defines (
1628
1628
"GenMsgSendType" ,
1629
1629
'ENUM "cyclicX","spontanX","cyclicIfActiveX","spontanWithDelay","cyclicAndSpontanX","cyclicAndSpontanWithDelay","spontanWithRepitition","cyclicIfActiveAndSpontanWD","cyclicIfActiveFast","cyclicWithRepeatOnDemand","none"' )
1630
- db .addSignalDefines ("GenSigStartValue" , 'HEX 0 4294967295' )
1630
+ db .add_signal_defines ("GenSigStartValue" , 'HEX 0 4294967295' )
1631
1631
1632
1632
if ignoreClusterInfo == True :
1633
1633
canframetrig = root .findall ('.//' + ns + 'CAN-FRAME-TRIGGERING' )
@@ -1666,7 +1666,7 @@ def load(file, **options):
1666
1666
for frameTrig in canframetrig :
1667
1667
frameObject = getFrame (frameTrig ,searchPoint ,multiplexTranslation ,ns , float_factory )
1668
1668
if frameObject is not None :
1669
- db .addFrame (frameObject )
1669
+ db .add_frame (frameObject )
1670
1670
1671
1671
if ignoreClusterInfo == True :
1672
1672
pass
@@ -1706,15 +1706,15 @@ def load(file, **options):
1706
1706
desc = arGetChild (node , "DESC" , searchPoint , ns )
1707
1707
l2 = arGetChild (desc , "L-2" , searchPoint , ns )
1708
1708
if l2 is not None :
1709
- bu .addComment (l2 .text )
1709
+ bu .add_comment (l2 .text )
1710
1710
1711
- db .addEcu (bu )
1711
+ db .add_ecu (bu )
1712
1712
1713
1713
for frame in db .frames :
1714
1714
sig_value_hash = dict ()
1715
1715
for sig in frame .signals :
1716
1716
sig_value_hash [sig .name ] = sig ._initValue
1717
1717
frameData = frame .encode (sig_value_hash )
1718
- frame .addAttribute ("GenMsgStartValue" , "" .join (["%02x" % x for x in frameData ]))
1718
+ frame .add_attribute ("GenMsgStartValue" , "" .join (["%02x" % x for x in frameData ]))
1719
1719
result [busname ] = db
1720
1720
return result
0 commit comments