diff --git a/pyren/scen_ecri_counter2.py b/pyren/scen_ecri_counter2.py new file mode 100644 index 0000000..b0b4c03 --- /dev/null +++ b/pyren/scen_ecri_counter2.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python + +import os +import sys +import re +import time +import string +import mod_globals +import mod_utils +import mod_ecu +from mod_utils import clearScreen +from mod_utils import pyren_encode +from mod_utils import KBHit +import xml.dom.minidom + +def run( elm, ecu, command, data ): + + clearScreen() + header = '['+command.codeMR+'] '+command.label + + ScmSet = {} + ScmParam = {} + + def get_message( msg ): + if msg in ScmParam.keys(): + value = ScmParam[msg] + else: + value = msg + if value.isdigit() and value in mod_globals.language_dict.keys(): + value = pyren_encode( mod_globals.language_dict[value] ) + return value + + def get_message_by_id( id ): + if id.isdigit() and id in mod_globals.language_dict.keys(): + value = pyren_encode( mod_globals.language_dict[id] ) + return value + + + DOMTree = xml.dom.minidom.parse(data) + ScmRoom = DOMTree.documentElement + + ScmParams = ScmRoom.getElementsByTagName("ScmParam") + + for Param in ScmParams: + name = pyren_encode( Param.getAttribute("name") ) + value = pyren_encode( Param.getAttribute("value") ) + + ScmParam[name] = value + + ScmSets = ScmRoom.getElementsByTagName("ScmSet") + + for Set in ScmSets: + setname = pyren_encode(Set.getAttribute("name")) + ScmParams = Set.getElementsByTagName("ScmParam") + + for Param in ScmParams: + name = pyren_encode( Param.getAttribute("name") ) + value = pyren_encode( Param.getAttribute("value") ) + + ScmSet[setname]= value + ScmParam[name] = value + + kb = KBHit() + + paramsToSend = "" + + identList = ['ID101', 'ID102', 'ID103', 'ID125', 'ID126', 'ID105', 'ID106', 'ID107', 'ID108', 'ID109', 'ID110', 'ID111', 'ID112', 'ID113', 'ID114', 'ID115', 'ID116', 'ID117', 'ID118', 'ID119', 'ID120', 'ID121', '00000000', 'ID123', 'ID124', 'ID186', 'ID187'] + + for ident in identList: + if ident.startswith("ID"): + paramsToSend += ecu.get_id(ident, 1) + else: + paramsToSend += ident + + ch = raw_input('Do you want to continue? ') + while (ch.upper() != 'YES') and (ch.upper()!= 'NO'): + ch = raw_input('Do you want to continue? ') + if ch.upper() != 'YES': + return + + responce = ecu.run_cmd(ScmParam['Cmde1'], paramsToSend) + + print + ch = raw_input('Press ENTER to exit') + return diff --git a/pyren/scen_ecri_paraminj2.py b/pyren/scen_ecri_paraminj2.py index 94a1f0d..51c7a39 100644 --- a/pyren/scen_ecri_paraminj2.py +++ b/pyren/scen_ecri_paraminj2.py @@ -59,11 +59,30 @@ def run( elm, ecu, command, data ): ScmSet[setname]= value ScmParam[name] = value - print setname, value - print name + # print setname, value + # print name kb = KBHit() + # ids = [] + # for param in ScmParam.keys(): + # if param == "IdentsZBegin": + # key = param[6:-5] + # begin = int(ScmParam['Idents'+key+'Begin']) + # end = int(ScmParam['Idents'+key+'End']) + # for idnum in range(begin ,end + 1): + # ids.append(ScmParam['Ident'+str(idnum)]) + # print ids + + # for ident in identList: + # if ident.startswith("ID") + # paramsToSend += ecu.get_id(ident, 1) + # else: + # paramsToSend += ident +# ['ID101', 'ID102', 'ID103', 'ID125', 'ID126', 'ID105', 'ID106', 'ID107', 'ID108', 'ID109', 'ID110', 'ID111', 'ID112', 'ID113', 'ID114', 'ID115', 'ID116', 'ID117', 'ID118', 'ID119', 'ID120', 'ID121', 'ID122', 'ID123', 'ID124', 'ID186', 'ID187'] + + # responce = ecu.run_cmd(ScmParam['Cmde1'], paramsToSend) + # mainText = get_message('TexteTitre') # important = get_message('TexteConsigne') # tilt = get_message('TexteValeurInclinaison')