Remove android stuff
This commit is contained in:
parent
e30a0cda65
commit
f25ef3718d
550
main.py
550
main.py
@ -52,43 +52,6 @@ if osname == 'nt':
|
||||
import serial
|
||||
except ImportError:
|
||||
pip.main(['install', 'pyserial'])
|
||||
try:
|
||||
import androidhelper as android
|
||||
|
||||
osname = 'android'
|
||||
except:
|
||||
try:
|
||||
import android
|
||||
|
||||
osname = 'android'
|
||||
except:
|
||||
pass
|
||||
|
||||
jnius_mode = False
|
||||
|
||||
if osname == 'android':
|
||||
try:
|
||||
from jnius import autoclass
|
||||
|
||||
jnius_mode = True
|
||||
|
||||
except ImportError:
|
||||
try:
|
||||
import pip
|
||||
except ImportError:
|
||||
pass
|
||||
# pip.main(['install', 'pyjnius-u4-qpython'])
|
||||
|
||||
if jnius_mode:
|
||||
try:
|
||||
BluetoothAdapter = autoclass('android.bluetooth.BluetoothAdapter')
|
||||
BluetoothDevice = autoclass('android.bluetooth.BluetoothDevice')
|
||||
BluetoothSocket = autoclass('android.bluetooth.BluetoothSocket')
|
||||
UUID = autoclass('java.util.UUID')
|
||||
except:
|
||||
print("Error while using jnius")
|
||||
sys.exit()
|
||||
|
||||
|
||||
def update_from_gitlab():
|
||||
try:
|
||||
@ -166,18 +129,6 @@ def getLangList():
|
||||
|
||||
def getPortList():
|
||||
ret = []
|
||||
if os.name != 'android':
|
||||
if jnius_mode:
|
||||
try:
|
||||
paired_devices = BluetoothAdapter.getDefaultAdapter().getBondedDevices().toArray()
|
||||
for device in paired_devices:
|
||||
desc = device.getName()
|
||||
de = str(desc.encode("ascii", "ignore"))
|
||||
ret.append('BT;' + de)
|
||||
except:
|
||||
ret.append('BT;')
|
||||
return ret
|
||||
|
||||
iterator = sorted(list(list_ports.comports()))
|
||||
for port, desc, hwid in iterator:
|
||||
try:
|
||||
@ -187,8 +138,6 @@ def getPortList():
|
||||
ret.append(port + ';')
|
||||
if '192.168.0.10:35000;WiFi' not in ret:
|
||||
ret.append('192.168.0.10:35000;WiFi')
|
||||
else:
|
||||
ret = ['BT', '192.168.0.10:35000']
|
||||
return ret
|
||||
|
||||
|
||||
@ -289,16 +238,14 @@ def run(s, cmd):
|
||||
cmdr.main()
|
||||
sys.exit()
|
||||
|
||||
|
||||
if osname != 'android':
|
||||
try:
|
||||
try:
|
||||
import serial
|
||||
from serial.tools import list_ports
|
||||
except ImportError:
|
||||
except ImportError:
|
||||
print("\n\n\n\tPleas install additional modules")
|
||||
print("\t\t>sudo easy_install pyserial")
|
||||
sys.exit()
|
||||
try:
|
||||
try:
|
||||
# Python2
|
||||
import tkinter as tk
|
||||
import tkinter.ttk
|
||||
@ -306,7 +253,7 @@ if osname != 'android':
|
||||
import tkinter.messagebox
|
||||
import tkinter.filedialog
|
||||
import tkinter.simpledialog
|
||||
except ImportError:
|
||||
except ImportError:
|
||||
# Python3
|
||||
import tkinter as tk
|
||||
import tkinter.ttk as ttk
|
||||
@ -315,7 +262,7 @@ if osname != 'android':
|
||||
import tkinter.filedialog
|
||||
|
||||
|
||||
class desktopGUI(tk.Frame):
|
||||
class desktopGUI(tk.Frame):
|
||||
|
||||
save = None
|
||||
|
||||
@ -866,11 +813,11 @@ if osname != 'android':
|
||||
pass
|
||||
|
||||
|
||||
def main():
|
||||
def main():
|
||||
gui = desktopGUI()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == '__main__':
|
||||
os.chdir(os.path.dirname(os.path.realpath(sys.argv[0])))
|
||||
if len(sys.argv)>1 and sys.argv[1]=='update':
|
||||
res = update_from_gitlab()
|
||||
@ -882,486 +829,3 @@ if osname != 'android':
|
||||
print( "UnZip error")
|
||||
exit()
|
||||
main()
|
||||
|
||||
else:
|
||||
class androidGUI():
|
||||
|
||||
save = None
|
||||
pl = []
|
||||
ll = []
|
||||
csvl = []
|
||||
|
||||
def cmd_Mon(self):
|
||||
self.saveSettings()
|
||||
self.droid.fullDismiss()
|
||||
run(self.save, 'mon')
|
||||
|
||||
def cmd_Check(self):
|
||||
self.saveSettings()
|
||||
self.droid.fullDismiss()
|
||||
run(self.save, 'check')
|
||||
|
||||
def cmd_Demo(self):
|
||||
self.saveSettings()
|
||||
self.droid.fullDismiss()
|
||||
run(self.save, 'demo')
|
||||
|
||||
def cmd_Scan(self):
|
||||
self.saveSettings()
|
||||
self.droid.fullDismiss()
|
||||
run(self.save, 'scan')
|
||||
|
||||
def cmd_Start(self):
|
||||
self.saveSettings()
|
||||
self.droid.fullDismiss()
|
||||
run(self.save, 'pyren')
|
||||
|
||||
def cmd_Term(self):
|
||||
self.saveSettings()
|
||||
self.droid.fullDismiss()
|
||||
run(self.save, 'term')
|
||||
|
||||
def cmd_PIDs(self):
|
||||
self.saveSettings()
|
||||
self.droid.fullDismiss()
|
||||
run(self.save, 'pids')
|
||||
|
||||
def cmd_Update(self):
|
||||
res = update_from_gitlab()
|
||||
if res == 0:
|
||||
self.droid.makeToast("Done")
|
||||
elif res == 1:
|
||||
self.droid.makeToast("No connection with gitlab.com")
|
||||
elif res == 2:
|
||||
self.droid.makeToast("UnZip error")
|
||||
|
||||
def saveSettings(self):
|
||||
self.save.path = self.pl[int(self.droid.fullQueryDetail("sp_version").result['selectedItemPosition'])]
|
||||
self.save.lang = self.ll[int(self.droid.fullQueryDetail("sp_language").result['selectedItemPosition'])]
|
||||
self.save.csvOption = self.csvl[int(self.droid.fullQueryDetail("sp_csv").result['selectedItemPosition'])]
|
||||
|
||||
if self.droid.fullQueryDetail("rb_bt").result['checked'] == 'false':
|
||||
self.save.port = '192.168.0.10:35000'
|
||||
else:
|
||||
portName = self.dev_list[int(self.droid.fullQueryDetail("in_wifi").result['selectedItemPosition'])]
|
||||
upPortName = portName.upper().split(';')[0]
|
||||
MAC = ''
|
||||
if re.match (r"^[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}$", upPortName) or \
|
||||
re.match (r"^[0-9A-F]{4}.[0-9A-F]{4}.[0-9A-F]{4}$", upPortName) or \
|
||||
re.match (r"^[0-9A-F]{12}$", upPortName):
|
||||
upPortName = upPortName.replace(':','').replace('.','')
|
||||
MAC = ':'.join (a + b for a, b in zip (upPortName[::2], upPortName[1::2]))
|
||||
self.save.port = MAC + ';' + 'BT'
|
||||
|
||||
self.save.speed = '38400'
|
||||
|
||||
self.save.logName = self.droid.fullQueryDetail("in_logname").result['text']
|
||||
|
||||
if self.droid.fullQueryDetail("cb_log").result['checked'] == 'false':
|
||||
self.save.log = False
|
||||
else:
|
||||
self.save.log = True
|
||||
|
||||
if self.droid.fullQueryDetail("cb_cfc").result['checked'] == 'false':
|
||||
self.save.cfc = False
|
||||
else:
|
||||
self.save.cfc = True
|
||||
|
||||
if self.droid.fullQueryDetail("cb_n1c").result['checked'] == 'false':
|
||||
self.save.n1c = False
|
||||
else:
|
||||
self.save.n1c = True
|
||||
|
||||
if self.droid.fullQueryDetail("cb_si").result['checked'] == 'false':
|
||||
self.save.si = False
|
||||
else:
|
||||
self.save.si = True
|
||||
|
||||
if self.droid.fullQueryDetail("cb_csv").result['checked'] == 'false':
|
||||
self.save.csv = False
|
||||
else:
|
||||
self.save.csv = True
|
||||
|
||||
if self.droid.fullQueryDetail("cb_dump").result['checked'] == 'false':
|
||||
self.save.dump = False
|
||||
else:
|
||||
self.save.dump = True
|
||||
|
||||
if self.droid.fullQueryDetail("cb_can2").result['checked'] == 'false':
|
||||
self.save.can2 = False
|
||||
else:
|
||||
self.save.can2 = True
|
||||
|
||||
self.save.options = self.droid.fullQueryDetail("in_options").result['text']
|
||||
|
||||
self.save.save()
|
||||
|
||||
def loadSettings(self):
|
||||
|
||||
pl = getPathList()
|
||||
if self.save.path in pl: pl.insert(0, pl.pop(pl.index(self.save.path)))
|
||||
self.droid.fullSetList("sp_version", pl)
|
||||
self.pl = pl
|
||||
|
||||
ll = getLangList()
|
||||
if self.save.lang in ll: ll.insert(0, ll.pop(ll.index(self.save.lang)))
|
||||
self.droid.fullSetList("sp_language", ll)
|
||||
self.ll = ll
|
||||
|
||||
csvl = csvOptions
|
||||
if self.save.csvOption in csvl: csvl.insert(0, csvl.pop(csvl.index(self.save.csvOption)))
|
||||
self.droid.fullSetList("sp_csv", csvl)
|
||||
self.csvl = csvl
|
||||
|
||||
if self.save.port == '':
|
||||
self.save.port = "192.168.0.10:35000;WiFi"
|
||||
self.dev_list.append(self.save.port)
|
||||
if self.save.port.upper().endswith('BT'):
|
||||
MAC = ""
|
||||
if ';' in self.save.port:
|
||||
MAC = self.save.port.split(';')[0]
|
||||
for d in self.dev_list:
|
||||
if MAC in d:
|
||||
self.dev_list.insert(0, self.dev_list.pop(self.dev_list.index(d)))
|
||||
|
||||
self.droid.fullSetProperty("rb_bt", "checked", "true")
|
||||
self.droid.fullSetProperty("rb_wifi", "checked", "false")
|
||||
self.droid.fullSetList("in_wifi", self.dev_list)
|
||||
else:
|
||||
self.droid.fullSetProperty("rb_bt", "checked", "false")
|
||||
self.droid.fullSetProperty("rb_wifi", "checked", "true")
|
||||
self.droid.fullSetList("in_wifi", self.dev_list)
|
||||
|
||||
self.droid.fullSetProperty("in_logname", "text", self.save.logName)
|
||||
if self.save.log:
|
||||
self.droid.fullSetProperty("cb_log", "checked", "true")
|
||||
else:
|
||||
self.droid.fullSetProperty("cb_log", "checked", "false")
|
||||
|
||||
if self.save.cfc:
|
||||
self.droid.fullSetProperty("cb_cfc", "checked", "true")
|
||||
else:
|
||||
self.droid.fullSetProperty("cb_cfc", "checked", "false")
|
||||
|
||||
if self.save.n1c:
|
||||
self.droid.fullSetProperty("cb_n1c", "checked", "true")
|
||||
else:
|
||||
self.droid.fullSetProperty("cb_n1c", "checked", "false")
|
||||
|
||||
if self.save.si:
|
||||
self.droid.fullSetProperty("cb_si", "checked", "true")
|
||||
else:
|
||||
self.droid.fullSetProperty("cb_si", "checked", "false")
|
||||
|
||||
if self.save.csv:
|
||||
self.droid.fullSetProperty("cb_csv", "checked", "true")
|
||||
else:
|
||||
self.droid.fullSetProperty("cb_csv", "checked", "false")
|
||||
|
||||
if self.save.dump:
|
||||
self.droid.fullSetProperty("cb_dump", "checked", "true")
|
||||
else:
|
||||
self.droid.fullSetProperty("cb_dump", "checked", "false")
|
||||
|
||||
if self.save.can2:
|
||||
self.droid.fullSetProperty("cb_can2", "checked", "true")
|
||||
else:
|
||||
self.droid.fullSetProperty("cb_can2", "checked", "false")
|
||||
|
||||
self.droid.fullSetProperty("in_options", "text", self.save.options)
|
||||
|
||||
lay = '''<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" >
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/launcher"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tx_Versions"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:text="Version"/>
|
||||
<Spinner
|
||||
android:id="@+id/sp_version"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@+id/tx_Versions" />
|
||||
<TextView
|
||||
android:id="@+id/tx_language"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@+id/sp_version"
|
||||
android:text="DB language" />
|
||||
<Spinner
|
||||
android:id="@+id/sp_language"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/tx_language"/>
|
||||
<TextView
|
||||
android:id="@+id/tx_elm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@+id/sp_language"
|
||||
android:text="ELM327" />
|
||||
<RadioGroup
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_below="@id/tx_elm"
|
||||
android:id="@+id/radioGroup">
|
||||
<RadioButton
|
||||
android:id="@id/rb_bt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:checked="true"
|
||||
android:text="BT" />
|
||||
<RadioButton
|
||||
android:id="@id/rb_wifi"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="false"
|
||||
android:text="WiFi" />
|
||||
</RadioGroup>
|
||||
<Spinner
|
||||
android:id="@+id/in_wifi"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_below="@id/tx_elm"
|
||||
android:layout_toRightOf="@id/radioGroup"
|
||||
android:layout_marginLeft="20dp" />
|
||||
<TextView
|
||||
android:id="@+id/tx_log"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@+id/radioGroup"
|
||||
android:text="Log" />
|
||||
<CheckBox
|
||||
android:id="@+id/cb_log"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/tx_log"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_toRightOf="@+id/tx_log"/>
|
||||
<EditText
|
||||
android:id="@+id/in_logname"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/tx_log"
|
||||
android:layout_toRightOf="@+id/cb_log"
|
||||
android:ems="10"
|
||||
android:text="log.txt" />
|
||||
<TextView
|
||||
android:id="@+id/tx_csv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@+id/in_logname"
|
||||
android:text="Data logging" />
|
||||
<CheckBox
|
||||
android:id="@+id/cb_csv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/tx_csv"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_alignLeft="@+id/cb_log" />
|
||||
<Spinner
|
||||
android:id="@+id/sp_csv"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/tx_csv"
|
||||
android:layout_toRightOf="@+id/cb_csv" />
|
||||
<TextView
|
||||
android:id="@+id/tx_can"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/sp_csv"
|
||||
android:text="CAN parameters" />
|
||||
<CheckBox
|
||||
android:id="@+id/cb_cfc"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/tx_can"
|
||||
android:layout_toRightOf="@id/tx_can"
|
||||
android:text="--cfc" />
|
||||
<CheckBox
|
||||
android:id="@+id/cb_n1c"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@id/cb_cfc"
|
||||
android:layout_toRightOf="@id/cb_cfc"
|
||||
android:layout_marginLeft="40dp"
|
||||
android:text="--n1c" />
|
||||
<TextView
|
||||
android:id="@+id/tx_iso"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/cb_cfc"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:text="K-line parameters" />
|
||||
<CheckBox
|
||||
android:id="@+id/cb_si"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/tx_iso"
|
||||
android:layout_alignLeft="@id/cb_cfc"
|
||||
android:text="--si (Prefer SlowInit)" />
|
||||
<TextView
|
||||
android:id="@+id/tx_options"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/cb_si"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:text="Other options" />
|
||||
<CheckBox
|
||||
android:id="@+id/cb_dump"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/tx_options"
|
||||
android:layout_toRightOf="@id/tx_options"
|
||||
android:text="Dump" />
|
||||
<CheckBox
|
||||
android:id="@+id/cb_can2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@id/cb_dump"
|
||||
android:layout_alignBottom="@id/cb_dump"
|
||||
android:layout_marginLeft="60dp"
|
||||
android:text="CAN2" />
|
||||
<EditText
|
||||
android:id="@+id/in_options"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/cb_dump"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:ems="10"
|
||||
android:inputType="textPersonName" />
|
||||
<Button
|
||||
android:id="@+id/bt_start"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@id/in_options"
|
||||
android:text="Start" />
|
||||
<Button
|
||||
android:id="@+id/bt_scan"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@id/bt_start"
|
||||
android:layout_below="@id/in_options"
|
||||
android:text="Scan" />
|
||||
<Button
|
||||
android:id="@+id/bt_demo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/in_options"
|
||||
android:layout_toRightOf="@id/bt_scan"
|
||||
android:text="Demo" />
|
||||
<Button
|
||||
android:id="@+id/bt_check"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/bt_start"
|
||||
android:layout_alignParentRight="true"
|
||||
android:text="ChkELM" />
|
||||
<Button
|
||||
android:id="@+id/bt_mon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/bt_start"
|
||||
android:layout_toLeftOf="@id/bt_check"
|
||||
android:text="Monitor" />
|
||||
<Button
|
||||
android:id="@+id/bt_term"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/bt_start"
|
||||
android:layout_toLeftOf="@+id/bt_mon"
|
||||
android:text="Macro" />
|
||||
<Button
|
||||
android:id="@+id/bt_pids"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/bt_start"
|
||||
android:layout_toLeftOf="@+id/bt_term"
|
||||
android:text="PIDs" />
|
||||
<Button
|
||||
android:id="@+id/bt_update"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_below="@id/in_options"
|
||||
android:text="Update" />
|
||||
</RelativeLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</RelativeLayout>'''
|
||||
|
||||
def eventloop(self):
|
||||
while True:
|
||||
event = self.droid.eventWait(50).result
|
||||
if event == None: continue
|
||||
if event["name"] == "click":
|
||||
id = event["data"]["id"]
|
||||
if id == "bt_start":
|
||||
self.cmd_Start()
|
||||
elif id == "bt_scan":
|
||||
self.cmd_Scan()
|
||||
elif id == "bt_demo":
|
||||
self.cmd_Demo()
|
||||
elif id == "bt_check":
|
||||
self.cmd_Check()
|
||||
elif id == "bt_mon":
|
||||
self.cmd_Mon()
|
||||
elif id == "bt_term":
|
||||
self.cmd_Term()
|
||||
elif id == "bt_pids":
|
||||
self.cmd_PIDs()
|
||||
elif id == "bt_update":
|
||||
self.cmd_Update()
|
||||
|
||||
def __init__(self):
|
||||
self.save = settings()
|
||||
try:
|
||||
self.droid = android.Android()
|
||||
self.droid.fullShow(self.lay)
|
||||
self.dev_list = ['192.168.0.10:35000;WiFi']
|
||||
try:
|
||||
tmp = self.droid.bluetoothGetBondedDevices().result
|
||||
for i in range(0, len(tmp), 2):
|
||||
self.dev_list.append( tmp[i]+';'+tmp[i+1])
|
||||
except:
|
||||
pass
|
||||
self.loadSettings()
|
||||
self.eventloop()
|
||||
finally:
|
||||
self.droid.fullDismiss()
|
||||
|
||||
def __del__(self):
|
||||
self.droid.fullDismiss()
|
||||
|
||||
|
||||
def main():
|
||||
gui = androidGUI()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
||||
# os.chdir(os.path.dirname(os.path.realpath(sys.argv[0])))
|
||||
main()
|
||||
|
@ -140,7 +140,7 @@ def optParser():
|
||||
|
||||
options = parser.parse_args()
|
||||
|
||||
if not options.port and mod_globals.os != 'android':
|
||||
if not options.port:
|
||||
parser.print_help()
|
||||
iterator = sorted(list(list_ports.comports()))
|
||||
print("")
|
||||
|
@ -49,24 +49,13 @@ if mod_globals.os == 'nt':
|
||||
print("\n\n\n\t\t\tGive me access to the Internet for download modules\n\n\n")
|
||||
sys.exit()
|
||||
colorama.init()
|
||||
else:
|
||||
# let's try android
|
||||
try:
|
||||
import androidhelper as android
|
||||
mod_globals.os = 'android'
|
||||
except:
|
||||
try:
|
||||
import android
|
||||
mod_globals.os = 'android'
|
||||
except:
|
||||
pass
|
||||
|
||||
if mod_globals.os != 'android':
|
||||
try:
|
||||
|
||||
try:
|
||||
import serial
|
||||
from serial.tools import list_ports
|
||||
#import ply
|
||||
except ImportError:
|
||||
except ImportError:
|
||||
print("\n\n\n\tPleas install additional modules")
|
||||
print("\t\t>sudo easy_install pyserial")
|
||||
#print "\t\t>sudo easy_install ply"
|
||||
@ -346,7 +335,7 @@ def optParser():
|
||||
|
||||
options = parser.parse_args()
|
||||
|
||||
if options.outfile=='' and not options.port and mod_globals.os != 'android':
|
||||
if options.outfile=='' and not options.port:
|
||||
parser.print_help()
|
||||
iterator = sorted(list(list_ports.comports()))
|
||||
print("")
|
||||
|
@ -33,7 +33,7 @@ parser.add_argument(
|
||||
|
||||
options = parser.parse_args()
|
||||
|
||||
if not options.port and mod_globals.os != 'android':
|
||||
if not options.port:
|
||||
parser.print_help()
|
||||
|
||||
try:
|
||||
|
@ -125,20 +125,9 @@ cmdb = '''
|
||||
os.chdir(os.path.dirname(os.path.realpath(sys.argv[0])))
|
||||
|
||||
try:
|
||||
import androidhelper as android
|
||||
mod_globals.os = 'android'
|
||||
except:
|
||||
try:
|
||||
import android
|
||||
mod_globals.os = 'android'
|
||||
except:
|
||||
pass
|
||||
|
||||
if mod_globals.os != 'android':
|
||||
try:
|
||||
import serial
|
||||
from serial.tools import list_ports
|
||||
except ImportError:
|
||||
except ImportError:
|
||||
sys.exit()
|
||||
|
||||
from mod_elm import ELM
|
||||
|
@ -18,20 +18,9 @@ import pyren3
|
||||
os.chdir(os.path.dirname(os.path.realpath(sys.argv[0])))
|
||||
|
||||
try:
|
||||
import androidhelper as android
|
||||
mod_globals.os = 'android'
|
||||
except:
|
||||
try:
|
||||
import android
|
||||
mod_globals.os = 'android'
|
||||
except:
|
||||
pass
|
||||
|
||||
if mod_globals.os != 'android':
|
||||
try:
|
||||
import serial
|
||||
from serial.tools import list_ports
|
||||
except ImportError:
|
||||
except ImportError:
|
||||
sys.exit()
|
||||
|
||||
from mod_elm import ELM
|
||||
|
@ -12,20 +12,9 @@ import pyren3
|
||||
os.chdir(os.path.dirname(os.path.realpath(sys.argv[0])))
|
||||
|
||||
try:
|
||||
import androidhelper as android
|
||||
mod_globals.os = 'android'
|
||||
except:
|
||||
try:
|
||||
import android
|
||||
mod_globals.os = 'android'
|
||||
except:
|
||||
pass
|
||||
|
||||
if mod_globals.os != 'android':
|
||||
try:
|
||||
import serial
|
||||
from serial.tools import list_ports
|
||||
except ImportError:
|
||||
except ImportError:
|
||||
sys.exit()
|
||||
|
||||
from mod_elm import ELM
|
||||
@ -148,7 +137,7 @@ def main():
|
||||
print(pyren_encode(string))
|
||||
tot += str(num); tot += '\n'
|
||||
print()
|
||||
if mod_globals.os != 'android':
|
||||
|
||||
print(pyren_encode('Listening to CAN. Please wait a bit...'))
|
||||
elm.cmd('at z')
|
||||
elm.cmd("at e1")
|
||||
|
@ -90,24 +90,12 @@ if mod_globals.os == 'nt':
|
||||
import serial
|
||||
import colorama
|
||||
colorama.init()
|
||||
else:
|
||||
# let's try android
|
||||
try:
|
||||
import androidhelper as android
|
||||
mod_globals.os = 'android'
|
||||
except:
|
||||
try:
|
||||
import android
|
||||
mod_globals.os = 'android'
|
||||
except:
|
||||
pass
|
||||
|
||||
if mod_globals.os != 'android':
|
||||
try:
|
||||
try:
|
||||
import serial
|
||||
from serial.tools import list_ports
|
||||
#import ply
|
||||
except ImportError:
|
||||
except ImportError:
|
||||
print("\n\n\n\tPleas install additional modules")
|
||||
print("\t\t>sudo easy_install pyserial")
|
||||
sys.exit()
|
||||
|
@ -1,85 +0,0 @@
|
||||
#
|
||||
#
|
||||
# Initialisation macros for mod_term
|
||||
#
|
||||
#
|
||||
|
||||
$addr = 7A
|
||||
$txa = 7E0
|
||||
$rxa = 7E8
|
||||
|
||||
# reset elm
|
||||
reset_elm {
|
||||
at ws
|
||||
$prompt = ELM
|
||||
}
|
||||
|
||||
# general CAN init
|
||||
init_can {
|
||||
reset_elm #macro
|
||||
at e1
|
||||
at s0
|
||||
at h0
|
||||
at l0
|
||||
at al
|
||||
at caf0
|
||||
at cfc0
|
||||
at sh $txa
|
||||
at cra $rxa
|
||||
at fc sh $txa
|
||||
at fc sd 30 00 00
|
||||
at fc sm 1
|
||||
$prompt = CAN
|
||||
}
|
||||
|
||||
# CAN 250 init
|
||||
can250 {
|
||||
init_can
|
||||
at st ff
|
||||
at at 0
|
||||
at sp 8
|
||||
at at 1
|
||||
$prompt = CAN250
|
||||
}
|
||||
|
||||
# CAN 500 init
|
||||
can500 {
|
||||
init_can
|
||||
at st ff
|
||||
at at 0
|
||||
at sp 6
|
||||
at at 1
|
||||
$prompt = CAN500
|
||||
}
|
||||
|
||||
# general ISO init
|
||||
init_iso {
|
||||
reset_elm #macro
|
||||
at e1
|
||||
at l1
|
||||
at d1
|
||||
at sh 81 $addr f1
|
||||
at sw 96
|
||||
at wm 81 $addr f1 3E
|
||||
#at wm 82 $addr f1 3E01
|
||||
at ib10
|
||||
at st ff
|
||||
at at 0
|
||||
$prompt = KL
|
||||
}
|
||||
|
||||
# K-Line slow init
|
||||
slow {
|
||||
init_iso
|
||||
at sp 4
|
||||
at at 1
|
||||
$prompt = SLOW
|
||||
}
|
||||
|
||||
# K-Line fast init
|
||||
fast {
|
||||
init_iso
|
||||
at sp 5
|
||||
at at 1
|
||||
$prompt = FAST
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
# Cornering_Inhibition ON/OFF
|
||||
|
||||
$addr = 27
|
||||
|
||||
can500 # init can macro
|
||||
|
||||
delay 1
|
||||
|
||||
# open session
|
||||
|
||||
session 10C0
|
||||
|
||||
# configuration
|
||||
|
||||
xor_bits 0425 4 4 80 80
|
@ -1,15 +0,0 @@
|
||||
# DRLInhibitByFlasher ON/OFF
|
||||
|
||||
$addr = 27
|
||||
|
||||
can500 # init can macro
|
||||
|
||||
delay 1
|
||||
|
||||
# open session
|
||||
|
||||
session 10C0
|
||||
|
||||
# configuration
|
||||
|
||||
xor_bits 0054 4 4 80 80
|
@ -1,10 +0,0 @@
|
||||
# Day running light off
|
||||
$addr = 26
|
||||
|
||||
init_can_500 # init can macro
|
||||
|
||||
10C0
|
||||
3BA01800
|
||||
|
||||
exit
|
||||
|
@ -1,9 +0,0 @@
|
||||
# Car wipers manual control, not managed by rain sensor
|
||||
$addr = 26
|
||||
|
||||
init_can_500 # init can macro
|
||||
|
||||
10C0
|
||||
3BA01200
|
||||
|
||||
exit
|
@ -1,23 +0,0 @@
|
||||
#Accoustics for R2_08_v3_81
|
||||
$addr = 13
|
||||
|
||||
init_can_500 # init can macro
|
||||
|
||||
delay 2
|
||||
|
||||
# open session
|
||||
10C0
|
||||
|
||||
#Phone acoustic parameters
|
||||
2E2B250101705AC7400401701800029402950064E0A00073C0003333030B00005AA10000000810082E2D38DD6A86000000000FFF00310004B0239C31E6E0B775239C6798E6E039961F941E0E3D36B70CD6A096531E0E76B1FF80B76A37F6CA7D3EB7412E37F6403B070461FD7F40FFFF07043B0061FD900000000000000502950000747EC3402C00CCCC0003027F8DCEFFFF000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
|
||||
#Accoustic Driver
|
||||
2E2B2B3E9B522F0001FFFAFDDA0164FE002C973E9B511E0001FFF4FDD302CCFC00164C00003E9B732D0001FFF4FE7803E0FE002C973E9B5B490001FFECFE1104FFFC00164C0000000040000001000000004000C0004000000040000001000000004000C0004000000040000001000000004000C0004000000040000001000000004000C00040000000400040000001000000004000C0004000400040000001000000004000C0004000400040000001000000004000C0004000400040000001000000004000C000400000002D43400000010000FFE9006FFF8021043FE8400000010000FFD200EFFF0014F63FDA40000001FFFFFFB5018EFE001C223FBE400000010044FF7D0044FF8041C23F0140000001FFE2FE1507A1F80024513DB440000001FF88FBBE0D0EF00024C900003D5B40000001FE33FB362B9EE000182B3DD740000001FEB6FC2E262BC0000EC836A140000001F0F8F1D166ABC0001F234F8C400000010BC6FC463076E000547B3FE440000001004BFFCB0122FF005FD73FE640000001FFFFFFCE03B8FE0017BE00002C4740000001000000004000C00040003FEC400000010000FFD90167FF00166C3FF5400000010000FFEC0052FF8017093DC940000001FF98FBD30BC3F0001CFF00003DB040000001FEE1FBA01F18F0001B043E1040000001FED3FC6B26CAE00013293FBE400000010044FF7D0044FF8041C23B1940000001F81BF7B36709B0000FB900000600060006000600200000000001000020000000000100002000000000010000200000000001000000000000003F00000000003F16A700000001000016A7000000010000
|
||||
|
||||
#Accoustic Whole car
|
||||
2E2B2C3E9B522F0001FFFAFDDA0164FE002C973E9B511E0001FFF4FDD302CCFC00164C00003E9B732D0001FFF4FE7803E0FE002C973E9B5B490001FFECFE1104FFFC00164C0000000040000001000000004000C0004000000040000001000000004000C0004000000040000001000000004000C0004000000040000001000000004000C00040000000400040000001000000004000C0004000400040000001000000004000C0004000400040000001000000004000C0004000400040000001000000004000C000400000002D43400000010000FFE9006FFF8021043FE8400000010000FFD200EFFF0014F63FDA40000001FFFFFFB5018EFE001C223FBE400000010044FF7D0044FF8041C23F0140000001FFE2FE1507A1F80024513DB440000001FF88FBBE0D0EF00024C900003D5B40000001FE33FB362B9EE000182B3DD740000001FEB6FC2E262BC0000EC836A140000001F0F8F1D166ABC0001F234F8C400000010BC6FC463076E000547B3FE440000001004BFFCB0122FF005FD73FE640000001FFFFFFCE03B8FE0017BE00002C4740000001000000004000C00040003FEC400000010000FFD90167FF00166C3FF5400000010000FFEC0052FF8017093DC940000001FF98FBD30BC3F0001CFF00003DB040000001FEE1FBA01F18F0001B043E1040000001FED3FC6B26CAE00013293FBE400000010044FF7D0044FF8041C23B1940000001F81BF7B36709B0000FB900000600060006000600200000000001000020000000000100002000000000010000200000000001000000000000003F00000000003F16A700000001000016A7000000010000
|
||||
|
||||
#Radio reception
|
||||
2E2B2D00011E1422241A14280D0A081F0F020206020408300301010001001430121220121400800100640A050F011402080A043C0F0F140F321E3250050F0009120A8CE10A5A5A0384300101063C961401C80000050000000100000000
|
||||
|
||||
exit
|
@ -1,81 +0,0 @@
|
||||
|
||||
# QR25 Idle speed correction
|
||||
$addr = 7A
|
||||
|
||||
init_can_500 # init can macro
|
||||
|
||||
# check ECU
|
||||
|
||||
exit_if_not 83 26 8 FF 44
|
||||
exit_if_not 83 26 17 FF 43
|
||||
|
||||
:checkeng
|
||||
goto_if 1201 5 4 FFFF 0000 runeng
|
||||
|
||||
goto engisrun
|
||||
|
||||
:runeng
|
||||
|
||||
cls
|
||||
#
|
||||
# Run ENGINE
|
||||
#
|
||||
|
||||
if_key q end
|
||||
wait 1
|
||||
goto checkeng
|
||||
|
||||
:engisrun
|
||||
cls
|
||||
var lastResponse = $lastResponse
|
||||
#
|
||||
# Idle Speed
|
||||
#
|
||||
value 1201 5 4 FFFF 25 0 2
|
||||
#
|
||||
# ECU is running
|
||||
#
|
||||
# Select correction
|
||||
#
|
||||
# Press:
|
||||
# 0 reset
|
||||
# 1 +25
|
||||
# 2 +50
|
||||
# 3 +75
|
||||
# 4 +100
|
||||
#
|
||||
# q for Exit
|
||||
#
|
||||
|
||||
if_key 0 key0
|
||||
if_key 1 key1
|
||||
if_key 2 key2
|
||||
if_key 3 key3
|
||||
if_key 4 key4
|
||||
if_key q end
|
||||
wait 1
|
||||
goto engisrun
|
||||
|
||||
:key0
|
||||
3B0200
|
||||
goto engisrun
|
||||
|
||||
:key1
|
||||
3B0202
|
||||
goto engisrun
|
||||
|
||||
:key2
|
||||
3B0204
|
||||
goto engisrun
|
||||
|
||||
:key3
|
||||
3B0206
|
||||
goto engisrun
|
||||
|
||||
:key4
|
||||
3B0208
|
||||
goto engisrun
|
||||
|
||||
:end
|
||||
|
||||
exit
|
@ -1,18 +0,0 @@
|
||||
# Repair script for rlink2 black screen
|
||||
$addr = 13
|
||||
|
||||
init_can_500 # init can macro
|
||||
|
||||
1003
|
||||
|
||||
# check if it is rlink2
|
||||
exit_if_not F18A 6 4 FFFFFF 434150
|
||||
|
||||
# HIGH 1 768x1024
|
||||
2E2303032802131303003C000004500014001E001E040011C5002C006967
|
||||
|
||||
wait 2
|
||||
# reload rlink2
|
||||
1101
|
||||
|
||||
exit
|
@ -1,18 +0,0 @@
|
||||
# Repair script for rlink2 black screen
|
||||
$addr = 13
|
||||
|
||||
init_can_500 # init can macro
|
||||
|
||||
1003
|
||||
|
||||
# check if it is rlink2
|
||||
exit_if_not F18A 6 4 FFFFFF 434150
|
||||
|
||||
# HIGH 2 768x1024
|
||||
2E2303032802131303003C000004500014001E001E040014E8002C006967
|
||||
|
||||
wait 2
|
||||
# reload rlink2
|
||||
1101
|
||||
|
||||
exit
|
@ -1,18 +0,0 @@
|
||||
# Repair script for rlink2 black screen
|
||||
$addr = 13
|
||||
|
||||
init_can_500 # init can macro
|
||||
|
||||
1003
|
||||
|
||||
# check if it is rlink2
|
||||
exit_if_not F18A 6 4 FFFFFF 434150
|
||||
|
||||
# MID 1 480x800
|
||||
2E230301F404080801E03C0000039D000A0005006E03200AD7022C006967
|
||||
|
||||
wait 2
|
||||
# reload rlink2
|
||||
1101
|
||||
|
||||
exit
|
@ -1,18 +0,0 @@
|
||||
# Repair script for rlink2 black screen
|
||||
$addr = 13
|
||||
|
||||
init_can_500 # init can macro
|
||||
|
||||
1003
|
||||
|
||||
# check if it is rlink2
|
||||
exit_if_not F18A 6 4 FFFFFF 434150
|
||||
|
||||
# MID 2 480x800
|
||||
2E2303020D02082301E03C000004200080000A007603200D05062C006967
|
||||
|
||||
wait 2
|
||||
# reload rlink2
|
||||
1101
|
||||
|
||||
exit
|
@ -1,18 +0,0 @@
|
||||
# Enable AndroidAuto and CarPlay on R-Link2
|
||||
$addr = 13
|
||||
|
||||
init_can_500 # init can macro
|
||||
|
||||
1003
|
||||
|
||||
# check if it is rlink2
|
||||
exit_if_not F18A 6 4 FFFFFF 434150
|
||||
|
||||
set_bits 2130 10 5 60 60
|
||||
|
||||
wait 2
|
||||
|
||||
# reload rlink2
|
||||
1101
|
||||
|
||||
exit
|
@ -1,17 +0,0 @@
|
||||
# Rotate R-Link2 screen
|
||||
$addr = 13
|
||||
|
||||
init_can_500 # init can macro
|
||||
|
||||
1003
|
||||
|
||||
exit_if_not F18A 6 4 FFFFFF 434150
|
||||
|
||||
xor_bits 2130 10 4 10 10
|
||||
|
||||
wait 2
|
||||
|
||||
# reload rlink2
|
||||
1101
|
||||
|
||||
exit
|
@ -1,19 +0,0 @@
|
||||
# Phone_acoustic and SPVR for RadNav 3.3 and 7.0
|
||||
$addr = 13
|
||||
|
||||
init_can_500 # init can macro
|
||||
|
||||
delay 2
|
||||
|
||||
1003
|
||||
|
||||
# SPVR
|
||||
2E213105B8000122030000000000000002000000000000000042534420535345204261736963205369676E616C70726F63657373696E672044617461204352433A3058393931363830373720000000000000000000000000000000000200000000000A0D0A10000000000000000C0000000B0000000100000001000000010000000000000000000000D00000001E100D0A5353455F4D41494E5F436F6E66696700380000000606060606030403030303030303030303030304030303030403030303030303030303030303030303030303030306060303030603030303FB01000100401F8000000001000000000000000200000002000000020000000200000001000000000000000100000000000000010000000100000001000000030000000000000001000000010000000100000003000000000000000100000001000000000000000200000001000000010000000100000001000000020000000000000001000000000000000100000001000000020000000200000000000000010000000100000002000000010000000100A00F010000000100000000000000000001000000010000000100000002000000000A0D0AC5010000000A0D0A0F00000000000000040000000B000000010000000100000001000000000000000000000018000000030F0D0A5353455F4147435F436F6E666967000C000000050505050505050505050505480000A8FD00001CF39001E8032003E80374FF74FFC800C800000A0D0AB4090000000A0D0A1300000000000000010000000B00000001000000010000000100000000000000000000000C00000062100D0A5353455F414E414C5F4D6963436F6E66696700040000000505030314792879280000000000000000000A0D0A42010000000A0D0A1300000000000000010000000B00000001000000010000000100000000000000000000000C00000066100D0A5353455F414E414C5F526566436F6E66696700040000000505030314007D007D00000000FA000000000A0D0AF4010000000A0D0A0E000000000000000E0000000B000000010000000100000001000000000000000000000008000000D10E0D0A5353455F4E525F436F6E6669670004000000050505051818FC0000112B73FF000A0D0AC2020000000A0D0A1000000000000000010000000B00000001000000010000000100000000000000000000001E000000900F0D0A5353455F4E525F4E66436F6E666967000F0000000505050505050505050505050505055A18FCF4011405D4FE00000000000001000000000064000000881C16FD30F8000A0D0A38070000000A0D0A1500000000000000000000000200000001000000010000001C000000000000000000000070000000DA110D0A5353455F524543565F46696C746572466C6F617400000000400000D0410000A040D36A783F378EECBFF3C6613F861BECBF6A175B3FAB78833F7A53E1BF11AA683F7A53E1BF899B6F3F48C37D3F0343C6BF77DC6C3F0343C6BFBE9F6A3FE4DA843F4A43CDBE1843393F4A43CDBE23F9423FF6EE8B3F4017DD3E50195F3EDECB053F1591613E000A0D0A22310000000A0D0A1300000000000000040000000B00000001000000010000000100000000000000000000001800000037100D0A5353455F524543565F414743436F6E666967000C0000000505050505050505050505054800000000000000005802E8032003E80374FF74FFC800C800000A0D0AC9060000000A0D0A1100000000000000020000000B000000010000000100000001000000000000000000000018000000CE0F0D0A5353455F53594E54485F436F6E6669670007000000030303030305052001000000FF7F00000100000064000000F2060000A00FD007000A0D0A62040000000A0D0A1200000000000000000000000500000001000000010000000F00000000000000000000001E00000014100D0A5353455F53594E54485F45514E6F646573002800FA001AFC5E01C8006400F401C80018FC1C02C8002C01C4095802F001000A0D0ABF090000999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
||||
|
||||
# Phone acoustic
|
||||
2E211806F6000122030000000000000002000000000000000042534420535345204261736963205369676E616C70726F63657373696E672044617461204352433A3058464245463842463020000000000000000000000000000000000200000000000A0D0A10000000000000000C0000000B0000000100000001000000010000000000000000000000D00000001E100D0A5353455F4D41494E5F436F6E66696700380000000606060606030403030303030303030303030304030303030403030303030303030303030303030303030303030306060303030603030303FB01000100401F8000000001000000000000000200000002000000020000000200000002000000000000000200000000000000010000000100000001000000030000000000000001000000010000000100000003000000000000000100000001000000000000000200000001000000020000000100000001000000020000000000000001000000000000000100000001000000020000000200000000000000010000000100000002000000010000000100A00F010000000100000000000000000001000000010000000100000002000000000A0D0AC8010000000A0D0A0F00000000000000060000000B0000000100000001000000010000000000000000000000A20000008D0F0D0A5353455F4145435F436F6E66696700500000000505050505050505050505050505050505050505050505050505050505050505050505050305050505050505050505050505050505050505050505050505050505050505050505050505050505050505DE44000100BA03A6FD56FF30FF56FF62FF30FF82FF2B01B8FF930BCAFF2B0162FF0E07D00730FF30FF3EFF3EFF4DFF55029600B0FF2C014C1D2E01D10FE803E80300F430F8A1FF43D05A0000000E07D0075A02E80203F10600B4045A02B404D007B404E803D0075A02B4045A02B40445FDCD00CDFCCD00CD049AFFBC0244FD2AFF660006EEC0F1C0E030F890E817F835FF1A030000BA03D4FE64002E01D10F00003A00000A0D0A45450000000A0D0A0F00000000000000040000000B000000010000000100000001000000000000000000000018000000030F0D0A5353455F4147435F436F6E666967000C000000050505050505050505050505480000A8FD00008CF19001E8032003E80374FF74FFC800C800000A0D0A220A0000000A0D0A1300000000000000010000000B00000001000000010000000100000000000000000000000C00000062100D0A5353455F414E414C5F4D6963436F6E66696700040000000505030314792879280000000000000000000A0D0A42010000000A0D0A1300000000000000010000000B00000001000000010000000100000000000000000000000C00000066100D0A5353455F414E414C5F526566436F6E66696700040000000505030314007D007D74000000FA000000000A0D0A68020000000A0D0A0E000000000000000E0000000B000000010000000100000001000000000000000000000008000000D10E0D0A5353455F4E525F436F6E6669670004000000050505051850FB0000112B73FF000A0D0AF9020000000A0D0A1000000000000000010000000B00000001000000010000000100000000000000000000001E000000900F0D0A5353455F4E525F4E66436F6E666967000F0000000505050505050505050505050505055A50FBF4011405000000000000000001000000000064000000881C16FD30F8000A0D0A9D050000000A0D0A1500000000000000000000000200000001000000010000001C000000000000000000000070000000DA110D0A5353455F524543565F46696C746572466C6F617400000000400000D0410000A04071916F3F6C78B2BF1BBD0E3F02B7AEBF5FD1053FFCFB903FB56CDDBF6153433FB56CDDBF8C4B653F2F8B8D3F349DC5BFB01E473F349DC5BF0D35623F779D613F37AA3FBF986B393F37AA3FBFFF081B3FF12EC73FA66429BF444FA23EAA25223D72F92F3E000A0D0A2B2F0000000A0D0A1300000000000000040000000B00000001000000010000000100000000000000000000001800000037100D0A5353455F524543565F414743436F6E666967000C000000050505050505050505050505485802A8FD000000005802E8032003E80374FF74FFC800C800000A0D0AC8080000000A0D0A1100000000000000020000000B000000010000000100000001000000000000000000000018000000CE0F0D0A5353455F53594E54485F436F6E6669670007000000030303030305052001000000FF7F00000100000064000000F2060000A00FD007000A0D0A62040000000A0D0A1200000000000000000000000500000001000000010000000F00000000000000000000001E00000014100D0A5353455F53594E54485F45514E6F646573002800FA0018FC5E01C8006600F401C80018FC1C02C8002D01C4095802F801000A0D0AC8090000999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
||||
|
||||
# reload rlink2
|
||||
1101
|
||||
|
||||
exit
|
File diff suppressed because one or more lines are too long
@ -1,7 +0,0 @@
|
||||
|
||||
# terminal
|
||||
$addr = 7A
|
||||
|
||||
init_can_500 # init can macro
|
||||
|
||||
session 10C0
|
@ -11,21 +11,14 @@ db_dir_list = [
|
||||
".",
|
||||
".."
|
||||
]
|
||||
android_dir_list = [
|
||||
"/mnt/sdcard/pyren"
|
||||
]
|
||||
|
||||
def find_DBs():
|
||||
|
||||
global db_dir_list
|
||||
global android_dir_list
|
||||
|
||||
clip_found = False
|
||||
ddt_found = False
|
||||
|
||||
if mod_globals.os == 'android':
|
||||
db_dir_list = db_dir_list + android_dir_list
|
||||
|
||||
for clip_dir in db_dir_list:
|
||||
if os.path.exists(os.path.join(clip_dir, 'Vehicles')) and \
|
||||
os.path.exists(os.path.join(clip_dir, 'Location')) and \
|
||||
@ -42,13 +35,6 @@ def find_DBs():
|
||||
clip_found = True
|
||||
break
|
||||
|
||||
if mod_globals.os == 'android':
|
||||
if not clip_found:
|
||||
print("ERROR: CLIP DB not found")
|
||||
exit()
|
||||
else:
|
||||
return
|
||||
|
||||
for ddt_dir in db_dir_list:
|
||||
if os.path.exists(os.path.join(ddt_dir, 'DDT2000data', 'ecus')):
|
||||
mod_globals.ddt_arc = ""
|
||||
@ -71,7 +57,6 @@ def find_DBs():
|
||||
print('CLIP DB :',mod_globals.cliproot)
|
||||
if ddt_found:
|
||||
print('DDT DB :',mod_globals.ddtroot)
|
||||
if mod_globals.os != 'android':
|
||||
mod_globals.opt_ddt = True
|
||||
|
||||
#check cache version
|
||||
@ -144,8 +129,7 @@ def get_file_from_clip( filename ):
|
||||
else:
|
||||
mode = 'r'
|
||||
|
||||
if (mod_globals.os == 'android'
|
||||
or mod_globals.clip_arc != ''):
|
||||
if mod_globals.clip_arc != '':
|
||||
mode = 'r'
|
||||
|
||||
if mod_globals.clip_arc=='':
|
||||
|
@ -56,26 +56,11 @@ if mod_globals.os == 'nt':
|
||||
except ImportError:
|
||||
pip.main(['install', 'pyserial'])
|
||||
|
||||
else:
|
||||
# let's try android
|
||||
try:
|
||||
import androidhelper as android
|
||||
|
||||
mod_globals.os = 'android'
|
||||
except:
|
||||
try:
|
||||
import android
|
||||
|
||||
mod_globals.os = 'android'
|
||||
except:
|
||||
pass
|
||||
|
||||
if mod_globals.os != 'android':
|
||||
try:
|
||||
try:
|
||||
import serial
|
||||
from serial.tools import list_ports
|
||||
# import ply
|
||||
except ImportError:
|
||||
except ImportError:
|
||||
print("\n\n\n\tPleas install additional modules")
|
||||
print("\t\t>sudo easy_install pyserial")
|
||||
sys.exit()
|
||||
@ -247,7 +232,7 @@ def optParser():
|
||||
|
||||
options = parser.parse_args()
|
||||
|
||||
if not options.port and mod_globals.os != 'android':
|
||||
if not options.port:
|
||||
parser.print_help()
|
||||
iterator = sorted(list(list_ports.comports()))
|
||||
print("")
|
||||
|
@ -27,13 +27,12 @@ from mod_elm import AllowedList
|
||||
os.chdir(os.path.dirname(os.path.realpath(sys.argv[0])))
|
||||
|
||||
import mod_globals
|
||||
if mod_globals.os != 'android':
|
||||
import mod_ddt_screen
|
||||
try:
|
||||
import mod_ddt_screen
|
||||
try:
|
||||
# Python2
|
||||
import tkinter as tk
|
||||
import tkinter.ttk
|
||||
except ImportError:
|
||||
except ImportError:
|
||||
# Python3
|
||||
import tkinter as tk
|
||||
import tkinter.ttk as ttk
|
||||
|
@ -8,8 +8,7 @@ import mod_db_manager
|
||||
from operator import itemgetter
|
||||
from copy import deepcopy
|
||||
|
||||
if mod_globals.os != 'android':
|
||||
import serial
|
||||
import serial
|
||||
|
||||
try:
|
||||
import pickle as pickle
|
||||
|
@ -112,9 +112,6 @@ def get_default_std_a( df, mn, se, elm, calc, getDTCmnemo ):
|
||||
interpretation = ''
|
||||
|
||||
description = df[dtc].label
|
||||
if mod_globals.os=='android':
|
||||
defstr = "%-6s(DTC%-6s) %-41s %-6s %-10s"%(df[dtc].agcdRef,dtc+status,description,interpretation,isAlive)
|
||||
else:
|
||||
defstr = "%-6s(DTC%-6s) %-50s %-6s %-10s"%(df[dtc].agcdRef,dtc+status,description,interpretation,isAlive)
|
||||
|
||||
hlpstr = ''
|
||||
@ -225,9 +222,6 @@ def get_default_std_b( df, mn, se, elm, calc, getDTCmnemo ):
|
||||
|
||||
description = df[dtc].label
|
||||
|
||||
if mod_globals.os=='android':
|
||||
defstr = "DTC%-6s (%s) %-41s %-6s %-10s"%(dtc+dtcType,df[dtc].agcdRef,description,interpretation,isAlive)
|
||||
else:
|
||||
defstr = "DTC%-6s (%s) %-50s %-6s %-10s"%(dtc+dtcType,df[dtc].agcdRef,description,interpretation,isAlive)
|
||||
|
||||
stBitsDef = ['warningIndicatorRequested',
|
||||
@ -333,9 +327,6 @@ def get_default_failflag( df, mn, se, elm, calc ):
|
||||
interpretation = ""
|
||||
|
||||
description = df[dtc].label
|
||||
if mod_globals.os=='android':
|
||||
defstr = "%-6s %-41s %-6s %-10s"%(df[dtc].agcdRef,description,interpretation,isAlive)
|
||||
else:
|
||||
defstr = "%-6s %-50s %-6s %-10s"%(df[dtc].agcdRef,description,interpretation,isAlive)
|
||||
|
||||
hlpstr = ''
|
||||
|
@ -20,9 +20,6 @@ def get_identification( id, mn, se, elm, calc, raw = False ):
|
||||
if id.type=='CSTRING' and type(id.value) is str:
|
||||
id.value = id.value #.decode('ascii', 'ignore')
|
||||
######
|
||||
if mod_globals.os=='android':
|
||||
return "%-6s %-40s %-20s"%(id.codeMR,id.label,id.value), id.helps, id.value
|
||||
else:
|
||||
return "%-6s %-50s %-20s"%(id.codeMR,id.label,id.value), id.helps, id.value
|
||||
|
||||
class ecu_identification:
|
||||
|
@ -42,9 +42,6 @@ def get_parameter( pr, mn, se, elm, calc, dataids = {} ):
|
||||
tmpmin = ''
|
||||
tmpmax = ''
|
||||
|
||||
if mod_globals.os=='android':
|
||||
return "%-6s %-41s %8s %-5s"%(pr.codeMR,pr.label,pr.value,pr.unit), pr.helps, csv_data
|
||||
else:
|
||||
return "%-6s %-50s %5s %10s %-10s %-5s"%(pr.codeMR,pr.label,tmpmin,pr.value,pr.unit,tmpmax), pr.helps, csv_data
|
||||
|
||||
|
||||
|
@ -28,10 +28,6 @@ def get_state( st, mn, se, elm, calc, dataids = {} ):
|
||||
else:
|
||||
csv_val = str(st.value)
|
||||
|
||||
if mod_globals.os=='android':
|
||||
st.value = " "*(8-len(st.value)//2) + str(st.value)
|
||||
return "%-6s %-41s %-16s"%(st.codeMR,st.label,st.value), st.helps, csv_val
|
||||
else:
|
||||
st.value = " "*(16-len(st.value)//2) + str(st.value)
|
||||
return "%-6s %-50s %-20s"%(st.codeMR,st.label,st.value), st.helps, csv_val
|
||||
|
||||
|
@ -14,21 +14,8 @@ import socket
|
||||
from datetime import datetime
|
||||
from collections import OrderedDict
|
||||
|
||||
try:
|
||||
import androidhelper as android
|
||||
|
||||
mod_globals.os = 'android'
|
||||
except:
|
||||
try:
|
||||
import android
|
||||
|
||||
mod_globals.os = 'android'
|
||||
except:
|
||||
pass
|
||||
|
||||
if mod_globals.os != 'android':
|
||||
import serial # sudo easy_install pyserial
|
||||
from serial.tools import list_ports
|
||||
import serial # sudo easy_install pyserial
|
||||
from serial.tools import list_ports
|
||||
|
||||
# List of commands which may require to open another Developer session (option --dev)
|
||||
DevList = ['27', '28', '2E', '30', '31', '32', '34', '35', '36', '37', '3B', '3D']
|
||||
@ -176,7 +163,7 @@ class Port:
|
||||
upPortName = upPortName.replace(':','').replace('.','')
|
||||
MAC = ':'.join (a + b for a, b in zip (upPortName[::2], upPortName[1::2]))
|
||||
|
||||
if mod_globals.os != 'android' and MAC:
|
||||
if MAC:
|
||||
try:
|
||||
self.macaddr = portName
|
||||
self.channel = 1
|
||||
@ -203,30 +190,6 @@ class Port:
|
||||
print(" \n\nERROR: Can't connect to WiFi ELM\n\n")
|
||||
mod_globals.opt_demo = True
|
||||
sys.exit()
|
||||
elif mod_globals.os == 'android' and ( portName == 'bt' or MAC != None ):
|
||||
self.portType = 2
|
||||
self.droid = android.Android ()
|
||||
if self.droid:
|
||||
print('SL4A loaded')
|
||||
print( 'BT is enabled:', self.droid.toggleBluetoothState (True).result)
|
||||
print( 'BT discovery canceled:', self.droid.bluetoothDiscoveryCancel().result)
|
||||
retry = 0
|
||||
while 1:
|
||||
time.sleep(1)
|
||||
retry = retry + 1
|
||||
try:
|
||||
if MAC == None:
|
||||
self.btcid = self.droid.bluetoothConnect ('00001101-0000-1000-8000-00805F9B34FB').result
|
||||
else:
|
||||
self.btcid = self.droid.bluetoothConnect (uuid='00001101-0000-1000-8000-00805F9B34FB', address=MAC).result
|
||||
except:
|
||||
pass
|
||||
print( 'Try ',retry, ":", self.btcid )
|
||||
if self.btcid != None and len(self.btcid) > 10: #uuid length greater then 10
|
||||
break
|
||||
if retry > 5:
|
||||
print( " \n\nERROR: Can't connect to BT adapter" )
|
||||
exit()
|
||||
else:
|
||||
self.portName = portName
|
||||
self.portType = 0
|
||||
|
@ -274,26 +274,6 @@ class ScanEcus:
|
||||
|
||||
listecu = []
|
||||
|
||||
if mod_globals.os == 'android':
|
||||
if mod_globals.opt_scan:
|
||||
print(pyren_encode( "\n %-40s %s" % ("Name","Warn") ))
|
||||
else:
|
||||
print(pyren_encode( "\n %-40s %s" % ("Name","Type") ))
|
||||
|
||||
for row in self.detectedEcus:
|
||||
if families[row['idf']] in list(mod_globals.language_dict.keys()):
|
||||
fmlyn = mod_globals.language_dict[families[row['idf']]]
|
||||
if mod_globals.opt_scan:
|
||||
line = "%-40s %s" % (fmlyn,row['rerr'])
|
||||
else:
|
||||
line = "%-40s %s" % (fmlyn,row['stdType'])
|
||||
else:
|
||||
if mod_globals.opt_scan:
|
||||
line = "%-40s %s" % (row['doc'].strip(),row['rerr'])
|
||||
else:
|
||||
line = "%-40s %s" % (row['doc'].strip(),row['stdType'])
|
||||
listecu.append( line )
|
||||
else:
|
||||
if mod_globals.opt_scan:
|
||||
print(pyren_encode( "\n %-7s %-6s %-5s %-40s %s" % ("Addr","Family","Index","Name","Warn") ))
|
||||
else:
|
||||
|
@ -45,25 +45,11 @@ if mod_globals.os == 'nt':
|
||||
print("\n\n\n\t\t\tGive me access to the Internet for download modules\n\n\n")
|
||||
sys.exit()
|
||||
colorama.init()
|
||||
else:
|
||||
# let's try android
|
||||
try:
|
||||
import androidhelper as android
|
||||
|
||||
mod_globals.os = 'android'
|
||||
except:
|
||||
try:
|
||||
import android
|
||||
|
||||
mod_globals.os = 'android'
|
||||
except:
|
||||
pass
|
||||
|
||||
if mod_globals.os != 'android':
|
||||
try:
|
||||
try:
|
||||
import serial
|
||||
from serial.tools import list_ports
|
||||
except ImportError:
|
||||
except ImportError:
|
||||
print("\n\n\n\tPleas install additional modules")
|
||||
print("\t\t>sudo easy_install pyserial")
|
||||
sys.exit()
|
||||
@ -260,7 +246,7 @@ def optParser():
|
||||
|
||||
options = parser.parse_args()
|
||||
|
||||
if not options.port and mod_globals.os != 'android':
|
||||
if not options.port:
|
||||
parser.print_help()
|
||||
iterator = sorted(list(list_ports.comports()))
|
||||
print("")
|
||||
@ -285,73 +271,6 @@ def optParser():
|
||||
debug_mode = options.dbg
|
||||
|
||||
class FileChooser():
|
||||
lay = '''<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent" >
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/launcher"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tx_folder"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="Folder"/>
|
||||
<Spinner
|
||||
android:id="@+id/sp_folder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_below="@+id/tx_folder"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tx_macro"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_below="@+id/sp_folder"
|
||||
android:text="Macro" />
|
||||
<Spinner
|
||||
android:id="@+id/sp_macro"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/tx_macro"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_exit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginTop="50dp"
|
||||
android:layout_below="@id/sp_macro"
|
||||
android:text="Exit" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_start"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="50dp"
|
||||
android:layout_marginLeft="100dp"
|
||||
android:layout_below="@id/sp_macro"
|
||||
android:layout_toRightOf="@id/bt_exit"
|
||||
android:text="Start" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</RelativeLayout>'''
|
||||
droid = None
|
||||
folderList = []
|
||||
macroList = []
|
||||
@ -384,17 +303,6 @@ class FileChooser():
|
||||
self.folder = fo
|
||||
|
||||
def choose(self):
|
||||
try:
|
||||
import androidhelper as android
|
||||
mod_globals.os = 'android'
|
||||
except:
|
||||
try:
|
||||
import android
|
||||
mod_globals.os = 'android'
|
||||
except:
|
||||
pass
|
||||
|
||||
if mod_globals.os != 'android':
|
||||
try:
|
||||
# Python2
|
||||
import tkinter as tk
|
||||
@ -418,16 +326,6 @@ class FileChooser():
|
||||
|
||||
return fname
|
||||
|
||||
else:
|
||||
try:
|
||||
self.droid = android.Android()
|
||||
self.droid.fullShow(self.lay)
|
||||
self.folderList.insert(0,'./macro/')
|
||||
self.droid.fullSetList("sp_folder", self.folderList)
|
||||
return self.eventloop()
|
||||
finally:
|
||||
self.droid.fullDismiss()
|
||||
|
||||
def play_macro(mname, elm):
|
||||
global macro
|
||||
global var
|
||||
|
@ -266,9 +266,6 @@ def pyren_decode( inp ):
|
||||
# return inp.decode(sys.stdout.encoding, errors='replace')
|
||||
|
||||
def pyren_decode_i( inp ):
|
||||
if mod_globals.os == 'android':
|
||||
return inp.decode('utf-8', errors='ignore')
|
||||
else:
|
||||
return inp.decode(sys.stdout.encoding, errors='ignore')
|
||||
|
||||
def clearScreen():
|
||||
|
@ -28,24 +28,13 @@ if mod_globals.os == 'nt':
|
||||
print("\n\n\n\t\t\tGive me access to the Internet for download modules\n\n\n")
|
||||
sys.exit()
|
||||
colorama.init()
|
||||
else:
|
||||
# let's try android
|
||||
try:
|
||||
import androidhelper as android
|
||||
mod_globals.os = 'android'
|
||||
except:
|
||||
try:
|
||||
import android
|
||||
mod_globals.os = 'android'
|
||||
except:
|
||||
pass
|
||||
|
||||
if mod_globals.os != 'android':
|
||||
try:
|
||||
|
||||
try:
|
||||
import serial
|
||||
from serial.tools import list_ports
|
||||
#import ply
|
||||
except ImportError:
|
||||
except ImportError:
|
||||
print("\n\n\n\tPleas install additional modules")
|
||||
print("\t\t>sudo easy_install pyserial")
|
||||
#print "\t\t>sudo easy_install ply"
|
||||
@ -222,7 +211,7 @@ def optParser():
|
||||
|
||||
options = parser.parse_args()
|
||||
|
||||
if not options.port and mod_globals.os != 'android':
|
||||
if not options.port:
|
||||
parser.print_help()
|
||||
iterator = sorted(list(list_ports.comports()))
|
||||
print("")
|
||||
|
Loading…
x
Reference in New Issue
Block a user