changes in acf. Now savedEcus.p is using in connected mode and TCOM for demo mode and alien VINs
This commit is contained in:
parent
951742363a
commit
3fe657d966
178
pyren3/acf.py
178
pyren3/acf.py
@ -14,46 +14,10 @@ import pickle
|
|||||||
from mod_acf_func import ACE
|
from mod_acf_func import ACE
|
||||||
|
|
||||||
mod_globals.os = os.name
|
mod_globals.os = os.name
|
||||||
|
|
||||||
if mod_globals.os == 'nt':
|
|
||||||
import pip
|
|
||||||
|
|
||||||
try:
|
|
||||||
import serial
|
|
||||||
except ImportError:
|
|
||||||
pip.main(['install','pyserial'])
|
|
||||||
|
|
||||||
try:
|
import serial
|
||||||
import colorama
|
import colorama
|
||||||
except ImportError:
|
from serial.tools import list_ports
|
||||||
pip.main(['install','colorama'])
|
|
||||||
try:
|
|
||||||
import colorama
|
|
||||||
except ImportError:
|
|
||||||
print("\n\n\n\t\t\tGive me access to the Internet for download modules\n\n\n")
|
|
||||||
sys.exit()
|
|
||||||
colorama.init()
|
|
||||||
else:
|
|
||||||
# let's try android
|
|
||||||
try:
|
|
||||||
import androidhelper as android
|
|
||||||
mod_globals.os = 'android'
|
|
||||||
except:
|
|
||||||
try:
|
|
||||||
import android
|
|
||||||
mod_globals.os = 'android'
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if mod_globals.os != 'android':
|
|
||||||
try:
|
|
||||||
import serial
|
|
||||||
from serial.tools import list_ports
|
|
||||||
#import ply
|
|
||||||
except ImportError:
|
|
||||||
print("\n\n\n\tPleas install additional modules")
|
|
||||||
print("\t\t>sudo easy_install pyserial")
|
|
||||||
sys.exit()
|
|
||||||
|
|
||||||
from mod_elm import ELM
|
from mod_elm import ELM
|
||||||
from mod_scan_ecus import ScanEcus
|
from mod_scan_ecus import ScanEcus
|
||||||
@ -146,6 +110,16 @@ def optParser():
|
|||||||
dest="vinnum",
|
dest="vinnum",
|
||||||
default="")
|
default="")
|
||||||
|
|
||||||
|
parser.add_argument("--ref",
|
||||||
|
help="alternative ref",
|
||||||
|
dest="ref",
|
||||||
|
default="")
|
||||||
|
|
||||||
|
parser.add_argument("--mtc",
|
||||||
|
help="alternative mtc",
|
||||||
|
dest="mtc",
|
||||||
|
default="")
|
||||||
|
|
||||||
parser.add_argument("-vv", "--verbose",
|
parser.add_argument("-vv", "--verbose",
|
||||||
help="show parameter explanations",
|
help="show parameter explanations",
|
||||||
dest="verbose",
|
dest="verbose",
|
||||||
@ -158,8 +132,6 @@ def optParser():
|
|||||||
default=False,
|
default=False,
|
||||||
action="store_true")
|
action="store_true")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
options = parser.parse_args()
|
options = parser.parse_args()
|
||||||
|
|
||||||
if not options.port and mod_globals.os != 'android':
|
if not options.port and mod_globals.os != 'android':
|
||||||
@ -186,6 +158,8 @@ def optParser():
|
|||||||
mod_globals.vin = options.vinnum
|
mod_globals.vin = options.vinnum
|
||||||
mod_globals.opt_verbose = options.verbose
|
mod_globals.opt_verbose = options.verbose
|
||||||
mod_globals.opt_verbose2 = options.verbose2
|
mod_globals.opt_verbose2 = options.verbose2
|
||||||
|
mod_globals.opt_ref = options.ref
|
||||||
|
mod_globals.opt_mtc = options.mtc
|
||||||
|
|
||||||
if options.dev=='' or len(options.dev)!=4 or options.dev[0:2]!='10':
|
if options.dev=='' or len(options.dev)!=4 or options.dev[0:2]!='10':
|
||||||
mod_globals.opt_dev = False
|
mod_globals.opt_dev = False
|
||||||
@ -207,61 +181,43 @@ def main():
|
|||||||
if not os.path.exists('../BVMEXTRACTION'):
|
if not os.path.exists('../BVMEXTRACTION'):
|
||||||
print("Can't find MTC database. (../BVMEXTRACTION)")
|
print("Can't find MTC database. (../BVMEXTRACTION)")
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
print('Opening ELM')
|
|
||||||
elm = ELM( mod_globals.opt_port, mod_globals.opt_speed, mod_globals.opt_log )
|
|
||||||
|
|
||||||
#change serial port baud rate
|
|
||||||
if mod_globals.opt_speed<mod_globals.opt_rate and not mod_globals.opt_demo:
|
|
||||||
elm.port.soft_boudrate( mod_globals.opt_rate )
|
|
||||||
|
|
||||||
print("Loading language ")
|
print("Loading language ")
|
||||||
sys.stdout.flush()
|
|
||||||
#loading language data
|
|
||||||
lang = optfile("Location/DiagOnCAN_"+mod_globals.opt_lang+".bqm",True)
|
lang = optfile("Location/DiagOnCAN_"+mod_globals.opt_lang+".bqm",True)
|
||||||
mod_globals.language_dict = lang.dict
|
mod_globals.language_dict = lang.dict
|
||||||
print("Done")
|
print("Done")
|
||||||
|
|
||||||
print('Loading ECUs list')
|
if not mod_globals.opt_demo:
|
||||||
se = ScanEcus(elm) #Prepare list of all ecus
|
# load connection attributes from savedEcus.p
|
||||||
|
print('Opening ELM')
|
||||||
SEFname = "savedEcus.p"
|
elm = ELM( mod_globals.opt_port, mod_globals.opt_speed, mod_globals.opt_log )
|
||||||
if mod_globals.opt_can2:
|
|
||||||
SEFname = "savedEcus2.p"
|
#change serial port baud rate
|
||||||
|
if mod_globals.opt_speed<mod_globals.opt_rate and not mod_globals.opt_demo:
|
||||||
|
elm.port.soft_boudrate( mod_globals.opt_rate )
|
||||||
|
|
||||||
|
print('Loading ECUs list')
|
||||||
|
|
||||||
|
#load savedEcus.p
|
||||||
|
se = ScanEcus(elm) #Prepare list of all ecus
|
||||||
|
se.scanAllEcus() #First scan of all ecus
|
||||||
|
de = se.detectedEcus
|
||||||
|
|
||||||
|
if mod_globals.vin=='':
|
||||||
|
print('Reading VINs')
|
||||||
|
VIN = getVIN( de, elm )
|
||||||
|
mod_globals.vin = VIN
|
||||||
|
|
||||||
pl_id_cache = './cache/pl_id_attr.p'
|
|
||||||
if os.path.isfile(pl_id_cache): #if cache exists
|
|
||||||
pl_id = pickle.load( open( pl_id_cache, "rb" ) ) #load it
|
|
||||||
else: #else
|
|
||||||
findTCOM('', '', '', True) #make cache
|
|
||||||
pl_id = pickle.load( open( pl_id_cache, "rb" ) ) #load it
|
|
||||||
|
|
||||||
if mod_globals.opt_demo and len(mod_globals.opt_ecuid)>0:
|
|
||||||
# demo mode with predefined ecu list
|
|
||||||
se.read_Uces_file( all = True )
|
|
||||||
se.detectedEcus = []
|
|
||||||
for i in mod_globals.opt_ecuid.split(','):
|
|
||||||
if i in list(se.allecus.keys()):
|
|
||||||
se.allecus[i]['ecuname']=i
|
|
||||||
se.allecus[i]['idf']=se.allecus[i]['ModelId'][2:4]
|
|
||||||
if se.allecus[i]['idf'][0]=='0':
|
|
||||||
se.allecus[i]['idf'] = se.allecus[i]['idf'][1]
|
|
||||||
se.allecus[i]['pin'] = 'can'
|
|
||||||
se.detectedEcus.append( se.allecus[i] )
|
|
||||||
else:
|
else:
|
||||||
if not os.path.isfile(SEFname) or mod_globals.opt_scan:
|
|
||||||
# choosing model
|
|
||||||
se.chooseModel( mod_globals.opt_car ) #choose model of car for doing full scan
|
|
||||||
|
|
||||||
# Do this check every time
|
|
||||||
se.scanAllEcus() #First scan of all ecus
|
|
||||||
|
|
||||||
de = se.detectedEcus
|
|
||||||
|
|
||||||
if mod_globals.vin=='':
|
#load connection attribute from platform_attr
|
||||||
print('Reading VINs')
|
pl_id_cache = './cache/platform_attr.p'
|
||||||
VIN = getVIN( de, elm )
|
if os.path.isfile(pl_id_cache): #if cache exists
|
||||||
mod_globals.vin = VIN
|
pl_id = pickle.load( open( pl_id_cache, "rb" ) ) #load it
|
||||||
|
else: #else
|
||||||
|
findTCOM('', '', '', True) #make cache
|
||||||
|
pl_id = pickle.load( open( pl_id_cache, "rb" ) ) #load it
|
||||||
|
#but we do not have platform yet, so load data and then continue
|
||||||
|
|
||||||
VIN = mod_globals.vin
|
VIN = mod_globals.vin
|
||||||
|
|
||||||
@ -274,19 +230,56 @@ def main():
|
|||||||
#print 'Finding MTC'
|
#print 'Finding MTC'
|
||||||
vindata, mtcdata, refdata, platform = acf_getMTC( VIN )
|
vindata, mtcdata, refdata, platform = acf_getMTC( VIN )
|
||||||
|
|
||||||
#print vindata
|
|
||||||
|
|
||||||
if vindata=='' or mtcdata=='' or refdata=='':
|
if vindata=='' or mtcdata=='' or refdata=='':
|
||||||
print("ERROR!!! Can't find MTC data in database")
|
print("ERROR!!! Can't find MTC data in database")
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
|
#print vindata
|
||||||
print("\tPlatform:",platform)
|
print("\tPlatform:",platform)
|
||||||
print("\tvindata:",vindata)
|
print("\tvindata:",vindata)
|
||||||
print("\tmtcdata:",mtcdata)
|
print("\tmtcdata:",mtcdata)
|
||||||
print("\trefdata:",refdata)
|
print("\trefdata:",refdata)
|
||||||
|
|
||||||
mtc = mtcdata.replace(' ','').replace('\n','').replace('\r','').replace('\t','').split(';')
|
mtc = mtcdata.replace(' ','').replace('\n','').replace('\r','').replace('\t','').split(';')
|
||||||
|
|
||||||
|
#now we may continue to prepare connection attributes in demo mode
|
||||||
|
if mod_globals.opt_demo:
|
||||||
|
de = []
|
||||||
|
for bus_brp in pl_id[platform].keys():
|
||||||
|
brp = ''
|
||||||
|
if ':' in bus_brp:
|
||||||
|
bus,brp = bus_brp.split(':')
|
||||||
|
else:
|
||||||
|
bus = bus_brp
|
||||||
|
|
||||||
|
for idf in pl_id[platform][bus_brp].keys():
|
||||||
|
ent = {}
|
||||||
|
ent['idf'] = idf
|
||||||
|
ent['ecuname'] = ''
|
||||||
|
if bus == '6':
|
||||||
|
ent['pin'] = 'can'
|
||||||
|
ent['pin1'] = '6'
|
||||||
|
ent['pin2'] = '14'
|
||||||
|
elif bus == '13':
|
||||||
|
ent['pin'] = 'can2'
|
||||||
|
ent['pin1'] = '13'
|
||||||
|
ent['pin2'] = '12'
|
||||||
|
else:
|
||||||
|
ent['pin'] = 'iso'
|
||||||
|
ent['pin1'] = '7'
|
||||||
|
ent['pin2'] = '15'
|
||||||
|
ent['brp'] = brp
|
||||||
|
ent['vehTypeCode'] = platform
|
||||||
|
ent['startDiagReq'] = ''
|
||||||
|
for a in pl_id[platform][bus_brp][idf]:
|
||||||
|
ent['dst'],ent['idRx'],ent['idTx'],starts = a.split('#')
|
||||||
|
if ent['startDiagReq'] == '':
|
||||||
|
ent['startDiagReq'] = starts
|
||||||
|
else:
|
||||||
|
ent['startDiagReq'] += ('#' + starts)
|
||||||
|
|
||||||
|
de.append( ent )
|
||||||
|
|
||||||
print('Loading Modules')
|
print('Loading Modules')
|
||||||
module_list = acf_loadModules( de, refdata, platform )
|
module_list = acf_loadModules( de, refdata, platform )
|
||||||
|
|
||||||
@ -303,10 +296,7 @@ def main():
|
|||||||
if 'mo' in list(m.keys()) and m['mo']!='':
|
if 'mo' in list(m.keys()) and m['mo']!='':
|
||||||
print("%2s : %s : %s" % (m['idf'],m['sref'],m['mo'].NOM))
|
print("%2s : %s : %s" % (m['idf'],m['sref'],m['mo'].NOM))
|
||||||
|
|
||||||
attr = []
|
acf_MTC_generateDefaults( m, mtc )
|
||||||
if platform in pl_id.keys() and m['idf'] in pl_id[platform].keys():
|
|
||||||
attr = pl_id[platform][m['idf']]
|
|
||||||
acf_MTC_generateDefaults( m, mtc, attr )
|
|
||||||
#acf_MTC_findDiff( m, mtc, elm )
|
#acf_MTC_findDiff( m, mtc, elm )
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -100,9 +100,13 @@ def acf_loadModules( de, refdata, platform ):
|
|||||||
|
|
||||||
for k in de:
|
for k in de:
|
||||||
if k['idf']==idf:
|
if k['idf']==idf:
|
||||||
|
m['pin'] = k['pin']
|
||||||
m['dst'] = k['dst']
|
m['dst'] = k['dst']
|
||||||
|
m['idRx'] = k['idRx']
|
||||||
|
m['idTx'] = k['idRx']
|
||||||
m['startDiagReq'] = k['startDiagReq']
|
m['startDiagReq'] = k['startDiagReq']
|
||||||
m['ecuname'] = k['ecuname']
|
m['ecuname'] = k['ecuname']
|
||||||
|
m['brp'] = k['brp']
|
||||||
break
|
break
|
||||||
|
|
||||||
module_list.append(m)
|
module_list.append(m)
|
||||||
|
@ -69,7 +69,7 @@ def acf_form_commands( m, cu, op ):
|
|||||||
m['acf_wc'][cu.RW] = acf_pack_command( True, ace.req[cu.RW], cu.DW, m['acf_wc'][cu.RW], op.TW, op.MW)
|
m['acf_wc'][cu.RW] = acf_pack_command( True, ace.req[cu.RW], cu.DW, m['acf_wc'][cu.RW], op.TW, op.MW)
|
||||||
ace.req[cu.RW].SentDI[cu.DW].val = op.VW + ' #[' + cu.TE + ' : ' + op.TEX + '](' + op.MTC + ')'
|
ace.req[cu.RW].SentDI[cu.DW].val = op.VW + ' #[' + cu.TE + ' : ' + op.TEX + '](' + op.MTC + ')'
|
||||||
|
|
||||||
def acf_MTC_generateDefaults( m, mtc, attr ):
|
def acf_MTC_generateDefaults( m, mtc ):
|
||||||
""" m - module definition map """
|
""" m - module definition map """
|
||||||
''' mtc - list of options '''
|
''' mtc - list of options '''
|
||||||
''' this function generates default values'''
|
''' this function generates default values'''
|
||||||
@ -133,30 +133,25 @@ def acf_MTC_generateDefaults( m, mtc, attr ):
|
|||||||
#print dumpn1
|
#print dumpn1
|
||||||
#print dumpn2
|
#print dumpn2
|
||||||
|
|
||||||
scriptn = mod_globals.mtcdir+'/scripts/cmd_'+m['idf']+'_'+mod_globals.vin[-4:]+'_'+m['sref']+'.cmd'
|
scriptn = mod_globals.mtcdir+'/scripts/cmd_'+m['pin']+'_'+m['idf']+'_'+mod_globals.vin[-4:]+'_'+m['sref']+'.cmd'
|
||||||
sf = open(scriptn,'wt')
|
sf = open(scriptn,'wt')
|
||||||
|
|
||||||
#print "--------------- Write Commands --------------------"
|
#print "--------------- Write Commands --------------------"
|
||||||
attr = list(attr)
|
|
||||||
attr_dst = ''
|
|
||||||
attr_ses = ''
|
|
||||||
if len(attr)>0:
|
|
||||||
attr_dst, attr_ses = attr[0].split('#')
|
|
||||||
if len(attr)>1:
|
|
||||||
attr_dst = attr_dst + ' #'
|
|
||||||
attr_ses = attr_ses + ' #'
|
|
||||||
for a in attr[1:]:
|
|
||||||
dst,ses = a.split('#')
|
|
||||||
attr_dst = attr_dst + ' ' + dst
|
|
||||||
attr_ses = attr_ses + ' ' + ses
|
|
||||||
|
|
||||||
# write preamble
|
# write preamble
|
||||||
sf.write('# ' + mod_globals.vin + '\n\n')
|
sf.write('# ' + mod_globals.vin + '\n\n')
|
||||||
sf.write('$addr = ' + attr_dst +'\n\n')
|
sf.write('$addr = ' + m['dst'] +'\n\n')
|
||||||
sf.write('can500 # init can macro\n\n')
|
sf.write('#idTx = ' + m['idTx'] + ' idRx = ' + m['idRx'] + '\n\n')
|
||||||
|
if m['pin'].startswith('can'):
|
||||||
|
if m['brp']=='0':
|
||||||
|
sf.write('can500 # init can macro\n\n')
|
||||||
|
else:
|
||||||
|
sf.write('can250 # init can macro\n\n')
|
||||||
|
else:
|
||||||
|
sf.write('fast # init iso macro\n\n')
|
||||||
sf.write('delay 1\n\n')
|
sf.write('delay 1\n\n')
|
||||||
sf.write('# open session\n')
|
sf.write('# open session\n')
|
||||||
sf.write('session ' + attr_ses + '\n\n')
|
sf.write('session ' + m['startDiagReq'] + '\n\n')
|
||||||
sf.write('# configuration\n')
|
sf.write('# configuration\n')
|
||||||
|
|
||||||
# save write commands
|
# save write commands
|
||||||
|
@ -1003,10 +1003,19 @@ def findTCOM( addr, cmd, rsp, pl_id = False ):
|
|||||||
ecuvhc = {}
|
ecuvhc = {}
|
||||||
pl_id = {}
|
pl_id = {}
|
||||||
vehicle = ''
|
vehicle = ''
|
||||||
|
|
||||||
|
se = ScanEcus( None )
|
||||||
|
print('Loading Uces.xml')
|
||||||
|
se.read_Uces_file(True)
|
||||||
|
|
||||||
print('Read models')
|
print('Read models')
|
||||||
file_list = mod_db_manager.get_file_list_from_clip('Vehicles/TCOM_*.[Xx]ml')
|
file_list = mod_db_manager.get_file_list_from_clip('Vehicles/TCOM_*.[Xx]ml')
|
||||||
for file in file_list:
|
for file in file_list:
|
||||||
vehicle = ''
|
vehicle = ''
|
||||||
|
|
||||||
|
#skip syntetic lada vesta
|
||||||
|
if '087' in file: continue
|
||||||
|
|
||||||
DOMTree = xml.dom.minidom.parse(mod_db_manager.get_file_from_clip(file))
|
DOMTree = xml.dom.minidom.parse(mod_db_manager.get_file_from_clip(file))
|
||||||
vh = DOMTree.documentElement
|
vh = DOMTree.documentElement
|
||||||
if vh.hasAttribute("defaultText"):
|
if vh.hasAttribute("defaultText"):
|
||||||
@ -1020,59 +1029,80 @@ def findTCOM( addr, cmd, rsp, pl_id = False ):
|
|||||||
connector = vh.getElementsByTagName("Connector")
|
connector = vh.getElementsByTagName("Connector")
|
||||||
cannetwork = connector.item(0).getElementsByTagName("CANNetwork")
|
cannetwork = connector.item(0).getElementsByTagName("CANNetwork")
|
||||||
isonetwork = connector.item(0).getElementsByTagName("ISONetwork")
|
isonetwork = connector.item(0).getElementsByTagName("ISONetwork")
|
||||||
|
addreses = {}
|
||||||
|
|
||||||
for pin in cannetwork:
|
for pin in cannetwork:
|
||||||
|
bus = pin.getAttribute("canH")
|
||||||
|
CANNetworkParams = pin.getElementsByTagName("CANNetworkParams")
|
||||||
|
brp = CANNetworkParams.item(0).getAttribute("brp")
|
||||||
|
bus = bus+':'+brp #brp is a can bus speed
|
||||||
|
CanIds = pin.getElementsByTagName("CanId")
|
||||||
|
addreses[bus] = {}
|
||||||
|
for CanId in CanIds:
|
||||||
|
targetAddress = CanId.getAttribute("targetAddress")
|
||||||
|
idTx = CanId.getAttribute("idTx")
|
||||||
|
idRx = CanId.getAttribute("idRx")
|
||||||
|
addreses[bus][targetAddress] = { 'idTx': idTx, 'idRx': idRx }
|
||||||
|
|
||||||
|
pl_id[vehTypeCode][bus] = {}
|
||||||
eculist = pin.getElementsByTagName("EcuList")
|
eculist = pin.getElementsByTagName("EcuList")
|
||||||
if eculist:
|
if eculist:
|
||||||
ecukind = eculist.item(0).getElementsByTagName("EcuKind")
|
ecukind = eculist.item(0).getElementsByTagName("EcuKind")
|
||||||
for ek in ecukind:
|
for ek in ecukind:
|
||||||
id = ek.getAttribute("idFamily")
|
id = ek.getAttribute("idFamily")
|
||||||
pl_id[vehTypeCode][id] = {}
|
pl_id[vehTypeCode][bus][id] = {}
|
||||||
pl_id[vehTypeCode][id]['refs'] = []
|
pl_id[vehTypeCode][bus][id]['refs'] = []
|
||||||
ecuref = ek.getElementsByTagName("EcuRef")
|
ecuref = ek.getElementsByTagName("EcuRef")
|
||||||
for er in ecuref:
|
for er in ecuref:
|
||||||
ecuname = er.getAttribute("name")
|
ecuname = er.getAttribute("name")
|
||||||
pl_id[vehTypeCode][id]['refs'].append(ecuname)
|
pl_id[vehTypeCode][bus][id]['refs'].append(ecuname)
|
||||||
if ecuname in list(ecuvhc.keys()):
|
if ecuname in list(ecuvhc.keys()):
|
||||||
ecuvhc[ecuname].append(vehicle)
|
ecuvhc[ecuname].append(vehicle)
|
||||||
else:
|
else:
|
||||||
ecuvhc[ecuname] = [vehicle]
|
ecuvhc[ecuname] = [vehicle]
|
||||||
for pin in isonetwork:
|
for pin in isonetwork:
|
||||||
|
bus = '7'
|
||||||
|
pl_id[vehTypeCode][bus] = {}
|
||||||
eculist = pin.getElementsByTagName("EcuList")
|
eculist = pin.getElementsByTagName("EcuList")
|
||||||
if eculist:
|
if eculist:
|
||||||
ecukind = eculist.item(0).getElementsByTagName("EcuKind")
|
ecukind = eculist.item(0).getElementsByTagName("EcuKind")
|
||||||
for ek in ecukind:
|
for ek in ecukind:
|
||||||
id = ek.getAttribute("idFamily")
|
id = ek.getAttribute("idFamily")
|
||||||
if id not in pl_id[vehTypeCode].keys():
|
if id not in pl_id[vehTypeCode][bus].keys():
|
||||||
pl_id[vehTypeCode][id] = {}
|
pl_id[vehTypeCode][bus][id] = {}
|
||||||
pl_id[vehTypeCode][id]['refs'] = []
|
pl_id[vehTypeCode][bus][id]['refs'] = []
|
||||||
ecuref = ek.getElementsByTagName("EcuRef")
|
ecuref = ek.getElementsByTagName("EcuRef")
|
||||||
for er in ecuref:
|
for er in ecuref:
|
||||||
ecuname = er.getAttribute("name")
|
ecuname = er.getAttribute("name")
|
||||||
pl_id[vehTypeCode][id]['refs'].append(ecuname)
|
pl_id[vehTypeCode][bus][id]['refs'].append(ecuname)
|
||||||
if ecuname in list(ecuvhc.keys()):
|
if ecuname in list(ecuvhc.keys()):
|
||||||
ecuvhc[ecuname].append(vehicle)
|
ecuvhc[ecuname].append(vehicle)
|
||||||
else:
|
else:
|
||||||
ecuvhc[ecuname] = [vehicle]
|
ecuvhc[ecuname] = [vehicle]
|
||||||
|
|
||||||
se = ScanEcus( None )
|
if pl_id:
|
||||||
print('Loading Uces.xml')
|
for bus in pl_id[vehTypeCode].keys():
|
||||||
se.read_Uces_file(True)
|
for id in pl_id[vehTypeCode][bus].keys():
|
||||||
|
attr = set()
|
||||||
if pl_id:
|
for r in pl_id[vehTypeCode][bus][id]['refs']:
|
||||||
#save pl_id
|
if r in se.allecus.keys():
|
||||||
for pl in pl_id.keys():
|
#attr.add(se.allecus[r]['stdType']+"#"+se.allecus[r]['dst']+"#"+se.allecus[r]['startDiagReq'])
|
||||||
for id in pl_id[pl].keys():
|
faddr = se.allecus[r]['dst']
|
||||||
attr = set()
|
if bus[:1]!='7':
|
||||||
for r in pl_id[pl][id]['refs']:
|
if faddr in addreses[bus].keys():
|
||||||
if r in se.allecus.keys():
|
faddr = faddr+'#'+addreses[bus][faddr]['idTx']+'#'+addreses[bus][faddr]['idRx']
|
||||||
#attr.add(se.allecus[r]['stdType']+"#"+se.allecus[r]['dst']+"#"+se.allecus[r]['startDiagReq'])
|
else:
|
||||||
attr.add(se.allecus[r]['dst']+"#"+se.allecus[r]['startDiagReq'])
|
faddr = faddr+'##'
|
||||||
#else:
|
attr.add(faddr+"#"+se.allecus[r]['startDiagReq'])
|
||||||
# print(r)
|
#else:
|
||||||
del pl_id[pl][id]['refs']
|
# print(r)
|
||||||
pl_id[pl][id] = attr
|
del pl_id[vehTypeCode][bus][id]['refs']
|
||||||
pickle.dump( pl_id, open( './cache/pl_id_attr.p', "wb" ) )
|
pl_id[vehTypeCode][bus][id] = attr
|
||||||
else:
|
|
||||||
|
vehTypeCode = ''
|
||||||
|
|
||||||
|
|
||||||
|
if not pl_id:
|
||||||
#print found ecus
|
#print found ecus
|
||||||
for r in list(se.allecus.keys()):
|
for r in list(se.allecus.keys()):
|
||||||
if se.allecus[r]['dst']!=addr: continue
|
if se.allecus[r]['dst']!=addr: continue
|
||||||
@ -1082,7 +1112,10 @@ def findTCOM( addr, cmd, rsp, pl_id = False ):
|
|||||||
print(r, se.allecus[r]['doc'], se.allecus[r]['ids'], ecuvhc[r])
|
print(r, se.allecus[r]['doc'], se.allecus[r]['ids'], ecuvhc[r])
|
||||||
except:
|
except:
|
||||||
print()
|
print()
|
||||||
|
|
||||||
|
if pl_id:
|
||||||
|
pickle.dump( pl_id, open( './cache/platform_attr.p', "wb" ) )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def generateSavedEcus( eculist, fileName ):
|
def generateSavedEcus( eculist, fileName ):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user