diff --git a/pyren3/CHANGE_LOG.txt b/pyren3/CHANGE_LOG.txt deleted file mode 100755 index b0ff386..0000000 --- a/pyren3/CHANGE_LOG.txt +++ /dev/null @@ -1,306 +0,0 @@ -История версий - - -v 0.8 (beta) - -- Первая версия от PyRen. Основана на версии скрипта pyren light v 0.7 (alpha) от Shr-lnm “club-renault.ru” -- Реализована работа с базами клип - -v 0.9 (beta) - -Исправлено: -- По результатам тестирования на Koleos исправлена пара ошибок иногда проявляющихся в меню DE -Добавлено: -- Упрощена инсталляция под Windows. Теперь не нужно ставить дополнительные модули Python. Скрипт сам их поставит при первом запуске. (Компьютер должен быть в сети) -- Разблокированы простые команды не требующие параметров (используйте с осторожностью) -- После сканирования, меню выбора ЭБУ показывает примерное количество ошибок. (Примерное потому, что некоторые не существенные ошибки далее могут игнорироваться) - -v 0.9.1 (beta) - -Исправлено: -- на Windows машинах, в меню некоторых блоков, вываливался с ошибкой отсутствия символа в кодовой странице cp866 -- не правильно показывал состояния и параметры длина которых больше 1-го и меньше 8-ми бит (поля с длиной более байта но не кратно 8-ми бит (если такие есть) по прежнему обрабатываться правильно не будут) -- на некоторых блоках вываливался в меню ошибок -- показывал не все ошибки в блоках STD_B -- некорректно отображалось буквенное обозначение параметров и состояний -Добавлено: -- В меню выбора ЭБУ добавлен пункт повторного сканирования ошибок по всем обнаруженным блокам. - -v 0.9.2 (beta) - -Исправлено: -- на windows машинах вываливался при нажатии не буквенных клавиш. -- вываливался при загрузке блоков с некорректно описанными переводами в языковой базе. Теперь, в таких случаях, берется поле defaulttext. Можно самостоятельно исправлять поле defaulttext если сделать не валидным значение поля codetext. -- исправлена ошибка повторного сканирования -Добавлено: -- модуль mod_optfile.py можно запускать самостоятельно для исследования содержимого файлов bqm и SGxxxxxxx.XML - -v 0.9.3 (beta) - -Исправлено: -- исправления в алгоритме сканирования и работы с к-линией (исправление от Shr-lnm) -- выход из любого пункта меню осуществляется кнопкой Q -- если запустить скрипт с ключом -L и указать не существующий язык, например FR, то языковая база не загрузится и все сообщения будут на языке оригинала (максимально быстрая загрузка) -- несколько мелких багов приводивших к вываливанию скрипта -Добавлено: -- поддержка wifi адаптеров. вместо названия com порта "-p com1" нужно указать адрес и порт wifi адаптера, например "-p 192.168.0.10:35000". Некоторые модели wifi адаптеров работают очень медленно - см. соответствующие форумы по настройкам адаптеров. -- поддержка серии сервисов в одной команде (когда одна команда меню вызывает последовательность простык команд ЭБУ) - -v 0.9.4 (beta) - -Исправлено: -- алгоритм изменения интервалов между сериями команд в соответсвии с указаниями из БД -- загрузка некоторых блоков прерывалась на стадии Loading defaults -Добавлено: -- выполенение серии команд без парамаметров - -v 0.9.5 (beta) - -Исправлено: -- при работе по CAN на ELM отключается автоворматирование “AT CAF0” это позволяет подавать команды длинее 7 байт (исправление от Shr-lnm) -- отключен ограничитель частоты опроса ЭБУ (busLoad) (исправление от Shr-lnm) -- алгоритм работы команд требующих повторения. -Добавлено: -- опция -r позволяет изменить скорость работы COM порта во время работы скрипта. (добавил Shr-lnm) -- Основное меню ЭБУ показывает описание пункта дополнительно к двухбуквенному (предложил gruzdev_f) -- Работа с командами, параметры которых выбираются из списка. (Например: смена языка в панели приборов, активирование круиз контроля и пр.) -- Ключ --csv включает запись параметров и состояний в CSV файл для дальнейшего анализа, например в exel. -- mod_ecu.py стал запускаемым. С его помощью можно посмотреть полный список параметров и команд ЭБУ - -v 0.9.6 (beta) - -Исправлено: -- несколько косметических ошибок. -Добавлено: -- быстрая загрузка (со второго раза). -- отключен автоматический FlowControl “AT CFC0” (добавил Shr-lnm) - -v 0.9.7 (beta) - -Исправлено: -- последовательности инициализации ELM для CAN и K-линии -- по умолчанию автоматический FlowControl не отключается -- отображение хода выполнения команд состоящих из нескольких сервисов -- перед считыванием ошибок таймер увеличивается до 1 секунды -- если скорость порта меньше 50kbps то команда 1902хх заменяется на 1902AF -- keepalive включается на CAN и ISO -Добавлено: -- поддержка нескольких сервисов в одной мнемонике, данные берутся из последнего сервиса - -v 0.9.8 (beta) - -Исправлено: -- обработка параметров с обратным порядком байт -- последовательность инициализации k-line (Shr-lnm) -Добавлено: -- поддержка запуска под Android -- генерация CSV для torque (Shr-lnm) - -v 0.9.9 (beta) - -Исправлено: -- более корректно работает mod_optfile.py (спасибо Valentin8080) -- контроль длины вводимого параметра HEX -- изменена нумерация моделей автомобилей -- при выборе модели не показываются старые, неподдерживаемые модели. -- длинные меню адаптированы под маленький экран андроид -Добавлено: -- поддержка FAST/SLOW INIT на k-line (kline-mode2 от Shr-lnm) -- значительно улучшены возможности commander.py (см. пример кода) -- commander.py переименован в cmdr_example.py и изменен launcher -- в меню просмотра ошибок блоков STD_B выдаются дополнительные параметры (спасибо Ivaness) -- добавлен скрипт cmdr_odometr.py для проверки пробега в разных блоках - -v 0.9.9(3) (beta) - -Исправлено: -- алгоритм чтения ответов ELM (mod_elm_odometr_v2 от Shr-lnm) -- время отклика в логах -- ошибка логирования под Windows (спасибо Vitna) -- ошибка чтения некоторых параметров под Android (спасибо Ivaness) -Добавлено: -- принудительное включение SlowInit. Oпция --si -- отключение автоматического FlowControl выполняемого ELM. С опцией --cfc скрипт сам будет делать FC -- отключение ускорения работы по CAN шине за счет указания количества фреймов в ответе. Опция --n1c отключает это ускорение -- учет параметра brp (автоматический выбор CAN 250k/500k) - -v 0.9.9(4) (beta) - -Исправлено: -- работа опции --cfc - -v 0.9.9(5) (beta) - -Исправлено: -- выполнение некоторых команд. -- ошибка отображения при считывании идентификаций в hex -Добавлено: -- опция --csv_only отключает вывод данных на экран для ускорения записи в csv (добавил Slava.Vrn) -- опция --csv_human включает текстовое описание колонок и состояний в csv (добавил Slava.Vrn) -- интерфейс запуска сценариев -- реализован сценарий scen_ecri_fap5 - принудительная регенерация сажевого фильтра -- реализован сценарий scen_ecri_codevin - изменение VIN -- генерация csv и профилей для torque из под Android - -v 0.9.9(6) (beta) - -Исправлено: -- обработка некоторых команд с обратным порядком байт -- вываливался при использовании опции --csv_only (спасибо Slava.Vrn) -Добавлено: -- опция --usr_key позволяет добавить пользовательские события в csv файл (добавил Slava.Vrn) -- опция --dev (использовать с особой осторожностью) временно включает Development Session при выполнении некоторых конфигурационных соманд, таких как 3B81 (добавил Shr-lnm) -- опция --exp (использовать только в крайних случаях) включает кнопки в DDT -- поддержка базы данных DDT2000. (На android не работает и не планируется) (ИСПОЛЬЗУЙТЕ С ОСОБОЙ ОСТОРОЖНОСТЬЮ ПРЕДВАРИТЕЛЬНО ПРОВЕРИВ ВСЕ В DEMO) - скопируйте директорию ecus из DDT2000data туда, где лежат директории EcuRenault, Location и Vehicles -- mod_ddt может запускаться отдельно, для работы с машинами не поддерживаемыми в CLIP - -v 0.9.9(7) (beta) - -Исправлено: -- сканирование CAN на разных скоростях (250 и 500) (спасибо Shr-lnm) -- битовые операции в DDT -Добавлено: -- опция --dump. Сохраняет ответы на все команды 17*, 19*, 21*, 22* для использования в demo режиме и "на всякий случай" -- перевод ddt. (Сбылась мечта идиота :) - себя имею в виду) - -v 0.9.9(8) (beta) - -Исправлено: -- ошибка в расчете некоторых параметров -- много исправлений в mod_ddt -Добавлено: -- опция --can2. Работа с блоками на второй CAN шине. pin 12 и 13. Будет создан savedEcus2.p -- опция --dev теперь с параметром. Нужно указать команду открытия development сессии (например, --dev1086) -- опция -e для demo. Можно указать список блоков для которых запустится demo (например, -e 11476,11588,11570,11593 откроет блоки KOLEOS II). savedEcus.p не меняется. - -v 0.9.9(9) (beta) - -Исправлено: -- ошибка в командах 2E с битовыми полями -- ошибка генератора формул torque в параметрах со сдвигом -- много исправлений в mod_ddt - -v 0.9.a (beta) - -Исправлено: -- алгоритм поиска подходящего xml в базе ddt -- ошибка сохранения/загрузки dump -- ввод параметров в mod_ddt во время автообновления -- ошибка генерации формул для Torque -Добавлено: -- команды DEC и ASCII в режиме выполнения команд (добавил DarkCraz) -- добавлен сценарий scen_ecri_calinj1 (добавил DarkCraz) -- добавлена фильтрация фреймов в режиме монитора (добавил Shr-lnm) -- возможность указать xml при запуске mod_ddt -- mod_elm делает повторный запрос если получил NR (7F ** 78) или подобные -- сброс параметров адаптивного тайминга ELM при смене адреса на CAN - -v 0.9.b (beta) - -Исправлено: -- ошибки при запуске mod_ddt с ключом --xml -- масштаб отображения некоторых экранов в mod_ddt -- режим автообновления полей ввода в mod_ddt (спасибо Shr-lnm) -- задержка перед повторным выполнением команд после некоторых NR, изменена с 50 до 500 мс (спасибо Shr-lnm) -- ошибка сканирования блоков UDS (спасибо Shr-lnm) -Добавлено: -- автоматическая проверка адаптера во время работы -- автоматическое переключение адаптера в режим --cfc -- чтение адреса из xml в mod_ddt (Влияет на запуск не через pyren) -- возможность выбора источника начальных значений полей ввода. (Settings->Prefer Inputs from ECU) Если отключить, то значения будут браться из XML. Будьте внимательны. Значения в XML могут не соответствовать вашей комплектации!!!! - -v 0.9.c (beta) - -Исправлено: -- отображение некоторых экранов в ddt -- отрицательные значения в полях ввода -- автоматическое переключение адаптера в режим --cfc -- повторный запрос при получении NR (7F ** 78) - -v 0.9.e (beta) - -Исправлено: -- отображение некоторых экранов в mod_ddt -- динамическое изменение таймаута ELM при выполнении некоторых запросов (спасибо Shr-lnm) -- уменьшен эффект мерцания при отображении данных под Windows (спасибо Shr-lnm) -Добавлено: -- универсальный лаунчер _pyren_launcher.py (спасибо Shr-lnm) -- новый распаковщик базы extract.py. Дополнительно извлекает базу VIN и MTC (BVMEXTRACTION) -- отображение картинок и графических кнопок в mod_ddt. Необходимо положить папку graphics из базы ddt2000 рядом с папкой ecus -- утилита doc_maker.py. Извлекает из базы DocDb и формирует html-файл с диагностической документацией для заданного VIN - -v 0.9.f (beta) -...Поддержку android передаю в добрые руки... - -Исправлено: -- ошибки при генерации документации doc_maker -- ошибка кодировки в mod_utils - -v 0.9.h (beta) - -Исправлено: -- поддержка блоков UDS в mod_ddt - -v 0.9.i (beta) - -Исправлено: -- отображение некоторых ошибок в модулях failflag -- работа mod_ddt с медленными блоками -Добавлено: -- ЭКСПЕРИМЕНТАЛЬНАЯ функция отката для дампов в mod_ddt. Используйте с осторожностью, особенно для блоков std_a - -v 0.9.j (beta) - -Исправлено: -- улучшена работа функции отката. Увеличено количетво поддерживаемых блоков. - -v 0.9.k (beta) - -Исправлено: -- изменен алгоритм подбора xml в mod_ddt (требуется очистка cache и ввод типа автомобиля (или повторное сканирование блоков)) -- ошибка в работе софтверного FlowControl --cfc (спасибо Shr-lnm) -Добавлено: -- mod_term.py Терминал для работы с ELM и простейших макросов для ЭБУ. Свои макросы с именем *.txt нужно складывать в директорию macro. Пример использования mocro и переменных в macro/init.txt - -v 0.9.l (beta) - -Исправлено: -- cmdr_chkelm.py показывал OK вместо TIMEOUT -- убрана 200мс задержка между отображениями экранов в pyren -- ошибка отправки длинных команд в режиме --cfc -Добавлено: -- функция "Dumps/Show Diff" показывающая какие параметры различаются в дампах -- doc_maker.py выводит дату производства автомобиля на титульном листе -- исключение команды с откликом NR:12 из дальнейших опросов ECU -- автоматический переход в режим --cfc после "BUFFER FULL" -- подсказки [HEX, DEC, ASCII, VIN] при запуске команд с параметрами, [SHOW] при просмотре scm-сценариев - -v 0.9.m (beta) - -Исправлено: -- bus_monitor.py вместо unknown показывает hex содержимое фреймов -- mod_ddt заменяет непрочтенные значения на "none" вместо "0" для избежания возможных ошибок -- снято ограничение на ввод данных DEC и ASCII в режиме выполнения команд -- исправлен алгоритм обработки NR 78 -- исправлена ошибка termios -Добавлено: -- в mod_ddt меню Tools/Make torque PIDs -- mod_ddt автоматически генерирует экраны для всех команд ddt_all_commands (использовать для записи с особой осторожностью !!!!) - -v 0.9.n (beta) - -Исправлено: -- логирование elm_ для k-line -- отображение DTC для блоков STD-B -Добавлено: -- подсчет изменений во фреймах в bus_monitor -- библиотека pyserial включена в дистрибутив - -v 0.9.p (beta) - -Исправлено: -- ошибки логирования в mod_elm -- расчет CRC для VIN -Добавлено: -- новый лаунчер mod_ddt.py diff --git a/pyren3/cmdr_10742_rep.py b/pyren3/cmdr_10742_rep.py deleted file mode 100755 index a28f733..0000000 --- a/pyren3/cmdr_10742_rep.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python3 - -import sys, os -import mod_globals - -os.chdir(os.path.dirname(os.path.realpath(sys.argv[0]))) - -import mod_elm - -############## change me ################ - -ecu_functional_address = "7A" -mod_globals.os = 'android' -mod_globals.opt_port = 'bt' # 'COM4' - -######################################### - -#mod_globals.opt_demo = True -mod_globals.opt_cfc0 = True -mod_globals.opt_speed = 38400 -mod_globals.opt_log = '10742-rep.txt' - -print('Opening ELM') -elm = mod_elm.ELM( mod_globals.opt_port, mod_globals.opt_speed, True ) - -print('Init ELM') -elm.init_can() - -TXa = mod_elm.dnat[ecu_functional_address] -RXa = mod_elm.snat[ecu_functional_address] - -print(elm.cmd("at sh "+TXa)) -print(elm.cmd("at cra "+RXa)) -print(elm.cmd("at fc sh "+TXa)) -print(elm.cmd("at fc sd 30 00 00")) -print(elm.cmd("at fc sm 1")) -print(elm.cmd("at st ff")) -print(elm.cmd("at at 0")) -print(elm.cmd("at sp 6")) -print(elm.cmd("at at 1")) -print(elm.cmd("10C0")) - -# check ECU -r = elm.cmd("2180") -#debug -#r = '''61 80 34 36 33 32 52 45 34 42 45 30 30 33 37 52 00 83 9D 00 1A 90 01 01 00 88 AA''' -if len(r)<53 or r[7*3:7*3+2]!='45' or r[17*3:17*3+2]!='83': - print("\n\nNot compatible ECU\n\n") - exit() - -print(elm.cmd("2EFD5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")) -print(elm.cmd("2EFD510000000100000001000000010000000100000001000000010000000100000001")) -print(elm.cmd("2EFD527FFA7FFA7FFA7FFA7FFA7FFA7FFA7FFA7FFA7FFA7FFA7FFA7FFA7FFA7FFA7FFA7FFA7FFA7FFA7FFA7FFA7FFA7FFA7FFA7FFA7FFA7FFA7FFA7FFA7FFA7FFA7FFA")) -print(elm.cmd("2EFD5300")) -print(elm.cmd("2EFD5400000000000000000000000000000000")) -print(elm.cmd("2EFD550000000000000000000000000000000000000000000000000000000000000000")) -print(elm.cmd("2EFD5680008000800080008000800080008000")) -print(elm.cmd("2EFD5700")) -print(elm.cmd("2E216401")) - -print("Done") - - - - diff --git a/pyren3/cmdr_chkelm.py b/pyren3/cmdr_chkelm.py deleted file mode 100755 index 5b1ff6e..0000000 --- a/pyren3/cmdr_chkelm.py +++ /dev/null @@ -1,187 +0,0 @@ -#!/usr/bin/env python3 - -import sys, os -import time - -import mod_globals -import pyren3 - -cmdb = ''' -#v1.0 ;AC P; ATZ ; Z ; reset all -#v1.0 ;AC P; ATE1 ; E0, E1 ; Echo off, or on* -#v1.0 ;AC P; ATL0 ; L0, L1 ; Linefeeds off, or on -#v1.0 ;AC ; ATI ; I ; print the version ID -#v1.0 ;AC ; AT@1 ; @1 ; display the device description -#v1.0 ;AC P; ATAL ; AL ; Allow Long (>7 byte) messages -#v1.0 ;AC ; ATBD ; BD ; perform a Buffer Dump -#V1.0 ;ACH ; ATSP4 ; SP h ; Set Protocol to h and save it -#v1.0 ;AC ; ATBI ; BI ; Bypass the Initialization sequence -#v1.0 ;AC P; ATCAF0 ; CAF0, CAF1 ; Automatic Formatting off, or on* -#v1.0 ;AC ; ATCFC1 ; CFC0, CFC1 ; Flow Controls off, or on* -#v1.0 ;AC ; ATCP 01 ; CP hh ; set CAN Priority to hh (29 bit) -#v1.0 ;AC ; ATCS ; CS ; show the CAN Status counts -#v1.0 ;AC ; ATCV 1250 ; CV dddd ; Calibrate the Voltage to dd.dd volts -#v1.0 ;AC ; ATD ; D ; set all to Defaults -#v1.0 ;AC ; ATDP ; DP ; Describe the current Protocol -#v1.0 ;AC ; ATDPN ; DPN ; Describe the Protocol by Number -#v1.0 ;AC P; ATH0 ; H0, H1 ; Headers off*, or on -#v1.0 ;AC ; ATI ; I ; print the version ID -#v1.0 ;AC P; ATIB 10 ; IB 10 ; set the ISO Baud rate to 10400* -#v1.0 ;AC ; ATIB 96 ; IB 96 ; set the ISO Baud rate to 9600 -#v1.0 ;AC ; ATL1 ; L0, L1 ; Linefeeds off, or on -#v1.0 ;AC ; ATM0 ; M0, M1 ; Memory off, or on -#v1.0 ;AC ; ATCM 00000000 ; CM hhhhhhhh ; set the ID Mask to hhhhhhhh -#v1.0 ;AC ; ATCF 00000000 ; CF hhhhhhhh ; set the ID Filter to hhhhhhhh -#v1.0 ;AC ; ATCM 000 ; CM hhh ; set the ID Mask to hhh -#v1.0 ;AC ; ATCF 000 ; CF hhh ; set the ID Filter to hhh -#v1.0 ; C ; ATMA ; MA ; Monitor All -#v1.0 ; C ; ATMR 01 ; MR hh ; Monitor for Receiver = hh -#v1.0 ; C ; ATMT 01 ; MT hh ; Monitor for Transmitter = hh -#v1.0 ;AC ; ATNL ; NL ; Normal Length messages* -#v1.0 ;AC ; ATPC ; PC ; Protocol Close -#v1.0 ;AC ; ATR1 ; R0, R1 ; Responses off, or on* -#v1.0 ;AC ; ATRV ; RV ; Read the input Voltage -#v1.0 ;ACH ; ATSP7 ; SP h ; Set Protocol to h and save it -#v1.0 ;ACH ; ATSH 00000000 ; SH wwxxyyzz ; Set Header to wwxxyyzz -#v1.0 ;AC ; ATSH 001122 ; SH xxyyzz ; Set Header to xxyyzz -#v1.0 ;AC P; ATSH 012 ; SH xyz ; Set Header to xyz -#v1.0 ;AC ; ATSP A6 ; SP Ah ; Set Protocol to Auto, h and save it -#v1.0 ;AC ; ATSP 6 ; SP h ; Set Protocol to h and save it -#v1.0 ;AC P; ATST FF ; ST hh ; Set Timeout to hh x 4 msec -#v1.0 ;AC P; ATSW 96 ; SW 00 ; Stop sending Wakeup messages -#v1.0 ;AC P; ATSW 34 ; SW hh ; Set Wakeup interval to hh x 20 msec -#v1.0 ;AC ; ATTP A6 ; TP Ah ; Try Protocol h with Auto search -#v1.0 ;AC ; ATTP 6 ; TP h ; Try Protocol h -#v1.0 ;AC P; ATWM 817AF13E ; WM [1 - 6 bytes] ; set the Wakeup Message -#v1.0 ;AC P; ATWS ; WS ; Warm Start (quick software reset) -#v1.1 ;AC P; ATFC SD 300000 ; FC SD [1 - 5 bytes]; FC, Set Data to [...] -#v1.1 ;AC P; ATFC SH 012 ; FC SH hhh ; FC, Set the Header to hhh -#v1.1 ;AC P; ATFC SH 00112233 ; FC SH hhhhhhhh ; Set the Header to hhhhhhhh -#v1.1 ;AC P; ATFC SM 1 ; FC SM h ; Flow Control, Set the Mode to h -#v1.1 ;AC ; ATPP FF OFF ; PP FF OFF ; all Prog Parameters disabled -#v1.1 ;AC ; ATPP FF ON ; PP FF ON ; all Prog Parameters enabled -#v1.1 ; ; ; PP xx OFF ; disable Prog Parameter xx -#v1.1 ; ; ; PP xx ON ; enable Prog Parameter xx -#v1.1 ; ; ; PP xx SV yy ; for PP xx, Set the Value to yy -#v1.1 ;AC ; ATPPS ; PPS ; print a PP Summary -#v1.2 ;AC ; ATAR ; AR ; Automatically Receive -#v1.2 ;AC 0; ATAT1 ; AT0, 1, 2 ; Adaptive Timing off, auto1*, auto2 -#v1.2 ; ; ; BRD hh ; try Baud Rate Divisor hh -#v1.2 ; ; ; BRT hh ; set Baud Rate Timeout -#v1.2 ;ACH ; ATSPA ; SP h ; Set Protocol to h and save it -#v1.2 ; C ; ATDM1 ; DM1 ; monitor for DM1 messages -#v1.2 ; C ; ATIFR H ; IFR H, S ; IFR value from Header* or Source -#v1.2 ; C ; ATIFR0 ; IFR0, 1, 2 ; IFRs off, auto*, or on -#v1.2 ;AC ; ATIIA 01 ; IIA hh ; set ISO (slow) Init Address to hh -#v1.2 ;AC ; ATKW0 ; KW0, KW1 ; Key Word checking off, or on* -#v1.2 ; C ; ATMP 0123 ; MP hhhh ; Monitor for PGN 0hhhh -#v1.2 ; C ; ATMP 0123 4 ; MP hhhh n ; and get n messages -#v1.2 ; C ; ATMP 012345 ; MP hhhhhh ; Monitor for PGN hhhhhh -#v1.2 ; C ; ATMP 012345 6 ; MP hhhhhh n ; and get n messages -#v1.2 ;AC ; ATSR 01 ; SR hh ; Set the Receive address to hh -#v1.3 ; ; AT@2 ; @2 ; display the device identifier -#v1.3 ;AC P; ATCRA 012 ; CRA hhh ; set CAN Receive Address to hhh -#v1.3 ;AC ; ATCRA 01234567 ; CRA hhhhhhhh ; set the Rx Address to hhhhhhhh -#v1.3 ;AC ; ATD0 ; D0, D1 ; display of the DLC off*, or on -#v1.3 ;AC ; ATFE ; FE ; Forget Events -#v1.3 ;AC ; ATJE ; JE ; use J1939 Elm data format* -#v1.3 ;AC ; ATJS ; JS ; use J1939 SAE data format -#v1.3 ;AC ; ATKW ; KW ; display the Key Words -#v1.3 ;AC ; ATRA 01 ; RA hh ; set the Receive Address to hh -#v1.3 ;ACH ; ATSP6 ; SP h ; Set Protocol to h and save it -#v1.3 ;ACH ; ATRTR ; RTR ; send an RTR message -#v1.3 ;AC ; ATS1 ; S0, S1 ; printing of aces off, or on* -#v1.3 ;AC ; ATSP 00 ; SP 00 ; Erase stored protocol -#v1.3 ;AC ; ATV0 ; V0, V1 ; use of Variable DLC off*, or on -#v1.4 ;AC ; ATCEA ; CEA ; turn off CAN Extended Addressing -#v1.4 ;AC ; ATCEA 01 ; CEA hh ; use CAN Extended Address hh -#v1.4 ;AC ; ATCV 0000 ; CV 0000 ; restore CV value to factory setting -#v1.4 ;AC ; ATIB 48 ; IB 48 ; set the ISO Baud rate to 4800 -#v1.4 ;AC ; ATIGN ; IGN ; read the IgnMon input level -#v1.4 ; ; ; LP ; go to Low Power mode -#v1.4 ;AC ; ATPB 01 23 ; PB xx yy ; Protocol B options and baud rate -#v1.4 ;AC ; ATRD ; RD ; Read the stored Data -#v1.4 ;AC ; ATSD 01 ; SD hh ; Save Data byte hh -#v1.4 ;ACH ; ATSP4 ; SP h ; Set Protocol to h and save it -#v1.4 ;AC P; ATSI ; SI ; perform a Slow (5 baud) Initiation -#v1.4 ;ACH ; ATZ ; Z ; reset all -#v1.4 ;ACH ; ATSP5 ; SP h ; Set Protocol to h and save it -#v1.4 ;AC P; ATFI ; FI ; perform a Fast Initiation -#v1.4 ;ACH ; ATZ ; Z ; reset all -#v1.4 ;AC ; ATSS ; SS ; use Standard Search order (J1978) -#v1.4 ;AC ; ATTA 12 ; TA hh ; set Tester Address to hh -#v1.4 ;ACH ; ATSPA ; SP h ; Set Protocol to h and save it -#v1.4 ;AC ; ATCSM1 ; CSM0, CSM1 ; Silent Monitoring off, or on* -#v1.4 ;AC ; ATJHF1 ; JHF0, JHF1 ; Header Formatting off, or on* -#v1.4 ;AC ; ATJTM1 ; JTM1 ; set Timer Multiplier to 1* -#v1.4 ;AC ; ATJTM5 ; JTM5 ; set Timer Multiplier to 5 -#v1.4b;AC ; ATCRA ; CRA ; reset the Receive Address filters -#v2.0 ;AC ; ATAMC ; AMC ; display Activity Monitor Count -#v2.0 ;AC ; ATAMT 20 ; AMT hh ; set the Activity Mon Timeout to hh -#v2.1 ;AC ; ATCTM1 ; CTM1 ; set Timer Multiplier to 1* -#v2.1 ;AC ; ATCTM5 ; CTM5 ; set Timer Multiplier to 5 -#v2.1 ;ACH ; ATZ ; Z ; reset all -''' -os.chdir(os.path.dirname(os.path.realpath(sys.argv[0]))) - -try: - import serial - from serial.tools import list_ports -except ImportError: - sys.exit() - -from mod_elm import ELM - -def main(): - - pyren3.optParser() - - good = 0 - total= 0 - pycom= 0 - vers = '' - res = '' - - print('Opening ELM') - elm = ELM( mod_globals.opt_port, mod_globals.opt_speed, mod_globals.opt_log ) - elm.portTimeout = 5 - - for st in cmdb.split('#'): - cm = st.split(';') - - if len(cm)>1: - if mod_globals.os == 'android' and 'A' not in cm[1].upper(): continue - if mod_globals.os != 'android' and 'C' not in cm[1].upper(): continue - - if len(cm[2].strip()): - - res = elm.send_raw(cm[2]) - - #print res - - if 'H' in cm[1].upper(): continue - total += 1 - - if '?' in res: - chre = '[FAIL]' - if 'P' in cm[1].upper(): pycom += 1 - elif 'TIME' in res: - chre = '[TIMEOUT]' - else: - chre = '[OK]' - good += 1 - vers = cm[0] - - print("%5s %10s %6s"%(cm[0], cm[2], chre)) - sys.stdout.flush - - if pycom>0: - res = '\n\n\nUncompatible adapter on ARM core \n pyren would not work with it \n\n\n' - res = res + '\n\n\nResult: '+str(good)+' from '+str(total)+'\n Max version:'+vers+'\n\n\n\n\n\n\n' - - elm.lastMessage = res - -if __name__ == '__main__': - main() - - diff --git a/pyren3/cmdr_example.py b/pyren3/cmdr_example.py deleted file mode 100755 index 6955063..0000000 --- a/pyren3/cmdr_example.py +++ /dev/null @@ -1,127 +0,0 @@ -#!/usr/bin/env python3 - -# ______ ___ ___ ___ ___ ___ ______ __ _______ -# | ___| \ \ / / / \ | \/ | | _ \ | | | ____| -# | |__ \ V / / ^ \ | \ / | | |_) | | | | |__ -# | __| > < / /_\ \ | |\/| | | ___/ | | | __| -# | |___ / . \ / _____ \ | | | | | | | `----.| |____ -# |______| /__/ \__\ /__/ \__\ |__| |__| | _| |_______||_______| -# - -import sys, os -import time - -import mod_globals -import mod_ecu -import pyren3 - -os.chdir(os.path.dirname(os.path.realpath(sys.argv[0]))) - -try: - import serial - from serial.tools import list_ports -except ImportError: - sys.exit() - -from mod_elm import ELM -from mod_scan_ecus import ScanEcus -from mod_ecu import ECU -from mod_optfile import * -from mod_utils import * - -def prepareECU(): - '''This function loads data for ECU''' - - global elm - global ecu - - pyren.optParser() - - if len(mod_globals.opt_log)==0: - mod_globals.opt_log = 'commander_log.txt' - - print('Opening ELM') - elm = ELM( mod_globals.opt_port, mod_globals.opt_speed, mod_globals.opt_log ) - - print('Loading ECUs list') - se = ScanEcus(elm) #Prepare list of all ecus - - if not os.path.isfile("savedEcus.p") 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 - - print("Loading language ") - sys.stdout.flush() - #loading language data - lang = optfile("Location/DiagOnCAN_"+mod_globals.opt_lang+".bqm",True) - mod_globals.language_dict = lang.dict - print("Done") - - #clearScreen() - - choosen_ecu = se.chooseECU( mod_globals.opt_ecuid ) #choose ECU among detected - if choosen_ecu==-1: - print("#\n"*3,"# Unknown ECU defined!!!\n","#\n"*3) - exit(1) - - ecucashfile = "./cache/"+choosen_ecu['ModelId']+'_'+mod_globals.opt_lang+".p" - - if os.path.isfile(ecucashfile): #if cache exists - ecu = pickle.load( open( ecucashfile, "rb" ) ) #load it - else: #else - ecu = ECU(choosen_ecu, lang.dict ) #load original data for chosen ECU - pickle.dump( ecu, open( ecucashfile, "wb" ) ) #and save data to cache for next time - - ecu.initELM( elm ) #init ELM for chosen ECU - - #ecu.show_screens() # show ECU screens - -def main(): - - prepareECU() - - ##### - ##### Example start - ##### - - # Example of using raw commands - - print(elm.request( req = '2180', positive = '61', cache = False )) - print(elm.request( req = '2181', positive = '61', cache = False )) - - #print elm.request( req = '3B815646314C4D314230483131313131313131518C', positive = '7B', cache = False ) - - # Example of using states, parameters and ids - - for i in range( 1, 10 ): - value1, datastr1 = ecu.get_st('E019') #when you know that it is state name (internal or codeMR) - value2, datastr2 = ecu.get_pr('PR141') #when you know that it is parameter name (internal or codeMR) - value3, datastr3 = ecu.get_val('PR091') #when you do't know what it is state, param or id - value4, datastr4 = ecu.get_id('ID008') #when you know that it is identification name (internal or codeMR) - - # get all values before showing them for avoid screen flickering - - clearScreen() - print() - print("E019 ", value1) - print("RP141", value2) - print("PR091", value3) - print("ID008", value4) - time.sleep( 0.3 ) # 300 milliseconds - - #ecu.run_cmd('CF125', 'B0') - ecu.run_cmd('RZ001') - - ##### - ##### Example end - ##### - - - -if __name__ == '__main__': - main() - - diff --git a/pyren3/cmdr_odometr.py b/pyren3/cmdr_odometr.py deleted file mode 100755 index 2551099..0000000 --- a/pyren3/cmdr_odometr.py +++ /dev/null @@ -1,198 +0,0 @@ -#!/usr/bin/env python3 - -import sys, os -import time -import mod_utils -import mod_db_manager - -import mod_globals -import mod_ecu -import pyren3 - -os.chdir(os.path.dirname(os.path.realpath(sys.argv[0]))) - -try: - import serial - from serial.tools import list_ports -except ImportError: - sys.exit() - -from mod_elm import ELM -from mod_scan_ecus import ScanEcus -from mod_ecu import ECU -from mod_optfile import * -from mod_utils import * - -def prepareECUs(): - '''This function loads data for ECUs''' - - global elm - global ecu - global se - global lang - - pyren.optParser() - - mod_utils.chkDirTree() - mod_db_manager.find_DBs() - - if len(mod_globals.opt_log)==0: - mod_globals.opt_log = 'commander_log.txt' - - print('Opening ELM') - elm = ELM( mod_globals.opt_port, mod_globals.opt_speed, mod_globals.opt_log ) - - print('Loading ECUs list') - se = ScanEcus(elm) #Prepare list of all ecus - - if not os.path.isfile("savedEcus.p") 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 - - print("Loading language ") - sys.stdout.flush() - #loading language data - lang = optfile("Location/DiagOnCAN_"+mod_globals.opt_lang+".bqm",True) - mod_globals.language_dict = lang.dict - print("Done") - - return se.detectedEcus - -def chooseEcu( ecu_number ): - - global elm - global ecu - global se - global lang - - choosen_ecu = se.chooseECU( ecu_number ) - if choosen_ecu==-1: - print("#\n"*3,"# Unknown ECU defined!!!\n","#\n"*3) - exit(1) - - ecucashfile = "./cache/"+choosen_ecu['ModelId']+'_'+mod_globals.opt_lang+".p" - - if os.path.isfile(ecucashfile): #if cache exists - ecu = pickle.load( open( ecucashfile, "rb" ) ) #load it - else: #else - ecu = ECU(choosen_ecu, lang.dict ) #load original data for chosen ECU - pickle.dump( ecu, open( ecucashfile, "wb" ) ) #and save data to cache for next time - - ecu.initELM( elm ) #init ELM for chosen ECU - - #ecu.show_screens() # show ECU screens - -def main(): - list = prepareECUs() - - tot = '' - - for l in list: - if l['idf']=='1': #family 01 - print("### Connecting to Engine ###") - chooseEcu(l['ecuname']) - tot += "%-15s : " % "Engine PR025" - num, string = ecu.get_pr('PR025') - print(pyren_encode(string)) - tot += str(num); tot += '\n' - tot += "%-15s : " % "Engine PR992" - num, string = ecu.get_pr('PR992') - print(pyren_encode(string)) - tot += str(num); tot += '\n' - num, string = ecu.get_pr('PR391') - print(pyren_encode(string)) - num, string = ecu.get_pr('PR412') - print(pyren_encode(string)) - #num, string = ecu.get_pr('PR804') - #print pyren_encode(string) - #num, string = ecu.get_pr('PR869') - #print pyren_encode(string) - #num, string = ecu.get_pr('PR870') - #print pyren_encode(string) - print() - if l['idf']=='2': #family 02 - print("### Connecting to ABS ###") - chooseEcu(l['ecuname']) - tot += "%-15s : " % "ABS PR121" - num, string = ecu.get_pr('PR121') - print(pyren_encode(string)) - tot += str(num); tot += '\n' - print() - if l['idf']=='3': #family 03 - print("### Connecting to TDB ###") - chooseEcu(l['ecuname']) - tot += "%-15s : " % "TDB PR009" - num, string = ecu.get_pr('PR009') - print(pyren_encode(string)) - tot += str(num); tot += '\n' - tot += "%-15s : " % "TDB (km) PR025" - num, string = ecu.get_pr('PR025') - print(pyren_encode(string)) - tot += str(num); tot += '\n' - tot += "%-15s : " % "TDB (mil) PR026" - num, string = ecu.get_pr('PR026') - print(pyren_encode(string)) - tot += str(num); tot += '\n' - print() - - print(pyren_encode('Listening to CAN. Please wait a bit...')) - elm.cmd('at z') - elm.cmd("at e1") - elm.cmd("at l1") - elm.cmd("at h1") - elm.cmd("at d1") - elm.cmd("at caf0") - elm.cmd("at sp 6") - elm.cmd("at al") - elm.portTimeout = 1 - - elm.cmd("at cf 5C5") - elm.cmd("at cm 7FF") - elm.cmd("at cra 5C5") - resp = elm.cmd("atma") - elm.cmd("at") - for l in resp.split('\n'): - if l.upper().startswith('5C5'): - kmt = l[9:18].replace(' ','') - tot += "%-10s : " % "Frame 5C5" - tot = tot + str(int(kmt,16)); tot += '\n' - break - - elm.cmd("at cf 715") - elm.cmd("at cm 7FF") - elm.cmd("at cra 715") - elm.portTimeout = 5 - resp = elm.cmd("atma") - elm.portTimeout = 1 - elm.cmd("at") - for l in resp.split('\n'): - if l.upper().startswith('715'): - kmt = l[6:15].replace(' ','') - tot += "%-10s : " % "Frame 715" - tot = tot + str(int(kmt,16)); tot += '\n' - break - - elm.cmd("at cf 5FD") - elm.cmd("at cm 7FF") - elm.cmd("at cra 5FD") - elm.portTimeout = 5 - resp = elm.cmd("atma") - elm.portTimeout = 1 - elm.cmd("at") - for l in resp.split('\n'): - if l.upper().startswith('5FD'): - kmt = l[6:15].replace(' ','') - tot += "%-10s : " % "Frame 5FD" - tot = tot + str(int(kmt,16)); tot += '\n' - break - - #print tot - elm.lastMessage = tot - -if __name__ == '__main__': - main() - - diff --git a/pyren3/cmdr_simple.py b/pyren3/cmdr_simple.py deleted file mode 100755 index 9fc9bab..0000000 --- a/pyren3/cmdr_simple.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python3 - -import sys, os -#import serial - -import mod_globals - -os.chdir(os.path.dirname(os.path.realpath(sys.argv[0]))) - -import mod_elm - - -############## change me ################ - -ecu_functional_address = "26" -mod_globals.opt_port = 'bt' - -######################################### - - -#mod_globals.opt_demo = True -mod_globals.opt_speed = 38400 -mod_globals.opt_log = 'simpl.txt' - - -print('Opening ELM') -elm = mod_elm.ELM( mod_globals.opt_port, mod_globals.opt_speed, True ) - -print('Init ELM') -elm.init_can() - -TXa = mod_elm.dnat[ecu_functional_address] -RXa = mod_elm.snat[ecu_functional_address] -elm.currentaddress = TXa - -print(elm.cmd("at sh "+TXa)) -print(elm.cmd("at cra "+RXa)) -print(elm.cmd("at fc sh "+TXa)) -print(elm.cmd("at fc sd 30 00 00")) # status BS STmin -print(elm.cmd("at fc sm 1")) -print(elm.cmd("at sp 6")) -print(elm.cmd("10C0")) -#print elm.cmd("3BA00A00") - diff --git a/pyren3/cmdr_simple_iso.py b/pyren3/cmdr_simple_iso.py deleted file mode 100755 index 0afcbbc..0000000 --- a/pyren3/cmdr_simple_iso.py +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env python3 - -import sys, os -import serial - -import mod_globals - -os.chdir(os.path.dirname(os.path.realpath(sys.argv[0]))) - -import mod_elm - - -############## change me ################ - -ecu_functional_address = "7a" -#mod_globals.opt_port = 'com4' -mod_globals.opt_port = '/dev/cu.usbserial-AH01J4BS' - -######################################### - - -#mod_globals.opt_demo = True -mod_globals.opt_speed = 38400 -mod_globals.opt_log = 'simpl.txt' - - -print('Opening ELM') -elm = mod_elm.ELM( mod_globals.opt_port, mod_globals.opt_speed, True ) - -print('Init ELM') -print(elm.cmd("at z")) -elm.init_iso() - -#print elm.cmd("at fi") -print(elm.cmd("at sh 80 "+ecu_functional_address+" f1")) -print(elm.cmd("at sw 96")) -print(elm.cmd("at wm 81 "+ecu_functional_address+" f1 3E")) -print(elm.cmd("at ib10")) -print(elm.cmd("at st ff")) -print(elm.cmd("at at 0")) - -#print elm.cmd("at sp 4") -#print elm.cmd("at si") -print(elm.cmd("at sp 5")) -print(elm.cmd("at fi")) - -print(elm.cmd("at at 1")) -print(elm.cmd("at al")) -print(elm.cmd("at h1")) - - -print(elm.cmd("10C0")) -print(elm.cmd("2180")) -print(elm.cmd("2181")) -print(elm.cmd("17FF00")) -#print elm.cmd("14FF") -#print elm.cmd("14FF00") -print(elm.cmd("01 02 03 04 05 06 07 08 09")) - - diff --git a/pyren3/data_logger.py b/pyren3/data_logger.py new file mode 100644 index 0000000..6a1471b --- /dev/null +++ b/pyren3/data_logger.py @@ -0,0 +1,85 @@ +from mod_utils import chkDirTree +from mod_db_manager import find_DBs +from mod_elm import ELM +from mod_scan_ecus import ScanEcus +from mod_optfile import optfile +from mod_ecu import ECU +from mod_ply import Calc + +from pickle import dump, load +from time import sleep + +from flask import Flask, make_response, request + +from typing import List + +class RenDash: + def __init__(self, + elm_port, + elm_speed=38400, + model_number=58, + rescan=False) -> None: + chkDirTree() + find_DBs() + + self.elm = ELM(elm_port, elm_speed, "") + self.lang = optfile("Location/DiagOnCAN_GB.bqm", False) + self.ecus: List[ECU] = [] + self.current_ecu = None + + self.web = Flask(__name__) + + if rescan is False: + try: + self.ecus = load(open("frozen_ecus.p", "rb")) + except Exception as e: + pass + if not self.ecus: + ecu_scanner = ScanEcus(self.elm) + ecu_scanner.chooseModel(model_number) + ecu_scanner.scanAllEcus() + for ecu in ecu_scanner.detectedEcus: + self.ecus.append(ECU(ecu, self.lang.dict)) + dump(self.ecus, open("frozen_ecus.p", "wb+")) + + for ecu in self.ecus: + setattr(ecu, "calc", Calc()) + + def get_ecu_names(self): + return [ecu.ecudata["doc"] for ecu in self.ecus] + + def get_ecu_by_doc(self, doc): + for ecu in self.ecus: + if ecu.ecudata["doc"] == doc: + if self.current_ecu is not ecu: + ecu.initELM(self.elm) + self.current_ecu = ecu + return ecu + + def get_ecu_states(self, doc): + ecu = self.get_ecu_by_doc(doc) + return ecu.Parameters + + def get_ecu_state(self, doc, state): + ecu = self.get_ecu_by_doc(doc) + datastr = ecu.get_st(state) + return datastr + + def get_ecu_param(self, doc, param): + ecu = self.get_ecu_by_doc(doc) + datastr = ecu.get_pr(param) + return datastr + +if __name__ == "__main__": + rd = RenDash("/dev/tty0") + while True: + clearScreen() + for ecu_doc, values in REQUIRED_ECU_STATES.items(): + for val in values: + if val.startswith("E"): + print(rd.get_ecu_state(ecu_doc, val)) + elif val.startswith("P"): + print(rd.get_ecu_param(ecu_doc, val)) + sleep(0.1) + + \ No newline at end of file diff --git a/pyren3/scen_auto_config.py b/pyren3/scen_auto_config.py deleted file mode 100644 index a399b75..0000000 --- a/pyren3/scen_auto_config.py +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/env python3 -''' -Scenarium usage example - -Name of this script should be exactly the same as in scenaruim URL but with '.py' extension - -URL - scm:scen_ecri_codevin#scen_ecri_codevin_xxxxx.xml - -'run' procedure will be executed by pyren script - -''' - -import os -import sys -import re -import time - -import mod_globals -import mod_utils -import mod_ecu -import mod_db_manager -from mod_utils import pyren_encode -from mod_utils import clearScreen -from mod_utils import hex_VIN_plus_CRC - -import xml.dom.minidom - -def run( elm, ecu, command, data ): - ''' - MAIN function of scenarium - - Parameters: - elm - refernce to adapter class - ecu - reference to ecu class - command - refernce to the command this scenarium belongs to - data - name of xml file with parameters from scenarium URL - ''' - - clearScreen() - header = '['+command.codeMR+'] '+command.label - - ScmSet = {} - ScmParam = {} - - def get_message( msg ): - if msg in list(ScmParam.keys()): - value = ScmParam[msg] - else: - value = msg - if value.isdigit() and value in list(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 list(mod_globals.language_dict.keys()): - value = pyren_encode( mod_globals.language_dict[id] ) - return value - - - # - # Data file parsing - # - DOMTree = xml.dom.minidom.parse(mod_db_manager.get_file_from_clip(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 - - # - # Get IDs - # - value1, datastr1 = ecu.get_id(ScmParam['ref_C_2180']) - value2, datastr2 = ecu.get_id(ScmParam['ref_C_21FE']) - value3, datastr3 = ecu.get_id(ScmParam['ref_C_22F187']) - value4, datastr4 = ecu.get_id(ScmParam['ref_C_22F18E']) - - res = ecu.ecudata['idf'] + ':' - if len(value1)==10: res += ( value1 + ',' ) - if len(value2)==10: res += ( value2 + ',' ) - if len(value3)==10: res += ( value3 + ',' ) - if len(value4)==10: res += ( value4 + ',' ) - if res.endswith(','): res = res[:-1] - - print('## This info intended to be used as a value of --ref parameter of acf.py ##') - print() - print( res ) - print() - - ch = input('Press ENTER to continue') - diff --git a/pyren3/scen_ecri_calinj1.py b/pyren3/scen_ecri_calinj1.py deleted file mode 100755 index 2f584b9..0000000 --- a/pyren3/scen_ecri_calinj1.py +++ /dev/null @@ -1,252 +0,0 @@ -#!/usr/bin/env python3 -''' -Scenarium usage example - -Name of this script should be exactly the same as in scenaruim URL but with '.py' extension - -URL - scm:scen_ecri_calinj1#scen_ecri_calinj1_xxxxx.xml - -'run' procedure will be executed by pyren script - -''' - -import os -import sys -import re -import time -import string -import mod_globals -import mod_utils -import mod_ecu -import mod_db_manager -from mod_utils import pyren_encode -from mod_utils import clearScreen -from mod_utils import ASCIITOHEX -from mod_utils import StringToIntToHex -import xml.dom.minidom - -def run( elm, ecu, command, data ): - ''' - MAIN function of scenarium - - Parameters: - elm - refernce to adapter class - ecu - reference to ecu class - command - refernce to the command this scenarium belongs to - data - name of xml file with parameters from scenarium URL - ''' - - clearScreen() - header = '['+command.codeMR+'] '+command.label - - ScmSet = {} - ScmParam = {} - - def get_message( msg ): - if msg in list(ScmParam.keys()): - value = ScmParam[msg] - else: - value = msg - if value.isdigit() and value in list(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 list(mod_globals.language_dict.keys()): - value = pyren_encode( mod_globals.language_dict[id] ) - return value - - - # - # Data file parsing - # - DOMTree = xml.dom.minidom.parse(mod_db_manager.get_file_from_clip(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(mod_globals.language_dict[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 - - # - # Important information - # - clearScreen() - value1, datastr1 = ecu.get_id(ScmParam['Injecteur1']) - value2, datastr2 = ecu.get_id(ScmParam['Injecteur2']) - value3, datastr3 = ecu.get_id(ScmParam['Injecteur3']) - value4, datastr4 = ecu.get_id(ScmParam['Injecteur4']) - print(pyren_encode(header)) - print(get_message('TexteTitre')) - print('*'*80) - print(pyren_encode(datastr1)) - print(pyren_encode(datastr2)) - print(pyren_encode(datastr3)) - print(pyren_encode(datastr4)) - print('*'*80) - - ch = input('Are you ready to change the Injector Codes? :') - while (ch.lower() !='y') and (ch.lower() !='n'): - ch = input('Are you ready to change the Injector Codes? :') - if ch.lower()!='y': return - - # - # INFO - # - - clearScreen() - value1, datastr1 = ecu.get_id(ScmParam['Injecteur1']) - value2, datastr2 = ecu.get_id(ScmParam['Injecteur2']) - value3, datastr3 = ecu.get_id(ScmParam['Injecteur3']) - value4, datastr4 = ecu.get_id(ScmParam['Injecteur4']) - print(pyren_encode(header)) - print('*'*80) - print(pyren_encode(datastr1)) - print(pyren_encode(datastr2)) - print(pyren_encode(datastr3)) - print(pyren_encode(datastr4)) - print('*'*80) - print(pyren_encode('Permitted Characters'),get_message('PermittedCharacters')) - print('*'*80) - - # - # Receive data length and format from scenario - # - - nbCC = ScmParam['nbCaractereCode'] - nbCC = int(nbCC) - if nbCC !=6 and nbCC !=7 and nbCC !=16: - ch = input('Error nbCaractereCode in scenario xml') - return - isHEX = ScmParam['FormatHexadecimal'] - isHEX = int(isHEX) - if isHEX != 0 and isHEX != 1: - ch = input('Error FormatHexadecimal in scenario xml') - return - prmCHAR = ScmParam['PermittedCharacters'] - if len(prmCHAR) << 16 and len(prmCHAR) >> 33: - ch = input('Error PermittedCharacters in scenario xml') - return - - # - # Get IMA from input - # - - - ch1 = input(get_message('dat_Cylindre1')+': ').upper() - while not (all (c in prmCHAR for c in ch1.upper()) and (len(ch1)==nbCC)): - ch1 = input(get_message('dat_Cylindre1')+': ').upper() - ch2 = input(get_message('dat_Cylindre2')+': ').upper() - while not (all (c in prmCHAR for c in ch2.upper()) and (len(ch2)==nbCC)): - ch2 = input(get_message('dat_Cylindre2')+': ').upper() - ch3 = input(get_message('dat_Cylindre3')+': ').upper() - while not (all (c in prmCHAR for c in ch3.upper()) and (len(ch3)==nbCC)): - ch3 = input(get_message('dat_Cylindre3')+': ').upper() - ch4 = input(get_message('dat_Cylindre4')+': ').upper() - while not (all (c in prmCHAR for c in ch4.upper()) and (len(ch4)==nbCC)): - ch4 = input(get_message('dat_Cylindre4')+': ').upper() - - # - # Check all data format of input - # - - chk = ( ch1 + ch2 + ch3 + ch4 ) - - if isHEX == 1 and not (all (c in prmCHAR for c in chk.upper()) and (len(chk) == nbCC * 4)): - print('*'*80) - ch = input('Hexdata check failed. Press ENTER to exit') - return - elif isHEX == 0 and not (all (c in prmCHAR for c in chk.upper()) and (len(chk) == nbCC * 4)) : - print('*'*80) - ch = input('ASCII check failed. Press ENTER to exit') - return - else: - print('*'*80) - ch = input('All checks passed successfull. Press ENTER to continue') - - - # - # If all checks are successful script prepares the data according to their type - # - - if isHEX == 1: - inj_code = ( ch1 + ch2 + ch3 + ch4 ).upper() - elif isHEX == 0: - inj_code = ASCIITOHEX ( ch1 + ch2 + ch3 + ch4 ).upper() - else: - print('*'*80) - ch = input('!!!!!!!!There is a bug somwhere in the scenario, operation aborted!!!!!!!!!') - return - - # - # print old and new data - # - - clearScreen() - print('*'*80) - print(pyren_encode('Old injector codes')) - print(pyren_encode(datastr1)) - print(pyren_encode(datastr2)) - print(pyren_encode(datastr3)) - print(pyren_encode(datastr4)) - print('*'*80) - print(pyren_encode('New injector codes')) - print(get_message('dat_Cylindre1'),pyren_encode(':'),pyren_encode(ch1)) - print(get_message('dat_Cylindre2'),pyren_encode(':'),pyren_encode(ch2)) - print(get_message('dat_Cylindre3'),pyren_encode(':'),pyren_encode(ch3)) - print(get_message('dat_Cylindre4'),pyren_encode(':'),pyren_encode(ch4)) - print('*'*80) - print(pyren_encode('Permitted Characters'),get_message('PermittedCharacters')) - print('*'*80) - - - ch = input('Start injectors writing? YES/QUIT>') - while (ch.upper()!='YES') and (ch.upper()!='QUIT'): - ch = input('Start injectors codes writing? YES/QUIT>') - if ch.upper()!='YES': - return - - # - # Write Injector Codes - # - - clearScreen() - cmd = ecu.get_ref_cmd(get_message('EcritureCodeInjecteur')) - print('*'*80) - responce = ecu.run_cmd(ScmParam['EcritureCodeInjecteur'],inj_code) - value5, datastr5 = ecu.get_id(ScmParam['Injecteur1']) - value6, datastr6 = ecu.get_id(ScmParam['Injecteur2']) - value7, datastr7 = ecu.get_id(ScmParam['Injecteur3']) - value8, datastr8 = ecu.get_id(ScmParam['Injecteur4']) - print('*'*80) - print(pyren_encode('Old injector codes')) - print(pyren_encode(datastr1)) - print(pyren_encode(datastr2)) - print(pyren_encode(datastr3)) - print(pyren_encode(datastr4)) - print('*'*80) - print(pyren_encode('New injector codes')) - print(pyren_encode(datastr5)) - print(pyren_encode(datastr6)) - print(pyren_encode(datastr7)) - print(pyren_encode(datastr8)) - print('*'*80) - - ch = input('Press ENTER to exit') - return diff --git a/pyren3/scen_ecri_codevin.py b/pyren3/scen_ecri_codevin.py deleted file mode 100755 index 6fdce3f..0000000 --- a/pyren3/scen_ecri_codevin.py +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/env python3 -''' -Scenarium usage example - -Name of this script should be exactly the same as in scenaruim URL but with '.py' extension - -URL - scm:scen_ecri_codevin#scen_ecri_codevin_xxxxx.xml - -'run' procedure will be executed by pyren script - -''' - -import os -import sys -import re -import time - -import mod_globals -import mod_utils -import mod_ecu -import mod_db_manager -from mod_utils import pyren_encode -from mod_utils import clearScreen -from mod_utils import hex_VIN_plus_CRC - -import xml.dom.minidom - -def run( elm, ecu, command, data ): - ''' - MAIN function of scenarium - - Parameters: - elm - refernce to adapter class - ecu - reference to ecu class - command - refernce to the command this scenarium belongs to - data - name of xml file with parameters from scenarium URL - ''' - - clearScreen() - header = '['+command.codeMR+'] '+command.label - - ScmSet = {} - ScmParam = {} - - def get_message( msg ): - if msg in list(ScmParam.keys()): - value = ScmParam[msg] - else: - value = msg - if value.isdigit() and value in list(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 list(mod_globals.language_dict.keys()): - value = pyren_encode( mod_globals.language_dict[id] ) - return value - - - # - # Data file parsing - # - DOMTree = xml.dom.minidom.parse(mod_db_manager.get_file_from_clip(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(mod_globals.language_dict[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 - - # - # Important information - # - clearScreen() - value1, datastr1 = ecu.get_id(ScmParam['identVIN']) - print(pyren_encode(header)) - print() - print(get_message('TextTitre')) - print() - print(get_message('MessageBox3')) - print() - print('*'*80) - print() - print(pyren_encode(datastr1)) - print() - print('*'*80) - ch = input('Are you ready to change the VIN? :') - if ch.lower()!='yes': return - - # - # Enter new VIN - # - clearScreen() - print(pyren_encode(header)) - print() - print(get_message('TextTitre')) - print() - print('*'*80) - print() - ch = input(get_message('STextTitre1')+': ').upper() - - while not (len(ch)==17 and ('I' not in ch) and ('O' not in ch)): - ch = input(get_message('STextTitre2')+': ').upper() - - cmd = ecu.get_ref_cmd(get_message('ConfigurationName')) - - vin_crc = hex_VIN_plus_CRC( ch ) - - print() - ch = input('Are you ready to change the VIN? :') - if ch.lower()!='yes': return - - # - # Change VIN - # - responce = ecu.run_cmd(ScmParam['ConfigurationName'],vin_crc) - value1, datastr1 = ecu.get_id(ScmParam['identVIN']) - print() - print('*'*80) - print() - print(pyren_encode(datastr1)) - print() - print('*'*80) - - ch = input('Press ENTER to continue') - diff --git a/pyren3/scen_ecri_counter2.py b/pyren3/scen_ecri_counter2.py deleted file mode 100755 index 7d62f7f..0000000 --- a/pyren3/scen_ecri_counter2.py +++ /dev/null @@ -1,153 +0,0 @@ -#!/usr/bin/env python3 -''' -Scenarium usage example - -Name of this script should be exactly the same as in scenaruim URL but with '.py' extension - -URL - scm:scen_ecri_calinj1#scen_ecri_calinj1_xxxxx.xml - -'run' procedure will be executed by pyren script - -''' - -import os -import sys -import re -import time -import string -import mod_globals -import mod_utils -import mod_ecu -import mod_db_manager -import mod_ecu_mnemonic -from mod_utils import pyren_encode -from mod_utils import clearScreen -import xml.dom.minidom - -def run( elm, ecu, command, data ): - ''' - MAIN function of scenarium - - Parameters: - elm - refernce to adapter class - ecu - reference to ecu class - command - refernce to the command this scenarium belongs to - data - name of xml file with parameters from scenarium URL - ''' - - clearScreen() - header = '['+command.codeMR+'] '+command.label - - ScmSet = {} - ScmParam = {} - - def get_message( msg, encode = 1 ): - if msg in list(ScmParam.keys()): - value = ScmParam[msg] - else: - value = msg - if value.isdigit() and value in list(mod_globals.language_dict.keys()): - if encode: - value = pyren_encode(mod_globals.language_dict[value]) - else: - value = mod_globals.language_dict[value] - return value - - def get_message_by_id( id, encode = 1 ): - if id.isdigit() and id in list(mod_globals.language_dict.keys()): - if encode: - value = pyren_encode(mod_globals.language_dict[id]) - else: - value = mod_globals.language_dict[id] - return value - - # - # Data file parsing - # - DOMTree = xml.dom.minidom.parse(mod_db_manager.get_file_from_clip(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: - if len(Set.attributes) != 1: - setname = pyren_encode(mod_globals.language_dict[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 - - confirm = get_message_by_id('19800') - missing_data_message = get_message_by_id('882') - title = get_message('Title') - messageInfo = get_message('Message1') - succesMessage = get_message('CommandFinished') - failMessage = get_message('CommandImpossible') - - mnemonics = ecu.get_ref_id(ScmParam['default']).mnemolist - - if mnemonics[0][-2:] > mnemonics[1][-2:]: - mnemo1 = mnemonics[1] - mnemo2 = mnemonics[0] - else: - mnemo1 = mnemonics[0] - mnemo2 = mnemonics[1] - - byteFrom = int(mnemo1[-2:]) - byteTo = int(re.findall('\d+',mnemo2)[1]) - byteCount = byteTo - byteFrom - 1 - resetBytes = byteCount * '00' - params_to_send_length = int(mnemo2[-2:]) - - mnemo1Data = mod_ecu_mnemonic.get_mnemonic(ecu.Mnemonics[mnemo1], ecu.Services, elm, 1) - mnemo2Data = mod_ecu_mnemonic.get_mnemonic(ecu.Mnemonics[mnemo2], ecu.Services, elm, 1) - - paramsToSend = mnemo1Data + resetBytes + mnemo2Data - - fap_command_sids = ecu.get_ref_cmd(ScmParam['Cmde1']).serviceID - if len(fap_command_sids) and not mod_globals.opt_demo: - for sid in fap_command_sids: - if len(ecu.Services[sid].params): - if (len(ecu.Services[sid].startReq + paramsToSend)//2 != params_to_send_length): - input(missing_data_message + "\n\nPress ENTER to exit") - return - - clearScreen() - - print(title) - print('*'*80) - print(messageInfo) - print('*'*80) - print() - ch = input(confirm + ' : ') - while (ch.upper()!='YES') and (ch.upper()!='NO'): - ch = input(confirm + ' : ') - if ch.upper()!='YES': - return - - clearScreen() - - print() - response = ecu.run_cmd(ScmParam['Cmde1'], paramsToSend) - print() - - if 'NR' in response: - print(failMessage) - else: - print(succesMessage) - - print() - ch = input("Press ENTER to exit") - return \ No newline at end of file diff --git a/pyren3/scen_ecri_fap5.py b/pyren3/scen_ecri_fap5.py deleted file mode 100755 index f8a0052..0000000 --- a/pyren3/scen_ecri_fap5.py +++ /dev/null @@ -1,271 +0,0 @@ -#!/usr/bin/env python3 -''' -Scenarium usage example - -Name of this script should be exactly the same as in scenaruim URL but with '.py' extension - -URL - scm:scen_ecri_fap5#scen_ecri_fap5_xxxxx.xml - -'run' procedure will be executed by pyren script - -''' - -import os -import sys -import re -import time - -import mod_globals -import mod_utils -import mod_ecu -import mod_db_manager -from mod_utils import pyren_encode -from mod_utils import clearScreen -from mod_utils import KBHit - -import xml.dom.minidom - -#def get_message( value ): -# if value.isdigit() and value in mod_globals.language_dict.keys(): -# value = pyren_encode( mod_globals.language_dict[value] ) -# print value - -def run( elm, ecu, command, data ): - ''' - MAIN function of scenarium - - Parameters: - elm - refernce to adapter class - ecu - reference to ecu class - command - refernce to the command this scenarium belongs to - data - name of xml file with parameters from scenarium URL - ''' - - clearScreen() - header = '['+command.codeMR+'] '+command.label - - ScmSet = {} - ScmParam = {} - - def get_message( msg ): - if msg in list(ScmParam.keys()): - value = ScmParam[msg] - else: - value = msg - if value.isdigit() and value in list(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 list(mod_globals.language_dict.keys()): - value = pyren_encode( mod_globals.language_dict[id] ) - return value - - - # - # Data file parsing - # - - DOMTree = xml.dom.minidom.parse(mod_db_manager.get_file_from_clip(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(mod_globals.language_dict[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 - - # - # Renew info about min/max values - # - GenPow = ecu.get_ref_pr(ScmParam['Param7']) #Generator power - GenPow.min = ScmParam['AltValueMin'] - GenPow.max = ScmParam['AltValueMax'] - - PartMass = ecu.get_ref_pr(ScmParam['Param6']) #Particle mass - PartMass.min = ScmParam['s_masse_suie_actif'] - PartMass.max = ScmParam['s_masse_suie_max'] - - # - # Important information - # - clearScreen() - print(pyren_encode(header)) - print() - print(get_message('SCMTitle')) - print() - print(get_message('Informations')) - print() - print('*'*80) - print() - print(get_message_by_id('1144')) - print() - print(get_message_by_id('1145')) - print() - print(get_message_by_id('1146')) - print() - ch = input('Press ENTER to continue') - clearScreen() - print(pyren_encode(header)) - print() - print(get_message('SCMTitle')) - print() - print('*'*80) - print() - print(get_message_by_id('1147')) - print() - print(get_message_by_id('1148')) - print() - ch = input('Press ENTER to continue') - - # - # Check conditions - # - State1_ref = ecu.get_ref_st(ScmParam['State1']) #Engine state - value7, datastr7 = ecu.get_st(ScmParam['State1']) - kb = KBHit() - while pyren_encode(value7) != pyren_encode( mod_globals.language_dict[ScmParam['TOURNANT']]): - value7, datastr7 = ecu.get_st(ScmParam['State1']) - value5, datastr5 = ecu.get_pr(ScmParam['Param6']) - value6, datastr6 = ecu.get_pr(ScmParam['Param7']) - clearScreen() - print(pyren_encode(header)) - print() - print(get_message('SCMTitle')) - print() - print('\tCHECK CONDITIONS') - print() - print('*'*90) - print(pyren_encode(datastr7)) - print(pyren_encode(datastr5)) - print(pyren_encode(datastr6)) - print('*'*90) - print(get_message_by_id('1149')) - print() - print('Strat the engine and press ENTER to continue') - print('Q to exit or A to continue anyway') - if kb.kbhit(): - c = kb.getch() - if len(c)!=1: continue - if c=='q' or c=='Q': - kb.set_normal_term() - return - elif c=='a' or c=='A': - kb.set_normal_term() - break - time.sleep( 0.2 ) - - # - # Ask permission to start - # - clearScreen() - print(pyren_encode(header)) - print() - ch = input('Are you ready to start regeneration? :') - if ch.lower()!='yes': return - - # - # Start regeneration - # - responce = ecu.run_cmd(ScmParam['Cmde1']) - - # - # Main cycle - # - begin_time = time.time() - Phase_state = ecu.get_ref_st(ScmParam['State2']) - Result_state = ecu.get_ref_st(ScmParam['State3']) - kb = KBHit() - pfe = 0 - while( 1 ): - # get all values before showing them for avoid screen flickering - value0, datastr0 = ecu.get_pr(ScmParam['Param1']) - value1, datastr1 = ecu.get_pr(ScmParam['Param2']) - value2, datastr2 = ecu.get_pr(ScmParam['Param3']) - value3, datastr3 = ecu.get_pr(ScmParam['Param4']) - value4, datastr4 = ecu.get_pr(ScmParam['Param5']) - value5, datastr5 = ecu.get_pr(ScmParam['Param6']) - value6, datastr6 = ecu.get_pr(ScmParam['Param7']) - value7, datastr7 = ecu.get_st(ScmParam['State1']) - value8, datastr8 = ecu.get_st(ScmParam['State2']) # Phase - value9, datastr9 = ecu.get_st(ScmParam['State3']) # Result status - valuea, datastra = ecu.get_st(ScmParam['State4']) - - #test - #value8 = 6 - #value9 = 3 - - current_time = time.time() - elapsed = int(current_time-begin_time) - minutes, seconds = divmod(elapsed, 60) - hours, minutes = divmod(minutes, 60) - - # - # Check phase - # - etat = pyren_encode(value8) - if etat == get_message('ETAT1'): phase = get_message('Phase1'); pfe = 0 - elif etat == get_message('ETAT2'): phase = get_message('Phase2'); pfe = 0 - elif etat == get_message('ETAT3'): phase = get_message('Phase3'); pfe = 0 - elif etat == get_message('ETAT4'): phase = get_message('Phase4'); pfe = 0 - elif etat == get_message('ETAT5'): phase = get_message('Phase5'); pfe = 1 - elif etat == get_message('ETAT6'): phase = get_message('Phase6'); pfe = 2 - else: phase = etat - - # - # Check result - # - rescode = pyren_encode(value9) - result = pyren_encode( mod_globals.language_dict[ScmSet[rescode]]) - - clearScreen() - print(pyren_encode(header)) - print('\tTime - ',"{hours:02d}:{minutes:02d}:{seconds:02d}".format(**vars())) - print('\tPhase - ', phase) - #print '\tResult - ', result - print('*'*90) - print(pyren_encode(datastr0)) - print(pyren_encode(datastr1)) - print(pyren_encode(datastr2)) - print(pyren_encode(datastr3)) - print(pyren_encode(datastr4)) - print(pyren_encode(datastr5)) - print(pyren_encode(datastr6)) - print(pyren_encode(datastr7)) - print(pyren_encode(datastr8)) - print(pyren_encode(datastr9)) - print(pyren_encode(datastra)) - print('*'*90) - if pfe: break - print('Press Q to emergency exit') - if kb.kbhit(): - c = kb.getch() - if len(c)!=1: continue - if c=='q' or c=='Q': - kb.set_normal_term() - responce = ecu.run_cmd(ScmParam['Cmde2']) - break - time.sleep( 0.2 ) - - if pfe: - print('\tPhase - ', phase) - print('\tResult - ', result) - print('*'*90) - - ch = input('Press ENTER to exit') - diff --git a/pyren3/scen_ecri_generique2.py b/pyren3/scen_ecri_generique2.py deleted file mode 100755 index f6d5ff5..0000000 --- a/pyren3/scen_ecri_generique2.py +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/env python3 -''' - -Version: 180402 -This scenarium may enable/disable AndroidAuto and CarPlay - -Name of this script should be exactly the same as in scenaruim URL but with '.py' extension - -URL - scm:SCEN_ECRI_GENERIQUE2#SCEN_ECRI_GENERIQUE2_.xml - -'run' procedure will be executed by pyren script - -''' - -import os -import sys -import re -import time - -import mod_globals -import mod_utils -import mod_ecu -from mod_utils import pyren_encode -from mod_utils import clearScreen - -import xml.dom.minidom - -def run( elm, ecu, command, data ): - ''' - MAIN function of scenarium - - Parameters: - elm - refernce to adapter class - ecu - reference to ecu class - command - refernce to the command this scenarium belongs to - data - name of xml file with parameters from scenarium URL - ''' - - clearScreen() - header = '['+command.codeMR+'] '+command.label - - # - # Important information - # - clearScreen() - print(pyren_encode(header)) - print() - print('This scenarium may enable/disable AndroidAuto and CarPlay') - print() - print('*'*50) - - # - # check if this ECU is supported - # - eid = data[-9:-4] - if eid not in ['11300']: - print('\n\nThis ECU is unsupported !!!!\n\n') - ch = input('Press ENTER to exit') - return - - # - # read current value - # - print('Reading current value') - rsp = elm.request("222130",positive='622130', cache=False) - rsp = rsp.replace(' ','')[:20] - print("Done:", rsp) - if not rsp.startswith('622130'): - print('Got WRONG RESPONSE !!!') - ch = input('Press ENTER to exit') - return - hexVal = int(rsp[8:9],16) - print('*'*50) - if hexVal & 0x2: - print('AndroidAuto : ON') - else: - print('AndroidAuto : OFF') - if hexVal & 0x4: - print('CarPlay : ON') - else: - print('CarPlay : OFF') - print('*'*50) - - # - # changing value - # - ch = input ('What do you want? :') - if ch.lower () != 'on' and ch.lower () != 'off': return - - if ch.lower () == 'off': - print('Swithing OFF !!!') - hexVal = hexVal & 0x9 - elif ch.lower () == 'on': - print('Swithing ON !!!') - hexVal = hexVal | 0x6 - newcmd = '2E2130'+rsp[6:8]+hex(hexVal)[-1:].upper()+rsp[9:] - - # - # writing value - # - print('New :',newcmd) - print('We are ready to change') - ch = input ('Do you agree? :') - if ch.lower () != 'yes': return - rsp = elm.request(newcmd, positive='6E2130', cache=False) - if not rsp.upper().replace(' ','').startswith('6E2130'): - print('RSP :',rsp) - print('Got ERROR!!!') - ch = input('Press ENTER to exit') - return - - # - # wait a bit - # - time.sleep(2) - - # - # read new value - # - print('Reading new value') - rsp = elm.request ("222130", positive='622130', cache=False) - rsp = rsp.replace (' ', '')[:20] - print("Done:", rsp) - if not rsp.startswith ('622130'): - print('Got WRONG RESPONSE !!!') - ch = input ('Press ENTER to exit') - return - hexVal = int (rsp[8:9], 16) - print('*' * 50) - if hexVal & 0x2: - print('AndroidAuto : ON') - else: - print('AndroidAuto : OFF') - if hexVal & 0x4: - print('CarPlay : ON') - else: - print('CarPlay : OFF') - print('*' * 50) - - print('\n\n\t DONE') - print('\n\n You have to reset the device manually ') - print(' by long press on power button\n\n') - ch = input('Press ENTER to continue') - diff --git a/pyren3/scen_ecri_initpente.py b/pyren3/scen_ecri_initpente.py deleted file mode 100755 index 6f28f48..0000000 --- a/pyren3/scen_ecri_initpente.py +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys -import re -import time -import string -import mod_globals -import mod_utils -import mod_ecu -import mod_db_manager -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 list(ScmParam.keys()): - value = ScmParam[msg] - else: - value = msg - if value.isdigit() and value in list(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 list(mod_globals.language_dict.keys()): - value = pyren_encode(mod_globals.language_dict[id]) - return value - - DOMTree = xml.dom.minidom.parse(mod_db_manager.get_file_from_clip(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 - - kb = KBHit() - - mainText = get_message('TexteTitre') - important = get_message('TexteConsigne') - tilt = get_message('TexteValeurInclinaison') - degreeSymbol = get_message('TexteDegre') - value2, datastr2 = ecu.get_pr(ScmParam['ParametreInclinaison']) - - clearScreen() - print(pyren_encode(header)) - print(mainText) - print('*' * 80) - print() - print(important) - print() - - ch = input('Do you want to continue? ') - while (ch.upper() != 'YES') and (ch.upper() != 'NO'): - ch = input('Do you want to continue? ') - if ch.upper() != 'YES': - return - - clearScreen() - cmd = ecu.get_ref_cmd(get_message('Commande1')) - resVal = ScmParam['ParametreCommande1'] - print('*' * 80) - responce = ecu.run_cmd(ScmParam['Commande1'], resVal) - print('*' * 80) - if 'NR' in responce: - print(get_message('TexteProcedureInterompue')) - else: - print(get_message('TexteInitialisationEffectuee')) - print() - print(tilt, pyren_encode(':'), value2, degreeSymbol) - print() - - ch = input('Press ENTER to exit') - return diff --git a/pyren3/scen_ecri_paraminj1.py b/pyren3/scen_ecri_paraminj1.py deleted file mode 100755 index f0c8cff..0000000 --- a/pyren3/scen_ecri_paraminj1.py +++ /dev/null @@ -1,653 +0,0 @@ -#!/usr/bin/env python3 -''' -Scenarium usage example - -Name of this script should be exactly the same as in scenaruim URL but with '.py' extension - -URL - scm:scen_ecri_calinj1#scen_ecri_calinj1_xxxxx.xml - -'run' procedure will be executed by pyren script - -''' - -import os -import sys -import re -import time -import string -import mod_globals -import mod_utils -import mod_ecu -import mod_db_manager -from mod_utils import pyren_encode -from mod_utils import clearScreen -from mod_utils import ASCIITOHEX -from mod_utils import StringToIntToHex -from mod_utils import Choice -from collections import OrderedDict -import xml.dom.minidom -import xml.etree.cElementTree as et - -class ecus: - - vdiag = "" - buttons = {} - ncalib = "" - - def __init__(self, vd, nc, bt): - self.vdiag = vd - self.ncalib = nc - self.buttons = bt - -def run( elm, ecu, command, data ): - ''' - MAIN function of scenarium - - Parameters: - elm - refernce to adapter class - ecu - reference to ecu class - command - refernce to the command this scenarium belongs to - data - name of xml file with parameters from scenarium URL - ''' - - clearScreen() - header = '['+command.codeMR+'] '+command.label - - ScmSet = {} - ScmParam = OrderedDict() - ecusList = [] - correctEcu = '' - vdiagExists = False - ncalibExists = False - - def get_message( msg, encode = 1 ): - if msg in list(ScmParam.keys()): - value = ScmParam[msg] - else: - value = msg - if value.isdigit() and value in list(mod_globals.language_dict.keys()): - if encode: - value = pyren_encode(mod_globals.language_dict[value]) - else: - value = mod_globals.language_dict[value] - return value - - def get_message_by_id( id, encode = 1 ): - if id.isdigit() and id in list(mod_globals.language_dict.keys()): - if encode: - value = pyren_encode(mod_globals.language_dict[id]) - else: - value = mod_globals.language_dict[id] - return value - - # - # Data file parsing - # - DOMTree = xml.dom.minidom.parse(mod_db_manager.get_file_from_clip(data)) - ScmRoom = DOMTree.documentElement - - root = et.parse(mod_db_manager.get_file_from_clip(data)).getroot() - - 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: - if len(Set.attributes) != 1: - setname = pyren_encode(mod_globals.language_dict[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 - - if "VDiag" in list(ScmParam.keys()): - vdiagExists = True - if "Ncalib" in list(ScmParam.keys()): - ncalibExists = True - - # Get nested buttons with VDiag and Ncalib - for vDiag in root: - if vDiag.attrib["name"] == "VDiag": - if len(list(vDiag.keys())) == 1: - for vDiagName in vDiag: - if vDiagName: - for vDiagButtons in vDiagName: - buttons = OrderedDict() - if vDiagButtons.attrib["name"] == "Ncalib": - for ncalibName in vDiagButtons: - for ncalibButtons in ncalibName: - if ncalibButtons.attrib["name"] == "Buttons": - for ncalibButton in ncalibButtons: - buttons[ncalibButton.attrib["name"]] = ncalibButton.attrib["value"] - ecusList.append(ecus(vDiagName.attrib["name"],ncalibName.attrib["name"], buttons)) - buttons = OrderedDict() - else: - if vDiagButtons.attrib["name"] == "Buttons": - for vDiagButton in vDiagButtons: - buttons[vDiagButton.attrib["name"]] = vDiagButton.attrib["value"] - ecusList.append(ecus(vDiagName.attrib["name"], '', buttons)) - -# Get plain buttons with VDiag - if vdiagExists: - if not ncalibExists: - vdiag = '' - buttons = OrderedDict() - for name in list(ScmParam.keys()): - if name.startswith("InjectorsButton"): - if buttons: - ecusList.append(ecus(vdiag, '', buttons)) - buttons = OrderedDict() - vdiag = name[-2:] - buttons[name[:-2]] = ScmParam[name] - if vdiag: - if name.endswith("Button" + vdiag): - buttons[name[:-2]] = ScmParam[name] - ecusList.append(ecus(vdiag, '', buttons)) - else: #Get buttons without VDiag - buttons = OrderedDict() - found = False - for name in list(ScmParam.keys()): - if name == "InjectorsButton": - buttons[name] = ScmParam[name] - found = True - if found: - if name.endswith("Button"): - buttons[name] = ScmParam[name] - else: - found = False - break - ecusList.append(ecus('', '', buttons)) - -# Get correct buttons set - if vdiagExists: - value1, datastr1 = ecu.get_id(ScmParam['VDiag']) - for ecuSet in ecusList: - if ecuSet.vdiag == value1.upper(): - if ncalibExists: - if ecuSet.ncalib: - value2, datastr2 = ecu.get_id(ScmParam['Ncalib']) - if ecuSet.ncalib == value2.upper(): - correctEcu = ecuSet - break - elif ecuSet.ncalib == "Other": - correctEcu = ecuSet - break - else: - correctEcu = ecuSet - break - else: - correctEcu = ecuSet - break - else: - correctEcu = ecusList[0] - - if not correctEcu and mod_globals.opt_demo: - correctEcu = ecusList[0] - - if vdiagExists: - if not correctEcu: - print('*'*80) - ch = input('Unknown diagnostic version. Press ENTER to exit') - return - - #Prepare buttons - buttons = OrderedDict() - - for bt in list(correctEcu.buttons.keys()): - if bt == 'InjectorsButton': - if str(correctEcu.buttons[bt]) == 'true': - buttons[1] = get_message("Injectors", 0) - if bt == 'EGRValveButton': - if str(correctEcu.buttons[bt]) == 'true': - buttons[2] = get_message("EGR_VALVE", 0) - if bt == 'InletFlapButton': - if str(correctEcu.buttons[bt]) == 'true': - buttons[3] = get_message("INLET_FLAP", 0) - if bt.startswith("Button"): - if str(correctEcu.buttons[bt]) == 'true': - buttons[int(bt.strip('Button'))] = get_message(bt[:-6] + "Text", 0) - buttons["loadDump"] = get_message_by_id('19802', 0) - buttons["exit"] = '' - - #Get commands - commands = {} - - for child in root: - if child.attrib["name"] == "Commands": - if len(list(child.keys())) == 1: - for param in child: - serviceIDs = ecu.get_ref_cmd(param.attrib["value"]).serviceID - startReq = "" - for sid in serviceIDs: - if ecu.Services[sid].params: - startReq = ecu.Services[sid].startReq - break - commands[param.attrib["name"]] = {"command": param.attrib["value"], "startReq": startReq} - - #Get identifications - identsList = OrderedDict() - identsRangeKeys = OrderedDict() - - for param in list(ScmParam.keys()): - if param.startswith('Idents') and param.endswith('Begin'): - key = param[6:-5] - begin = int(ScmParam['Idents'+key+'Begin']) - end = int(ScmParam['Idents'+key+'End']) - try: - ecu.get_ref_id(ScmParam['Ident' + str(begin)]).mnemolist[0] #10529 ID114 doesn't exist - except: - continue - else: - for idnum in range(begin ,end + 1): - identsList['D'+str(idnum)] = ScmParam['Ident'+str(idnum)] - if len(ecu.get_ref_id(ScmParam['Ident' + str(idnum)]).mnemolist) > 1: - mnemonicsLen = [int(ecu.Mnemonics[bitsLen].bitsLength) for bitsLen in ecu.get_ref_id(ScmParam['Ident' + str(idnum)]).mnemolist] - ecu.get_ref_id(ScmParam['Ident' + str(idnum)]).mnemolist = [ecu.get_ref_id(ScmParam['Ident' + str(idnum)]).mnemolist[mnemonicsLen.index(max(mnemonicsLen))]] - frame = ecu.Mnemonics[ecu.get_ref_id(identsList['D'+str(begin)]).mnemolist[0]].request - identsRangeKeys[key] = {"begin": begin, "end": end, "frame": frame} - - def getValuesToChange(resetItem): - params = {} - for child in root: - if child.attrib["name"] == resetItem: - if len(list(child.keys())) == 1: - for param in child: - params[param.attrib["name"].replace("D0", "D")] = param.attrib["value"] - return params - - def takesParams(request): - for cmd in list(commands.values()): - if cmd['startReq'] == request: - commandToRun = cmd['command'] - return commandToRun - - def getValuesFromEcu(params): - paramToSend = "" - commandToRun = "" - requestToFindInCommandsRequests = "" - backupDict = {} - - try: - idKeyToFindInRange = int((list(params.keys())[0]).replace("D","")) - except: - return commandToRun, paramToSend - else: - for rangeK in list(identsRangeKeys.keys()): - if identsRangeKeys[rangeK]['begin'] <= idKeyToFindInRange <= identsRangeKeys[rangeK]['end']: - requestToFindInCommandsRequests = "3B" + identsRangeKeys[rangeK]['frame'][-2:] - isTakingParams = takesParams(requestToFindInCommandsRequests) - if isTakingParams: - for k,v in params.items(): - backupDict[k] = ecu.get_id(identsList[k], 1) - if v in list(identsList.keys()): - identsList[k] = ecu.get_id(identsList[v], 1) - else: - identsList[k] = v - for idKey in range(identsRangeKeys[rangeK]['begin'], identsRangeKeys[rangeK]['end'] + 1): - if identsList["D" + str(idKey)].startswith("ID"): - identsList["D" + str(idKey)] = ecu.get_id(identsList["D" + str(idKey)], 1) - backupDict["D" + str(idKey)] = identsList["D" + str(idKey)] - paramToSend += identsList["D" + str(idKey)] - commandToRun = isTakingParams - break - - makeDump(commandToRun, backupDict) - return commandToRun, paramToSend - - confirm = get_message_by_id('19800') - successMessage = get_message('Message32') - failMessage = get_message('MessageNACK') - mainText = get_message('Title') - inProgressMessage = get_message('CommandInProgressMessage') - - def resetInjetorsData(button, injectorsList): - injectorsInfoMessage = get_message('Message21') - response = "" - clearScreen() - - print(mainText) - print('*'*80) - print(pyren_encode(buttons[button])) - print('*'*80) - print(injectorsInfoMessage) - print('*'*80) - print() - - choice = Choice(list(injectorsList.keys()), "Choose :") - if choice[0]=='': return - - clearScreen() - - print() - response = ecu.run_cmd(injectorsList[choice[0]]) - print() - - if "NR" in response: - print(failMessage) - else: - print(successMessage) - - print() - ch = input('Press ENTER to exit') - - def afterEcuChange(title, button): - params = getValuesToChange(title) - infoMessage = get_message("Message262") - mileageText = get_message_by_id('2110') - mileageUnit = get_message_by_id('16521') - - clearScreen() - print(mainText) - print('*'*80) - print(pyren_encode(buttons[button])) - print('*'*80) - print(infoMessage) - print('*'*80) - print(get_message("MessageBox2")) - print() - ch = input(confirm + ' : ') - if ch.upper()!='YES': - return - mileage = input(mileageText + ' (' + mileageUnit + ')' + ': ') - while not (mileage.isdigit() and 2 <= len(mileage) <= 6 and int(mileage) >= 10): - print(get_message("MessageBox1")) - print() - mileage = input(mileageText + ' (' + mileageUnit + ')' + ': ') - - clearScreen() - - print(mileageText + ': ' + mileage + ' ' + mileageUnit) - print() - ch = input(confirm + ' : ') - while (ch.upper()!='YES') and (ch.upper()!='NO'): - ch = input(confirm + ' : ') - if ch.upper()!='YES': - return - - clearScreen() - - print() - print(inProgressMessage) - - mileage = int(mileage) - - for paramkey in list(params.keys()): - if params[paramkey] == "Mileage": - mnemonics = ecu.get_ref_id(identsList[paramkey]).mnemolist[0] - identValue = ecu.get_id(identsList[paramkey], 1) - if identValue == 'ERROR': - identValue = '00000000' - hexval = "{0:0{1}X}".format(mileage,len(identValue)) - if ecu.Mnemonics[mnemonics].littleEndian == '1': - a = hexval - b = '' - if not len(a) % 2: - for i in range(0,len(a),2): - b = a[i:i+2]+b - hexval = b - params[paramkey] = hexval - - command, paramToSend = getValuesFromEcu(params) - - if "ERROR" in paramToSend: - input("Data downloading went wrong. Aborting.") - return - - clearScreen() - - print() - response = ecu.run_cmd(command,paramToSend) - print() - - if "NR" in response: - print(failMessage) - else: - print(successMessage) - - print() - ch = input('Press ENTER to exit') - - def setGlowPlugsType(title, button): - params = getValuesToChange(title) - currentType = ecu.get_id(identsList[params["IdentToBeDisplayed"].replace("Ident", "D")], 1) - slowTypeValue = get_message('ValueSlowParam') - fastTypeValue = get_message('ValueFastParam') - currentMessage = get_message_by_id('52676') - slowMessage = get_message('Slow') - fastMessage = get_message('Fast') - notDefinedMessage = get_message('NotDefined') - message2 = get_message('Message282') - - typesButtons = OrderedDict() - - typesButtons[get_message('Slow', 0)] = slowTypeValue - typesButtons[get_message('Fast', 0)] = fastTypeValue - typesButtons[''] = "" - - clearScreen() - print(mainText) - print('*'*80) - print(pyren_encode(buttons[button])) - print('*'*80) - print(message2) - print('*'*80) - print() - if currentType == slowTypeValue: - print(currentMessage + ': ' + slowMessage) - elif currentType == fastTypeValue: - print(currentMessage + ': ' + fastMessage) - else: - print(currentMessage + ': ' + notDefinedMessage) - print() - - choice = Choice(list(typesButtons.keys()), "Choose :") - if choice[0]=='': return - - clearScreen() - print() - print(inProgressMessage) - - params[params["IdentToBeDisplayed"].replace("Ident", "D")] = typesButtons[choice[0]] - params.pop("IdentToBeDisplayed") - - command, paramToSend = getValuesFromEcu(params) - - if "ERROR" in paramToSend: - input("Data downloading went wrong. Aborting.") - return - - clearScreen() - - print() - response = ecu.run_cmd(command,paramToSend) - print() - - if "NR" in response: - print(failMessage) - else: - print(successMessage) - - print() - ch = input('Press ENTER to exit') - - def resetValues(title, button, defaultCommand): - paramToSend = "" - commandTakesParams = True - params = getValuesToChange(title) - - clearScreen() - - print(mainText) - print('*'*80) - print(pyren_encode(buttons[button])) - print('*'*80) - if button == 4: - print(get_message_by_id('55662')) - print('*'*80) - if button == 5: - print(get_message_by_id('55663')) - print('*'*80) - print() - ch = input(confirm + ' : ') - while (ch.upper()!='YES') and (ch.upper()!='NO'): - ch = input(confirm + ' : ') - if ch.upper()!='YES': - return - - clearScreen() - print() - print(inProgressMessage) - - command, paramToSend = getValuesFromEcu(params) - - if "ERROR" in paramToSend: - input("Data downloading went wrong. Aborting.") - return - - clearScreen() - - print() - if command: - response = ecu.run_cmd(command,paramToSend) - else: - response = ecu.run_cmd(defaultCommand) - print() - - if "NR" in response: - print(failMessage) - else: - print(successMessage) - - print() - ch = input('Press ENTER to exit') - - def makeDump(cmd, idents): - fileRoot = et.Element("ScmRoot") - fileRoot.text = "\n " - - cmdElement = et.Element("ScmParam", name="Command", value=cmd) - cmdElement.tail = "\n " - fileRoot.insert(1,cmdElement) - - for k in idents: - el = et.Element("ScmParam", name='D'+ '{:0>2}'.format(k[1:]), value=idents[k]) - el.tail = "\n " - fileRoot.insert(1,el) - - tree = et.ElementTree(fileRoot) - tree.write(mod_globals.dumps_dir + ScmParam['FileName']) - - def loadDump(): - clearScreen() - - paramToSend = "" - dumpScmParam = {} - try: - dumpData = open(mod_globals.dumps_dir + ScmParam['FileName'], 'r') - except: - print(get_message_by_id('2194')) - input() - return - - dumpDOMTree = xml.dom.minidom.parse(dumpData) - dumpScmRoot = dumpDOMTree.documentElement - dumpScmParams = dumpScmRoot.getElementsByTagName("ScmParam") - - for Param in dumpScmParams: - name = pyren_encode( Param.getAttribute("name") ) - value = pyren_encode( Param.getAttribute("value") ) - - dumpScmParam[name] = value - - for k in sorted(dumpScmParam): - if k != "Command": - paramToSend += dumpScmParam[k] - - if "ERROR" in paramToSend: - input("Data downloading went wrong. Aborting.") - return - - print('*'*80) - print(get_message_by_id('19802')) - print('*'*80) - print() - - ch = input(confirm + ' : ') - while (ch.upper()!='YES') and (ch.upper()!='NO'): - ch = input(confirm + ' : ') - if ch.upper()!='YES': - return - - clearScreen() - - print() - response = ecu.run_cmd(dumpScmParam['Command'],paramToSend) - print() - - if "NR" in response: - print(failMessage) - else: - print(successMessage) - - print() - ch = input('Press ENTER to exit') - - - functions = OrderedDict() - for cmdKey in list(commands.keys()): - if cmdKey == 'Cmd1': - injectorsDict = OrderedDict() - injectorsDict[get_message('Cylinder1', 0)] = commands['Cmd1']['command'] - injectorsDict[get_message('Cylinder2', 0)] = commands['Cmd2']['command'] - injectorsDict[get_message('Cylinder3', 0)] = commands['Cmd3']['command'] - injectorsDict[get_message('Cylinder4', 0)] = commands['Cmd4']['command'] - injectorsDict[''] = "" - functions[1] = [1, injectorsDict] - if cmdKey == 'Cmd5': - functions[2] = ["EGR_VALVE", 2, commands['Cmd5']['command']] - if cmdKey == 'Cmd6': - functions[3] = ["INLET_FLAP", 3, commands['Cmd6']['command']] - if cmdKey == 'Cmd7': - functions[4] = ["PARTICLE_FILTER", 4, commands['Cmd7']['command']] - functions[5] = ["Button5ChangeData", 5, commands['Cmd7']['command']] - functions[6] = ["Button6ChangeData", 6, commands['Cmd7']['command']] - if cmdKey == 'Cmd9': - functions[8] = ["Button8DisplayData", 8] - - infoMessage = get_message('Message1') - - print(mainText) - print() - print(infoMessage) - print() - - notSupported = [7] - - choice = Choice(list(buttons.values()), "Choose :") - - for key, value in buttons.items(): - if choice[0] =='': return - if value == choice[0]: - if key in notSupported: - ch = input("\nNot Supported yet. Press ENTER to exit") - elif key == 'loadDump': - loadDump() - elif key == 1: - resetInjetorsData(functions[key][0],functions[key][1]) - elif key == 6: - afterEcuChange(functions[key][0],functions[key][1]) - elif key == 8: - setGlowPlugsType(functions[key][0],functions[key][1]) - else: - resetValues(functions[key][0],functions[key][1],functions[key][2]) - return \ No newline at end of file diff --git a/pyren3/scen_ecri_paraminj2.py b/pyren3/scen_ecri_paraminj2.py deleted file mode 100755 index 32602a2..0000000 --- a/pyren3/scen_ecri_paraminj2.py +++ /dev/null @@ -1,589 +0,0 @@ -#!/usr/bin/env python3 -''' -Scenarium usage example - -Name of this script should be exactly the same as in scenaruim URL but with '.py' extension - -URL - scm:scen_ecri_calinj1#scen_ecri_calinj1_xxxxx.xml - -'run' procedure will be executed by pyren script - -''' - -import os -import sys -import re -import time -import string -import mod_globals -import mod_utils -import mod_ecu -import mod_db_manager -from mod_utils import pyren_encode -from mod_utils import clearScreen -from mod_utils import ASCIITOHEX -from mod_utils import StringToIntToHex -from mod_utils import Choice -from collections import OrderedDict -import xml.dom.minidom -import xml.etree.cElementTree as et - -class ecus: - - vdiag = "" - buttons = {} - ncalib = "" - - def __init__(self, vd, nc, bt): - self.vdiag = vd - self.ncalib = nc - self.buttons = bt - -def run( elm, ecu, command, data ): - ''' - MAIN function of scenarium - - Parameters: - elm - refernce to adapter class - ecu - reference to ecu class - command - refernce to the command this scenarium belongs to - data - name of xml file with parameters from scenarium URL - ''' - - clearScreen() - header = '['+command.codeMR+'] '+command.label - - ScmSet = {} - ScmParam = OrderedDict() - ecusList = [] - correctEcu = '' - vdiagExists = False - - def get_message( msg, encode = 1 ): - if msg in list(ScmParam.keys()): - value = ScmParam[msg] - else: - value = msg - if value.isdigit() and value in list(mod_globals.language_dict.keys()): - if encode: - value = pyren_encode(mod_globals.language_dict[value]) - else: - value = mod_globals.language_dict[value] - return value - - def get_message_by_id( id, encode = 1 ): - if id.isdigit() and id in list(mod_globals.language_dict.keys()): - if encode: - value = pyren_encode(mod_globals.language_dict[id]) - else: - value = mod_globals.language_dict[id] - return value - - # - # Data file parsing - # - DOMTree = xml.dom.minidom.parse(mod_db_manager.get_file_from_clip(data)) - ScmRoom = DOMTree.documentElement - - root = et.parse(mod_db_manager.get_file_from_clip(data)).getroot() - - 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: - if len(Set.attributes) != 1: - setname = pyren_encode(mod_globals.language_dict[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 - - if "IdentVdiag" in list(ScmParam.keys()): - vdiagExists = True - - # Get nested buttons with VDiag - for vDiag in root: - if vDiag.attrib["name"] == "ListVdiag": - if len(list(vDiag.keys())) == 1: - for vDiagName in vDiag: - buttons = OrderedDict() - if vDiagName: - for vDiagButton in vDiagName: - buttons[vDiagButton.attrib["name"]] = vDiagButton.attrib["value"] - ecusList.append(ecus(vDiagName.attrib["name"], '', buttons)) - -# Get correct buttons set - if vdiagExists: - value1, datastr1 = ecu.get_id(ScmParam['IdentVdiag']) - for ecuSet in ecusList: - if ecuSet.vdiag == value1.upper(): - correctEcu = ecuSet - break - else: - correctEcu = ecusList[0] - - if not correctEcu and mod_globals.opt_demo: - correctEcu = ecusList[0] - - if vdiagExists: - if not correctEcu: - print('*'*80) - ch = input('Unknown diagnostic version. Press ENTER to exit') - return - - #Prepare buttons - buttons = OrderedDict() - - for bt in list(correctEcu.buttons.keys()): - if bt == 'InjectorsButton': - if str(correctEcu.buttons[bt]) == 'true': - buttons[1] = get_message("Injectors",0) - if bt == 'EGRValveButton': - if str(correctEcu.buttons[bt]) == 'true': - buttons[2] = get_message("EGR_VALVE",0) - if bt == 'InletFlapButton': - if str(correctEcu.buttons[bt]) == 'true': - buttons[3] = get_message("INLET_FLAP",0) - if bt == 'ParticleFilterButton': - if str(correctEcu.buttons[bt]) == 'true': - buttons[4] = get_message("PARTICLES_FILTER",0) - if bt.startswith("Button"): - if str(correctEcu.buttons[bt]) == 'true': - buttons[int(bt.strip('Button'))] = get_message(bt[:-6] + "Text", 0) - buttons["loadDump"] = get_message_by_id('19802', 0) - buttons["exit"] = '' - - #Get commands - commands = {} - - for child in root: - if child.attrib["name"] == "Commands": - if len(list(child.keys())) == 1: - for param in child: - serviceIDs = ecu.get_ref_cmd(param.attrib["value"]).serviceID - startReq = "" - for sid in serviceIDs: - if ecu.Services[sid].params: - startReq = ecu.Services[sid].startReq - break - commands[param.attrib["name"]] = {"command": param.attrib["value"], "startReq": startReq} - - #Get identifications - identsList = OrderedDict() - identsRangeKeys = OrderedDict() - - for param in list(ScmParam.keys()): - if param.startswith('Idents') and param.endswith('Begin'): - key = param[6:-5] - begin = int(ScmParam['Idents'+key+'Begin']) - end = int(ScmParam['Idents'+key+'End']) - try: #10099 trap - ecu.get_ref_id(ScmParam['Ident' + str(begin)]).mnemolist[0] - except: - continue - else: - for idnum in range(begin ,end + 1): - identsList['D'+str(idnum)] = ScmParam['Ident'+str(idnum)] - if len(ecu.get_ref_id(ScmParam['Ident' + str(idnum)]).mnemolist) > 1: - mnemonicsLen = [int(ecu.Mnemonics[bitsLen].bitsLength) for bitsLen in ecu.get_ref_id(ScmParam['Ident' + str(idnum)]).mnemolist] - ecu.get_ref_id(ScmParam['Ident' + str(idnum)]).mnemolist = [ecu.get_ref_id(ScmParam['Ident' + str(idnum)]).mnemolist[mnemonicsLen.index(max(mnemonicsLen))]] - frame = ecu.Mnemonics[ecu.get_ref_id(identsList['D'+str(begin)]).mnemolist[0]].request - identsRangeKeys[key] = {"begin": begin, "end": end, "frame": frame} - - def getValuesToChange(resetItem): - params = {} - for child in root: - if child.attrib["name"] == resetItem: - if len(list(child.keys())) == 1: - for param in child: - params[param.attrib["name"].replace("D0", "D")] = param.attrib["value"] - return params - - def takesParams(request): - for cmd in list(commands.values()): - if cmd['startReq'] == request: - commandToRun = cmd['command'] - return commandToRun - - def getValuesFromEcu(params): - paramToSend = "" - commandToRun = "" - requestToFindInCommandsRequests = "" - backupDict = {} - - try: - idKeyToFindInRange = int((list(params.keys())[0]).replace("D","")) - except: - return commandToRun, paramToSend - else: - for rangeK in list(identsRangeKeys.keys()): - if identsRangeKeys[rangeK]['begin'] <= idKeyToFindInRange <= identsRangeKeys[rangeK]['end']: - requestToFindInCommandsRequests = "3B" + identsRangeKeys[rangeK]['frame'][-2:] - isTakingParams = takesParams(requestToFindInCommandsRequests) - if isTakingParams: - for k,v in params.items(): - backupDict[k] = ecu.get_id(identsList[k], 1) - if v in list(identsList.keys()): - identsList[k] = ecu.get_id(identsList[v], 1) - else: - identsList[k] = v - for idKey in range(identsRangeKeys[rangeK]['begin'], identsRangeKeys[rangeK]['end'] + 1): - if identsList["D" + str(idKey)].startswith("ID"): - identsList["D" + str(idKey)] = ecu.get_id(identsList["D" + str(idKey)], 1) - backupDict["D" + str(idKey)] = identsList["D" + str(idKey)] - paramToSend += identsList["D" + str(idKey)] - commandToRun = isTakingParams - break - - makeDump(commandToRun, backupDict) - return commandToRun, paramToSend - - confirm = get_message_by_id('19800') - successMessage = get_message('Message32') - failMessage = get_message('MessageNACK') - mainText = get_message('Title') - inProgressMessage = get_message('CommandInProgressMessage') - - def resetInjetorsData(button, injectorsList): - injectorsInfoMessage = get_message('Message21') - response = "" - clearScreen() - - print(mainText) - print('*'*80) - print(pyren_encode(buttons[button])) - print('*'*80) - print(injectorsInfoMessage) - print('*'*80) - print() - - choice = Choice(list(injectorsList.keys()), "Choose :") - if choice[0]=='': return - - clearScreen() - - print() - response = ecu.run_cmd(injectorsList[choice[0]]) - print() - - if "NR" in response: - print(failMessage) - else: - print(successMessage) - - print() - ch = input('Press ENTER to exit') - - def afterEcuChange(title, button): - params = getValuesToChange(title) - infoMessage = get_message("Message262") - mileageText = get_message_by_id('2110') - mileageUnit = get_message_by_id('16521') - - clearScreen() - print(mainText) - print('*'*80) - print(pyren_encode(buttons[button])) - print('*'*80) - print(infoMessage) - print('*'*80) - print(get_message("MessageBox2")) - print() - ch = input(confirm + ' : ') - if ch.upper()!='YES': - return - mileage = input(mileageText + ' (' + mileageUnit + ')' + ': ') - while not (mileage.isdigit() and 2 <= len(mileage) <= 6 and int(mileage) >= 10): - print(get_message("MessageBox1")) - print() - mileage = input(mileageText + ' (' + mileageUnit + ')' + ': ') - - clearScreen() - - print(mileageText + ': ' + mileage + ' ' + mileageUnit) - print() - ch = input(confirm + ' : ') - while (ch.upper()!='YES') and (ch.upper()!='NO'): - ch = input(confirm + ' : ') - if ch.upper()!='YES': - return - - clearScreen() - - print() - print(inProgressMessage) - - mileage = int(mileage) - - for paramkey in list(params.keys()): - if params[paramkey] == "Mileage": - mnemonics = ecu.get_ref_id(identsList[paramkey]).mnemolist[0] - identValue = ecu.get_id(identsList[paramkey], 1) - if identValue == 'ERROR': - identValue = '00000000' - hexval = "{0:0{1}X}".format(mileage,len(identValue)) - if ecu.Mnemonics[mnemonics].littleEndian == '1': - a = hexval - b = '' - if not len(a) % 2: - for i in range(0,len(a),2): - b = a[i:i+2]+b - hexval = b - params[paramkey] = hexval - - command, paramToSend = getValuesFromEcu(params) - - if "ERROR" in paramToSend: - input("Data downloading went wrong. Aborting.") - return - - clearScreen() - - print() - response = ecu.run_cmd(command,paramToSend) - print() - - if "NR" in response: - print(failMessage) - else: - print(successMessage) - - print() - ch = input('Press ENTER to exit') - - def setGlowPlugsType(title, button): - params = getValuesToChange(title) - value, datastr = ecu.get_st(ScmParam['State1']) - - message = get_message('Message29') - currentTypeMessage = get_message_by_id('52676') - - typesButtons = OrderedDict() - - typesButtons[get_message_by_id('54031',0)] = ScmParam['54031'] - typesButtons[get_message_by_id('54030',0)] = ScmParam['54030'] - typesButtons[get_message_by_id('54032',0)] = ScmParam['54032'] - typesButtons[''] = "" - - clearScreen() - print(mainText) - print('*'*80) - print(pyren_encode(buttons[button])) - print('*'*80) - print(message) - print('*'*80) - print() - print(currentTypeMessage + ':') - print() - print(datastr) - print() - - choice = Choice(list(typesButtons.keys()), "Choose :") - if choice[0]=='': return - - clearScreen() - print() - print(inProgressMessage) - - glowPlugType = "{0:0{1}X}".format((int(ScmParam['Mask1']) + int(typesButtons[choice[0]])),2) - - params[list(params.keys())[0]] = glowPlugType - - command, paramToSend = getValuesFromEcu(params) - - if "ERROR" in paramToSend: - input("Data downloading went wrong. Aborting.") - return - - clearScreen() - - print() - response = ecu.run_cmd(command,paramToSend) - print() - - if "NR" in response: - print(failMessage) - else: - print(successMessage) - - print() - ch = input('Press ENTER to exit') - - def resetValues(title, button, defaultCommand): - paramToSend = "" - commandTakesParams = True - params = getValuesToChange(title) - - clearScreen() - - print(mainText) - print('*'*80) - print(pyren_encode(buttons[button])) - print('*'*80) - if button == 4: - print(get_message_by_id('55662')) - print('*'*80) - if button == 5: - print(get_message_by_id('55663')) - print('*'*80) - print() - ch = input(confirm + ' : ') - while (ch.upper()!='YES') and (ch.upper()!='NO'): - ch = input(confirm + ' : ') - if ch.upper()!='YES': - return - - clearScreen() - print() - print(inProgressMessage) - - command, paramToSend = getValuesFromEcu(params) - - if "ERROR" in paramToSend: - input("Data downloading went wrong. Aborting.") - return - - clearScreen() - - print() - if command: - response = ecu.run_cmd(command,paramToSend) - else: - response = ecu.run_cmd(defaultCommand) - print() - - if "NR" in response: - print(failMessage) - else: - print(successMessage) - - print() - ch = input('Press ENTER to exit') - - def makeDump(cmd, idents): - fileRoot = et.Element("ScmRoot") - fileRoot.text = "\n " - - cmdElement = et.Element("ScmParam", name="Command", value=cmd) - cmdElement.tail = "\n " - fileRoot.insert(1,cmdElement) - - for k in idents: - el = et.Element("ScmParam", name='D'+ '{:0>2}'.format(k[1:]), value=idents[k]) - el.tail = "\n " - fileRoot.insert(1,el) - - tree = et.ElementTree(fileRoot) - tree.write(mod_globals.dumps_dir + ScmParam['FileName']) - - def loadDump(): - clearScreen() - - paramToSend = "" - dumpScmParam = {} - try: - dumpData = open(mod_globals.dumps_dir + ScmParam['FileName'], 'r') - except: - print(get_message_by_id('2194')) - input() - return - - dumpDOMTree = xml.dom.minidom.parse(dumpData) - dumpScmRoot = dumpDOMTree.documentElement - dumpScmParams = dumpScmRoot.getElementsByTagName("ScmParam") - - for Param in dumpScmParams: - name = pyren_encode( Param.getAttribute("name") ) - value = pyren_encode( Param.getAttribute("value") ) - - dumpScmParam[name] = value - - for k in sorted(dumpScmParam): - if k != "Command": - paramToSend += dumpScmParam[k] - - if "ERROR" in paramToSend: - input("Data downloading went wrong. Aborting.") - return - - print('*'*80) - print(get_message_by_id('19802')) - print('*'*80) - print() - - ch = input(confirm + ' : ') - while (ch.upper()!='YES') and (ch.upper()!='NO'): - ch = input(confirm + ' : ') - if ch.upper()!='YES': - return - - clearScreen() - - print() - response = ecu.run_cmd(dumpScmParam['Command'],paramToSend) - print() - - if "NR" in response: - print(failMessage) - else: - print(successMessage) - - print() - ch = input('Press ENTER to exit') - - - functions = OrderedDict() - for cmdKey in list(commands.keys()): - if cmdKey == 'Cmd1' and "Cmd5" in list(commands.keys()): - injectorsDict = OrderedDict() - injectorsDict[get_message('Cylinder1', 0)] = commands['Cmd1']['command'] - injectorsDict[get_message('Cylinder2', 0)] = commands['Cmd2']['command'] - injectorsDict[get_message('Cylinder3', 0)] = commands['Cmd3']['command'] - injectorsDict[get_message('Cylinder4', 0)] = commands['Cmd4']['command'] - injectorsDict[''] = "" - functions[1] = [1, injectorsDict] - if cmdKey == 'Cmd5': - functions[2] = ["EGR_VALVE", 2, commands['Cmd5']['command']] - if cmdKey == 'Cmd6': - functions[3] = ["INLET_FLAP", 3, commands['Cmd6']['command']] - if cmdKey == 'Cmd7': - functions[4] = ["PARTICLE_FILTER", 4, commands['Cmd7']['command']] - functions[5] = ["Button5ChangeData", 5, commands['Cmd7']['command']] - functions[6] = ["Button6ChangeData", 6, commands['Cmd7']['command']] - if len(commands) == 1 and cmdKey == 'Cmd1': - functions[7] = ["Button7ChangeData", 7] - - infoMessage = get_message('Message1') - - print(mainText) - print() - print(infoMessage) - print() - - choice = Choice(list(buttons.values()), "Choose :") - - for key, value in buttons.items(): - if choice[0]=='': return - if value == choice[0]: - if key == 'loadDump': - loadDump() - elif key == 1: - resetInjetorsData(functions[key][0],functions[key][1]) - elif key == 6: - afterEcuChange(functions[key][0],functions[key][1]) - elif key == 7: - setGlowPlugsType(functions[key][0],functions[key][1]) - else: - resetValues(functions[key][0],functions[key][1],functions[key][2]) - return \ No newline at end of file diff --git a/pyren3/scen_ecri_paraminj4.py b/pyren3/scen_ecri_paraminj4.py deleted file mode 100755 index 87ab32c..0000000 --- a/pyren3/scen_ecri_paraminj4.py +++ /dev/null @@ -1,280 +0,0 @@ -#!/usr/bin/env python3 -''' -Scenarium usage example - -Name of this script should be exactly the same as in scenaruim URL but with '.py' extension - -URL - scm:scen_ecri_calinj1#scen_ecri_calinj1_xxxxx.xml - -'run' procedure will be executed by pyren script - -''' - -import os -import sys -import re -import time -import string -import mod_globals -import mod_utils -import mod_ecu -import mod_db_manager -from mod_ply import * -from mod_utils import pyren_encode -from mod_utils import clearScreen -from mod_utils import Choice -from mod_utils import isHex -from collections import OrderedDict -import xml.dom.minidom -import xml.etree.cElementTree as et - -def run( elm, ecu, command, data ): - ''' - MAIN function of scenarium - - Parameters: - elm - refernce to adapter class - ecu - reference to ecu class - command - refernce to the command this scenarium belongs to - data - name of xml file with parameters from scenarium URL - ''' - - clearScreen() - header = '['+command.codeMR+'] '+command.label - - ScmSet = {} - ScmParam = OrderedDict() - - def get_message( msg, encode = True ): - if msg in list(ScmParam.keys()): - value = ScmParam[msg] - else: - value = msg - if value.isdigit() and value in list(mod_globals.language_dict.keys()): - if encode: - value = pyren_encode(mod_globals.language_dict[value]) - else: - value = mod_globals.language_dict[value] - return value - - def get_message_by_id( id, encode = True ): - if id.isdigit() and id in list(mod_globals.language_dict.keys()): - if encode: - value = pyren_encode(mod_globals.language_dict[id]) - else: - value = mod_globals.language_dict[id] - return value - - # - # Data file parsing - # - DOMTree = xml.dom.minidom.parse(mod_db_manager.get_file_from_clip(data)) - ScmRoom = DOMTree.documentElement - - root = et.parse(mod_db_manager.get_file_from_clip(data)).getroot() - - 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") - - scmParamsDict = OrderedDict() - for Param in ScmParams: - name = pyren_encode( Param.getAttribute("name") ) - value = pyren_encode( Param.getAttribute("value") ) - - scmParamsDict[name] = value - - ScmSet[setname]= scmParamsDict - - confirm = get_message_by_id('19800') - successMessage = get_message("EndScreenMessage3") - failMessage = get_message("EndScreenMessage4") - - #Prepare buttons - buttons = OrderedDict() - - buttons[1] = get_message("Subtitle", False) - buttons["loadDump"] = get_message_by_id('19802', False) - buttons["exit"] = '' - - def getIdsDump(): - idsDump = OrderedDict() - for name, value in ScmSet['CommandIdentifications'].items(): - idValue = ecu.get_id(ScmSet['Identifications'][value], True) - if isHex(idValue): - idsDump[ScmSet['Commands'][name]] = idValue - return idsDump - - def makeDump(): - fileRoot = et.Element("ScmRoot") - fileRoot.text = "\n " - - idsDump = getIdsDump() - - if not idsDump: return - - for cmd, value in idsDump.items(): - el = et.Element("ScmParam", name=cmd, value=value) - el.tail = "\n " - fileRoot.insert(1,el) - - tree = et.ElementTree(fileRoot) - tree.write(mod_globals.dumps_dir + ScmParam['FileName']) - - def loadDump(): - dumpScmParam = {} - - clearScreen() - - try: - dumpData = open(mod_globals.dumps_dir + ScmParam['FileName'], 'r') - except: - print(get_message_by_id('2194')) - print() - input('Press ENTER to exit') - return - - dumpDOMTree = xml.dom.minidom.parse(dumpData) - dumpScmRoot = dumpDOMTree.documentElement - dumpScmParams = dumpScmRoot.getElementsByTagName("ScmParam") - - for Param in dumpScmParams: - name = pyren_encode( Param.getAttribute("name") ) - value = pyren_encode( Param.getAttribute("value") ) - - dumpScmParam[name] = value - - print('*'*80) - print(get_message_by_id('19802')) - print('*'*80) - print() - - ch = input(confirm + ' : ') - while (ch.upper()!='YES') and (ch.upper()!='NO'): - ch = input(confirm + ' : ') - if ch.upper()!='YES': - return - - clearScreen() - - responses = '' - for name, value in dumpScmParam.items(): - responses += ecu.run_cmd(name, value) - - print('*'*80) - print() - if "NR" in responses: - print(failMessage) - else: - print(successMessage) - - print() - input('Press ENTER to exit') - - def resetValues(): - info = get_message('Informations') - infoContent = get_message('InformationsContent') - inProgressMessage = get_message('CommandInProgress') - - clearScreen() - - print(title) - print('*'*80) - print(subtitle) - print('*'*80) - print(info) - print() - print(infoContent) - print('*'*80) - print() - ch = input(confirm + ' : ') - while (ch.upper()!='YES') and (ch.upper()!='NO'): - ch = input(confirm + ' : ') - if ch.upper()!='YES': - return - - clearScreen() - - print(inProgressMessage) - if not mod_globals.opt_demo: - makeDump() - - responses = '' - - clearScreen() - - for name, value in ScmSet['CommandParameters'].items(): - if isHex(value): - responses += ecu.run_cmd(ScmSet['Commands'][name],value) - else: - result = re.search(r"[^a-zA-Z\d\s:]", value) - if result: - parameters = re.findall(r"Ident\d+", value) - paramByteLength = len(parameters[0])//2 - comp = value - - for param in parameters: - paramValue = ecu.get_id(ScmSet['Identifications'][param], True) - if not isHex(paramValue): - comp = '' - break - comp = comp.replace(param, '0x' + ecu.get_id(ScmSet['Identifications'][param], True)) - - if not comp: - continue - - calc = Calc() - idValue = calc.calculate(comp) - - hexVal = hex(idValue)[2:] - if len(hexVal)%2: - hexVal = '0' + hexVal - if (len(hexVal)//2) % paramByteLength: - hexVal = '00' * (paramByteLength - len(hexVal)//2) + hexVal - - responses += ecu.run_cmd(ScmSet['Commands'][name],hexVal) - - else: - idValue = ecu.get_id(ScmSet['Identifications'][value], True) - if isHex(idValue): - responses += ecu.run_cmd(ScmSet['Commands'][name],idValue) - - print('*'*80) - print() - if "NR" in responses: - print(failMessage) - else: - print(successMessage) - - print() - input('Press ENTER to exit') - - title = get_message('Title') - subtitle = get_message('Subtitle') - - print(title) - print('*'*80) - print(subtitle) - print('*'*80) - print() - - choice = Choice(list(buttons.values()), "Choose :") - - for key, value in buttons.items(): - if choice[0] =='': return - if value == choice[0]: - if key == 'loadDump': - loadDump() - else: - resetValues() - return \ No newline at end of file diff --git a/pyren3/scen_lect_sondeO21.py b/pyren3/scen_lect_sondeO21.py deleted file mode 100755 index 592fd96..0000000 --- a/pyren3/scen_lect_sondeO21.py +++ /dev/null @@ -1,218 +0,0 @@ -#!/usr/bin/env python3 -''' -Scenarium usage example - -Name of this script should be exactly the same as in scenaruim URL but with '.py' extension - -URL - scm:scen_lect_sondeO21#scen_lect_xxxxxx_xxxxx.xml - -'run' procedure will be executed by pyren script - -''' - -import os -import sys -import re -import time - -import mod_globals -import mod_utils -import mod_ecu -import mod_db_manager -from mod_utils import pyren_encode -from mod_utils import clearScreen -from mod_utils import KBHit -from copy import deepcopy - -import xml.dom.minidom - -#def get_message( value ): -# if value.isdigit() and value in mod_globals.language_dict.keys(): -# value = pyren_encode( mod_globals.language_dict[value] ) -# print value - -def run( elm, ecu, command, data ): - ''' - MAIN function of scenarium - - Parameters: - elm - refernce to adapter class - ecu - reference to ecu class - command - refernce to the command this scenarium belongs to - data - name of xml file with parameters from scenarium URL - ''' - - clearScreen() - header = '['+command.codeMR+'] '+command.label - - ScmParam = {} - ScmList_Etats = [] - ScmList_Messages = [] - ScmUSet = {} - - def get_message( msg ): - if msg in list(ScmParam.keys()): - value = ScmParam[msg] - else: - value = msg - if value.isdigit() and value in list(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 list(mod_globals.language_dict.keys()): - value = pyren_encode( mod_globals.language_dict[id] ) - return value - - - # - # Data file parsing - # - DOMTree = xml.dom.minidom.parse(mod_db_manager.get_file_from_clip(data)) - ScmRoom = DOMTree.documentElement - - # read parameters - ScmParams = ScmRoom.getElementsByTagName("ScmParam") - - for Param in ScmParams: - name = pyren_encode( Param.getAttribute("name") ) - value = pyren_encode( Param.getAttribute("value") ) - - ScmParam[name] = value - - # read ScmLists - ScmLists = ScmRoom.getElementsByTagName("ScmList") - - for ScmList in ScmLists: - listname = ScmList.getAttribute("name") - ScmUSets = ScmList.getElementsByTagName("ScmUSet") - - ScmUSet = {} - for Set in ScmUSets: - ScmParams = Set.getElementsByTagName("ScmParam") - for Param in ScmParams: - name = pyren_encode( Param.getAttribute("name") ) - value = pyren_encode( Param.getAttribute("value") ) - ScmUSet[name] = value - - if listname.lower()=='etats': - ScmList_Etats.append( deepcopy(ScmUSet) ) - else: - ScmList_Messages.append( deepcopy(ScmUSet) ) - - # - # Important information - # - clearScreen() - print(pyren_encode(header)) - print() - print(get_message('TexteScenario')) - print() - print(get_message('TexteInformations')) - print() - print('*'*80) - print() - print(get_message('TexteContenuInformationsE1')) - print() - print(get_message('TexteContenuInformationsE4')) - print() - print(get_message('TexteProcedureFin')) - print() - print('*'*80) - ch = input('Press ENTER to continue') - - # - # Check conditions - # - i = 1 - clearScreen() - print(pyren_encode(header)) - print() - print('*'*80) - for etat in ScmList_Etats: - print("Checking condition : ",i); i = i + 1 - print('*'*80) - state_ref = ecu.get_ref_st(etat['Index']) - value1, datastr1 = ecu.get_st(etat['Index']) - print((pyren_encode(datastr1))) - if pyren_encode(value1)!=mod_globals.language_dict[etat['RefOK']]: - value2, datastr2 = ecu.get_st(etat['Donne1']) - print(pyren_encode( mod_globals.language_dict[etat['TexteSortie']] )) - print((pyren_encode(datastr2))) - print('*'*80) - ch = input('Press ENTER to exit') - #return - - # - # Ask permission to start - # - #clearScreen() - print() - print('*'*80) - print() - print(pyren_encode(header)) - print() - ch = input('Are you ready to start the test? :') - if ch.lower()!='yes': return - - - # - # Start test - # - responce = ecu.run_cmd(ScmParam['CommandeTestSonde']) - - # - # Main cycle - # - begin_time = time.time() - Phase_state = ecu.get_ref_st(ScmParam['EtatComTer']) - Result_state = ecu.get_ref_st(ScmParam['EtatResultatTest']) - kb = KBHit() - pfe = 0 - while( 1 ): - # get all values before showing them for avoid screen flickering - value0, datastr0 = ecu.get_st(ScmParam['EtatComTer']) - value1, datastr1 = ecu.get_st(ScmParam['EtatResultatTest']) - phase = pyren_encode(value0) - rescode = pyren_encode(value1) - result = rescode - for m in ScmList_Messages: - if rescode in pyren_encode(mod_globals.language_dict[m['Valeur']]): - result = pyren_encode( mod_globals.language_dict[m['Texte']]) - - current_time = time.time() - elapsed = int(current_time-begin_time) - minutes, seconds = divmod(elapsed, 60) - hours, minutes = divmod(minutes, 60) - - # - # Show process - # - clearScreen() - print(pyren_encode(header)) - print('\tTime - ',"{hours:02d}:{minutes:02d}:{seconds:02d}".format(**vars())) - print('\tPhase - ', phase) - print('*'*90) - print((pyren_encode(datastr0))) - print((pyren_encode(datastr1))) - print('*'*90) - if pyren_encode(value0)==get_message_by_id("19532"): - pfe = 1 - break - print('Press Q to emergency exit') - if kb.kbhit(): - c = kb.getch() - if len(c)!=1: continue - if c=='q' or c=='Q': - kb.set_normal_term() - break - time.sleep( 0.2 ) - - kb.set_normal_term() - if pfe: - print('\tPhase - ', phase) - print('\tResult - ', result) - print('*'*90) - - ch = input('Press ENTER to exit') - diff --git a/pyren3/scen_lect_ssppx91.py b/pyren3/scen_lect_ssppx91.py deleted file mode 100755 index 3830416..0000000 --- a/pyren3/scen_lect_ssppx91.py +++ /dev/null @@ -1,421 +0,0 @@ -#!/usr/bin/env python3 -''' -Scenarium usage example - -Name of this script should be exactly the same as in scenaruim URL but with '.py' extension - -URL - scm:scen_ecri_calinj1#scen_ecri_calinj1_xxxxx.xml - -'run' procedure will be executed by pyren script - -''' - -import os -import sys -import re -import time -import string -import mod_globals -import mod_utils -import mod_ecu -import mod_db_manager -from mod_utils import KBHit -from mod_utils import pyren_encode -from mod_utils import clearScreen -from mod_utils import ASCIITOHEX -from mod_utils import StringToIntToHex -from mod_utils import Choice -from collections import OrderedDict -import xml.dom.minidom - -def run( elm, ecu, command, data ): - ''' - MAIN function of scenarium - - Parameters: - elm - refernce to adapter class - ecu - reference to ecu class - command - refernce to the command this scenarium belongs to - data - name of xml file with parameters from scenarium URL - ''' - - clearScreen() - header = '['+command.codeMR+'] '+command.label - - ScmSet = {} - ScmParam = OrderedDict() - - def get_message( msg, encode = True ): - if msg in list(ScmParam.keys()): - value = ScmParam[msg] - else: - value = msg - if value.isdigit() and value in list(mod_globals.language_dict.keys()): - if encode: - value = pyren_encode(mod_globals.language_dict[value]) - else: - value = mod_globals.language_dict[value] - return value - - def get_message_by_id( id, encode = True ): - if id.isdigit() and id in list(mod_globals.language_dict.keys()): - if encode: - value = pyren_encode(mod_globals.language_dict[id]) - else: - value = mod_globals.language_dict[id] - return value - - # - # Data file parsing - # - DOMTree = xml.dom.minidom.parse(mod_db_manager.get_file_from_clip(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: - if len(Set.attributes) != 1: - setname = pyren_encode(mod_globals.language_dict[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() - - confirm = get_message_by_id('19800') - confirmCodes = get_message_by_id('17571') - resultMessage = get_message('TxtResult') - title = get_message('TextTitre', False) - stateLabel = get_message_by_id('804') - finishedInfo = get_message_by_id('15902') - messageInfo = get_message('MessageScr1', False) - readCodeMessage = get_message_by_id('17884') - codeInfo = get_message('TxtInformation') - codeRed = codeInfo.split('-')[1].strip() - codeOrange = codeInfo.split('-')[2].strip() - codeGreen = codeInfo.split('-')[3].strip() - oneValveText = get_message_by_id('14964', False) - fourValveText = get_message_by_id('14966', False) - - NR10 = get_message('Nack10') - NR11 = get_message('NackServiceNotSupported') - NR12 = get_message('NackSubFunctionNotSupported') - NR21 = get_message('NackBusyRepeatRequest') - NR22 = get_message('NackConditionsNotCorrect') - NR23 = get_message('Nack23') - NR33 = get_message('NackSecurityAccessDenied') - NR35 = get_message('NackInvalidKey') - NR78 = get_message('NackResponsePending') - NR80 = get_message('Nack80') - NRFF = get_message('NackUnknown') - - negrsp = { - '10' : NR10, - '11' : NR11, - '12' : NR12, - '21' : NR21, - '22' : NR22, - '23' : NR23, - '33' : NR33, - '35' : NR35, - '78' : NR78, - '80' : NR80, - 'FF' : NRFF - } - - searchInProgress = [] - searchInProgress.append(get_message('Label_AVG_En_Cours')) - searchInProgress.append(get_message('Label_AVD_En_Cours')) - searchInProgress.append(get_message('Label_ARD_En_Cours')) - searchInProgress.append(get_message('Label_ARG_En_Cours')) - searchFinished = [] - searchFinished.append(get_message('Label_AVG_Terminee')) - searchFinished.append(get_message('Label_AVD_Terminee')) - searchFinished.append(get_message('Label_ARD_Terminee')) - searchFinished.append(get_message('Label_ARG_Terminee')) - summerFLCode = ecu.get_id(ScmParam['ID_AVG_ETE'], 1) - summerFRCode = ecu.get_id(ScmParam['ID_AVD_ETE'], 1) - summerRRCode = ecu.get_id(ScmParam['ID_ARD_ETE'], 1) - summerRLCode = ecu.get_id(ScmParam['ID_ARG_ETE'], 1) - winterFLCode = ecu.get_id(ScmParam['ID_AVG_HIVER'], 1) - winterFRCode = ecu.get_id(ScmParam['ID_AVD_HIVER'], 1) - winterRRCode = ecu.get_id(ScmParam['ID_ARD_HIVER'], 1) - winterRLCode = ecu.get_id(ScmParam['ID_ARG_HIVER'], 1) - summerTyreCodes = [summerFLCode,summerFRCode,summerRRCode,summerRLCode] - winterTyreCodes = [winterFLCode,winterFRCode,winterRRCode,winterRLCode] - tyreCodes = [] - tyreCodes.extend(summerTyreCodes) - tyreCodes.extend(winterTyreCodes) - tyresLabels = [] - tyresLabels.append(get_message('Label_CodeAVG', False)) - tyresLabels.append(get_message('Label_CodeAVD', False)) - tyresLabels.append(get_message('Label_CodeARD', False)) - tyresLabels.append(get_message('Label_CodeARG', False)) - value1, datastr1 = ecu.get_st(ScmParam['State_ET469']) - tariningCmdResp = ecu.Services[ecu.get_ref_cmd(ScmParam['CmndRoutineTraining']).serviceID[0]].simpleRsp - - currentTyreSet = '' - lastCodeStatus = '' - - notUpdatedText = [] - notUpdatedText.append(title) - notUpdatedText.append('*'*80) - notUpdatedText.append(messageInfo) - notUpdatedText.append('*'*80) - notUpdatedText.append(datastr1) - notUpdatedText.append('*'*80) - tyreCodesTable = [] - if get_message('Text_ET469_ETE', False) in datastr1: - summerTyresSet = True - tyreCodesTable.append("%-50s %-20s"%(tyresLabels[0], summerTyreCodes[0])) - tyreCodesTable.append("%-50s %-20s"%(tyresLabels[1], summerTyreCodes[1])) - tyreCodesTable.append("%-50s %-20s"%(tyresLabels[2], summerTyreCodes[2])) - tyreCodesTable.append("%-50s %-20s"%(tyresLabels[3], summerTyreCodes[3])) - currentTyreSet = summerTyreCodes - else: - summerTyresSet = False - tyreCodesTable.append("%-50s %-20s"%(tyresLabels[0], winterTyreCodes[0])) - tyreCodesTable.append("%-50s %-20s"%(tyresLabels[1], winterTyreCodes[1])) - tyreCodesTable.append("%-50s %-20s"%(tyresLabels[2], winterTyreCodes[2])) - tyreCodesTable.append("%-50s %-20s"%(tyresLabels[3], winterTyreCodes[3])) - currentTyreSet = winterTyreCodes - notUpdatedText = notUpdatedText + tyreCodesTable - notUpdatedText.append('*'*80) - - buttons = OrderedDict() - buttons[1] = get_message_by_id('14964', False) - buttons[2] = get_message_by_id('14966', False) - buttons[3] = title - buttons["exit"] = '' - - def sendTrainingCmd(): - resp = ecu.run_cmd(ScmParam['CmndRoutineTraining']) - clearScreen() - if tariningCmdResp not in resp and not mod_globals.opt_demo: - nrCode = resp[resp.find('NR') - 3: resp.find('NR')] - print() - if 'NR' in resp: - print(negrsp[resp[resp.find('NR') - 3: resp.find('NR')]]) - print('') - else: - print(negrsp['FF']) - print() - input('Press any key to exit') - return False - else: - return True - - def writeCodes(codes): - ch = input(confirmCodes + ' : ') - while (ch.upper()!='YES') and (ch.upper()!='NO'): - ch = input(confirmCodes + ' : ') - if ch.upper()!='YES': - print() - return - print() - print('*'*80) - rsp = ecu.run_cmd('VP003', codes) - print('*'*80) - print() - - def generateScreen(title, codes): - screen = '' - screenPartOne = [] - screenPartOne.append(title) - screenPartOne.append('*'*80) - screenPartOne.append(datastr1) - screenPartOne.append('*'*80) - integratedLines = [] - for num in range(len(tyreCodesTable)): - try: - integratedLines.append(tyreCodesTable[num] + codes[num]) - except: - integratedLines.append(tyreCodesTable[num]) - integratedScreen = screenPartOne + integratedLines - for lines in integratedScreen: - screen = screen + pyren_encode(lines) + '\n' - return screen - - def writeOneValve(): - selectedValve = '' - selectedValveKey = '' - screen = generateScreen(oneValveText, []) - valveLabelsDict = OrderedDict() - for lb in range(4): - valveLabelsDict[lb] = tyresLabels[lb] - valveLabelsDict["exit"] = '' - - clearScreen() - print(screen) - print() - choice = Choice(list(valveLabelsDict.values()), get_message_by_id('14127').replace('.',':')) - - clearScreen() - print(screen) - print() - for key, value in valveLabelsDict.items(): - if choice[0] =='': return - if value == choice[0]: - selectedValve = valveLabelsDict[key] - selectedValveKey = key - - userCode = input(pyren_encode(selectedValve) + ': ').upper() - while not len(userCode) == 6 or not all(c in string.hexdigits for c in userCode): - if not len(userCode) == 6: - print('Valve code should be 6 characters long.') - else: - print('Illegal characters in the valve code') - userCode = input(pyren_encode(selectedValve) + ': ').upper() - - paramToSend = '' - if summerTyresSet: - for code in range(len(summerTyreCodes)): - if code == selectedValveKey: - paramToSend += userCode - else: - paramToSend += summerTyreCodes[code] - else: - for code in range(len(winterTyreCodes)): - if code == selectedValveKey: - paramToSend += userCode - else: - paramToSend += winterTyreCodes[code] - - clearScreen() - print(screen) - print() - print(pyren_encode(tyreCodesTable[selectedValveKey]), userCode) - print() - writeCodes(paramToSend) - - def writeFourValves(): - userCodes = [] - screen = generateScreen(fourValveText, []) - - clearScreen() - print(screen) - ch = input(confirm + ' : ') - while (ch.upper()!='YES') and (ch.upper()!='NO'): - ch = input(confirm + ' : ') - if ch.upper()!='YES': - print() - return - - clearScreen() - print(screen) - for num in range(len(tyresLabels)): - userCode = input(tyresLabels[num] + ': ').upper() - while not len(userCode) == 6 or not all(c in string.hexdigits for c in userCode): - if not len(userCode) == 6: - print('Valve code should be 6 characters long.') - else: - print('Illegal characters in the valve code') - userCode = input(tyresLabels[num] + ': ').upper() - userCodes.append(userCode) - clearScreen() - screen = generateScreen(fourValveText, userCodes) - print(screen) - - paramToSend = '' - for code in userCodes: - paramToSend += code - writeCodes(paramToSend) - - def valvesTraining(): - readCodes = OrderedDict() - if not sendTrainingCmd(): - return - - tb = time.time() - while(1): - readCode = ecu.get_id(ScmParam['ID_Code_Valves'], 1) - value2, datastr2 = ecu.get_st(ScmParam['State_ET002']) - oldScreen = '' - for lines in notUpdatedText: - oldScreen = oldScreen + pyren_encode(lines) + '\n' - - clearScreen() - print(oldScreen) - try: - print(stateLabel + ': ' + searchInProgress[len(readCodes)]) - except: - input('More than 4 tyres codes, aborting.') - return - print() - print('*'*80) - - if pyren_encode(value2) == pyren_encode(mod_globals.language_dict[ScmParam['StateNO']]) and len(readCodes) < 4: - print("%-50s %-20s"%(readCodeMessage, pyren_encode(readCode))) - print() - print("No codes read") - elif pyren_encode(value2) == pyren_encode(mod_globals.language_dict[ScmParam['StateYES']]) and len(readCodes) < 4: - print("%-50s %-20s"%(readCodeMessage, pyren_encode(readCode))) - print() - - if readCode != '000000' and readCode not in list(readCodes.keys()): - if not readCode in tyreCodes: - lastCodeStatus = codeRed - elif readCode == currentTyreSet[len(readCodes)]: - lastCodeStatus = codeGreen - else: - lastCodeStatus = codeOrange - readCodes[readCode] = readCode - - print(lastCodeStatus) - print() - - for code in range(len(readCodes)): - print("%-60s %-8s"%(searchFinished[code], pyren_encode(readCodes[list(readCodes.keys())[code]]))) - - print('*'*80) - print() - print('Press any key to exit') - print() - time.sleep(int(ScmParam['Tempo2']) / 1000) - tc = time.time() - if (tc - tb) > int(ScmParam['Tempo1']) / 1000: - tb = time.time() - if not sendTrainingCmd(): - return - if len(readCodes) == 4: - break - if kb.kbhit(): - return - - print(finishedInfo) - print() - paramToSend = '' - for code in list(readCodes.keys()): - paramToSend += code - if "ERROR" in paramToSend: - input("Data downloading went wrong. Aborting.") - return - writeCodes(paramToSend) - - print(get_message_by_id('19830')) - print() - choice = Choice(list(buttons.values()), "Choose :") - for key, value in buttons.items(): - if choice[0] =='': return - if value == choice[0]: - if key == 1: - writeOneValve() - elif key == 2: - writeFourValves() - elif key == 3: - valvesTraining() - input('Press any key to exit') - return \ No newline at end of file diff --git a/tools_and_confs/i12comp.exe b/tools_and_confs/i12comp.exe deleted file mode 100644 index a7c7d49..0000000 Binary files a/tools_and_confs/i12comp.exe and /dev/null differ diff --git a/tools_and_confs/wininstaller.iss b/tools_and_confs/wininstaller.iss deleted file mode 100644 index 90fad99..0000000 --- a/tools_and_confs/wininstaller.iss +++ /dev/null @@ -1,79 +0,0 @@ -[Setup] -AppName=PyRen -AppVersion=0.9.r -DefaultDirName={pf}\PyRen -DefaultGroupName=Pyren -SetupIconFile=icons\obd.ico -OutputBaseFilename=Pyren_Setup -UsePreviousPrivileges=True - -[Files] -Source: "README.md"; DestDir: "{app}" -Source: "*.py"; DestDir: "{app}" -Source: "\Python27\*"; DestDir: "{app}\Python27"; Flags: ignoreversion recursesubdirs createallsubdirs; Excludes: "*.pyc" -Source: "BVMEXTRACTION\*"; DestDir: "{app}\BVMEXTRACTION"; Flags: ignoreversion recursesubdirs -Source: "EcuDacia\*"; DestDir: "{app}\EcuDacia"; Flags: ignoreversion recursesubdirs -Source: "EcuRenault\*"; DestDir: "{app}\EcuRenault"; Flags: ignoreversion recursesubdirs -Source: "EcuRsm\*"; DestDir: "{app}\EcuRsm"; Flags: ignoreversion recursesubdirs -Source: "Location\*"; DestDir: "{app}\Location"; Flags: ignoreversion recursesubdirs -Source: "MTCSAVE\*"; DestDir: "{app}\MTCSAVE"; Flags: ignoreversion recursesubdirs onlyifdoesntexist skipifsourcedoesntexist -Source: "NML\*"; DestDir: "{app}\NML"; Flags: ignoreversion recursesubdirs -Source: "Params\*"; DestDir: "{app}\Params"; Flags: ignoreversion recursesubdirs -Source: "pyren\*"; DestDir: "{app}\pyren"; Flags: ignoreversion recursesubdirs -Source: "Vehicles\*"; DestDir: "{app}\Vehicles"; Flags: ignoreversion recursesubdirs -Source: "icons\*"; DestDir: "{app}\icons"; Flags: ignoreversion recursesubdirs - -[InstallDelete] -Type: filesandordirs; Name: "{app}\importlib" -Type: filesandordirs; Name: "{app}\Python38" - -[Code] -procedure AfterMyProgInstall; -begin - MsgBox(ExpandConstant('{cm:AfterMyProgInstall} {app}'), mbInformation, MB_OK); -end; - -[Dirs] -Name: "{app}"; Permissions: users-full -Name: "{app}\MTCSAVE"; Permissions: users-full - -[Tasks] -Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}";GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked - -[Icons] -Name: "{group}\PyRen"; Filename: "{app}\Python27\python.exe"; Parameters: """{app}\_pyren_launcher.py"""; WorkingDir: "{app}"; IconFilename: "{app}\icons\obd.ico" -Name: "{userdesktop}\PyRen"; Filename: "{app}\Python27\python.exe"; Parameters: """{app}\_pyren_launcher.py"""; WorkingDir: "{app}"; IconFilename: "{app}\icons\obd.ico"; Tasks: desktopicon - -[CustomMessages] -en.AfterMyProgInstall=Can-Clip 212 and DTT2000data 2021-6-16 included, remember to keep them up to date. -no.AfterMyProgInstall=Can-Clip 212 og DTT2000data 2021-6-16 inkludert, husk å holde dem oppdatert. -de.AfterMyProgInstall=Can-Clip 212 und DTT2000data 2021-6-16 enthalten, denken Sie daran, sie auf dem neuesten Stand zu halten. -fr.AfterMyProgInstall=Can-Clip 212 et DTT2000data 2021-6-16 inclus, pensez a les tenir à jour. -es.AfterMyProgInstall=Can-Clip 212 y DTT2000data 2021-6-16 incluidos, recuerde mantenerlos actualizados. -it.AfterMyProgInstall=Can-Clip 212 e DTT2000data 2021-6-16 inclusi, ricordati di tenerli aggiornati. -nl.AfterMyProgInstall=Can-Clip 212 en DTT2000data 2021-6-16 inbegrepen, vergeet niet om ze up-to-date te houden. -pl.AfterMyProgInstall=W zestawie Can-Clip 212 i DTT2000data 2021-6-16, pamiętaj o ich aktualizacji. -ptbr.AfterMyProgInstall=Can-Clip 212 e DTT2000data 2021-6-16 incluídos, lembre-se de mantê-los atualizados. -pt.AfterMyProgInstall=Can-Clip 212 e DTT2000data 2021-6-16 incluídos, lembre-se de mantê-los atualizados. -ru.AfterMyProgInstall=Can-Clip 212 и DTT2000data 2021-6-16 включены, не забывайте обновлять их. -am.AfterMyProgInstall=Can-Clip 212 և DTT2000data 2021-6-16 ներառված են, հիշեք, որ դրանք թարմացվեն: -bg.AfterMyProgInstall=Включени са Can-Clip 212 и DTT2000data 2021-6-16, не забравяйте да ги поддържате актуални. -tr.AfterMyProgInstall=Can-Clip 212 ve DTT2000data 2021-6-16 dahildir, güncel tutmayı unutmayın. -ua.AfterMyProgInstall=Can-Clip 212 і DTT2000data 2021-6-16 включені, не забувайте оновлювати їх. - -[Languages] -Name: "en"; MessagesFile: "C:\Program Files (x86)\Inno Setup 6\Default.isl" -Name: "no"; MessagesFile: "C:\Program Files (x86)\Inno Setup 6\Languages\Norwegian.isl" -Name: "de"; MessagesFile: "C:\Program Files (x86)\Inno Setup 6\Languages\German.isl" -Name: "fr"; MessagesFile: "C:\Program Files (x86)\Inno Setup 6\Languages\French.isl" -Name: "es"; MessagesFile: "C:\Program Files (x86)\Inno Setup 6\Languages\Spanish.isl" -Name: "it"; MessagesFile: "C:\Program Files (x86)\Inno Setup 6\Languages\Italian.isl" -Name: "nl"; MessagesFile: "C:\Program Files (x86)\Inno Setup 6\Languages\Dutch.isl" -Name: "pl"; MessagesFile: "C:\Program Files (x86)\Inno Setup 6\Languages\Polish.isl" -Name: "ptbr"; MessagesFile: "C:\Program Files (x86)\Inno Setup 6\Languages\BrazilianPortuguese.isl" -Name: "pt"; MessagesFile: "C:\Program Files (x86)\Inno Setup 6\Languages\Portuguese.isl" -Name: "ru"; MessagesFile: "C:\Program Files (x86)\Inno Setup 6\Languages\Russian.isl" -Name: "am"; MessagesFile: "C:\Program Files (x86)\Inno Setup 6\Languages\Armenian.isl" -Name: "bg"; MessagesFile: "C:\Program Files (x86)\Inno Setup 6\Languages\Bulgarian.isl" -Name: "tr"; MessagesFile: "C:\Program Files (x86)\Inno Setup 6\Languages\Turkish.isl" -Name: "ua"; MessagesFile: "C:\Program Files (x86)\Inno Setup 6\Languages\Ukrainian.isl"