# Title: CARIAD-Routing GUI # Author: Johannes Ziegmann # Mail: johannes.ziegmann@cariad.technology # Date: 10.12.2021 # Description: CARIAD-Routing GUI for showing the request details graphically distributed on map # ToDo: Shell Script (ADB commands) with Time Delta (sleep()) import sys import os import time import subprocess from datetime import datetime from PyQt5 import QtCore, QtWidgets from PyQt5.QtCore import * from PyQt5.QtWidgets import * from PyQt5.QtWebEngineWidgets import QWebEngineView # Creating the main window class App(QMainWindow): def __init__(self): super().__init__() self.title = 'HCP3 ADB Commands (JZ)' self.setWindowTitle(self.title) self.setGeometry(250, 250, 1050, 1000) self.tab_widget = MyTabWidget(self) self.setCentralWidget(self.tab_widget) self.show() # Creating tab widgets class MyTabWidget(QWidget): def __init__(self, parent): super(QWidget, self).__init__(parent) self.layout = QVBoxLayout(self) # Initialize tab screen self.tabs = QTabWidget() self.tab1 = QWidget() self.tab2 = QWidget() self.tab3 = QWidget() self.tab4 = QWidget() self.tab1UI() self.tab2UI() self.tab3UI() self.tab4UI() # Add tabs to widget self.layout.addWidget(self.tabs) self.setLayout(self.layout) ### tab MAP ############################################# def tab1UI(self): self.tabs.addTab(self.tab1, "Map") pushButton_Width = 250 pushButton_Height = 30 self.pushButton_setStart = QPushButton() self.pushButton_setStart.setGeometry(QtCore.QRect(10, 10, pushButton_Width, pushButton_Height)) self.pushButton_setStart.setFixedSize(pushButton_Width,pushButton_Height) self.pushButton_setStart.setObjectName("pushButton_setStart") self.pushButton_setStart.clicked.connect(self.setStart) self.pushButton_setStart.setText("set CCP") self.pushButton_setDestination = QPushButton() self.pushButton_setDestination.setGeometry(QtCore.QRect(10, 55, pushButton_Width, pushButton_Height)) self.pushButton_setDestination.setFixedSize(pushButton_Width,pushButton_Height) self.pushButton_setDestination.setObjectName("pushButton_setDestination") self.pushButton_setDestination.clicked.connect(self.setDestination) self.pushButton_setDestination.setText("set destination") self.pushButton_playRouteFromNav = QPushButton() self.pushButton_playRouteFromNav.setGeometry(QtCore.QRect(360, 10, pushButton_Width, pushButton_Height)) self.pushButton_playRouteFromNav.setFixedSize(pushButton_Width,pushButton_Height) self.pushButton_playRouteFromNav.setObjectName("pushButton_playRouteFromNav") self.pushButton_playRouteFromNav.clicked.connect(self.payRouteFromNav) self.pushButton_playRouteFromNav.setText("play Route from nav.") self.label_map = QWebEngineView(self.tab1)#(ui.centralwidget) self.label_map.setGeometry(QtCore.QRect(10, 90, 1010, 860)) local_url = QUrl.fromLocalFile(os.path.abspath("./map_TT.html")) self.label_map.load(local_url) self.label_map.setWindowTitle('QWebEngineView') self.label_map.show() self.label_map.setZoomFactor(1.5) self.dial = QScrollBar() self.dial.setMinimum(0) self.dial.setMaximum(360) self.dial.setValue(0) self.dial.setSingleStep(5) self.dial.setPageStep(5) self.dial.setStyleSheet("background : lightgrey;") self.dial.setFixedSize(200,20) self.dial.setOrientation(Qt.Horizontal) self.dial.valueChanged.connect(self.sliderMoved) # creating a label self.headingLabel = QLabel() self.headingLabel.setFixedSize(200,pushButton_Height) #self.headingLabel.setGeometry(220, 125, 200, 60) self.headingLabel.setText(" heading: " + str(self.dial.value()) + " deg") vbox = QVBoxLayout() vbox.addWidget(self.pushButton_setStart) vbox.addWidget(self.pushButton_setDestination) hbox = QHBoxLayout() hbox.addLayout(vbox) vbox = QVBoxLayout() vbox.addWidget(self.dial) vbox.addWidget(self.headingLabel) hbox.addLayout(vbox) hbox.addWidget(self.pushButton_playRouteFromNav) vbox = QVBoxLayout() vbox.addLayout(hbox) vbox.addWidget(self.label_map) self.tab1.setLayout(vbox) def sliderMoved(self): self.headingLabel.setText(" heading: " + str(self.dial.value()) + " deg") self.label_map.page().runJavaScript("rotation = " + str(self.dial.value())) self.label_map.page().runJavaScript("updateHeading()") #print("Dial value = %i" % (self.dial.value())) def setStart(self): self.label_map.page().runJavaScript('returnS()', self.js_callbackS) def js_callbackS(self, result): self.coordinates_start = result print("Set CCP position: %s" %result) adb_command = ("adb shell am broadcast -a de.esolutions.navigation.SET_POSITION --ef latitude %f --ef longitude %f --ef bearing %d"%(result['lat'],result['lng'],self.dial.value())) print("===> " + adb_command) # am broadcast -a de.esolutions.navigation.SET_POSITION --ef latitude 48.762156 --ef longitude 11.42541 --ef bearing 99 subprocess.call(adb_command, shell=True) self.adb_command = adb_command self.record() def setDestination(self): self.label_map.page().runJavaScript('returnD()', self.js_callbackD) def js_callbackD(self, result): self.coordinates_destination = result print("Set destination position: %s" %result) adb_command = ("adb shell am start -a android.intent.action.VIEW -d google.navigation:q=%f,%f"%(result['lat'],result['lng'])) print("===> " + adb_command) # am broadcast -a de.esolutions.navigation.SET_POSITION --ef latitude 48.762156 --ef longitude 11.42541 subprocess.call(adb_command, shell=True) self.adb_command = adb_command self.record() def payRouteFromNav(self): print("Play Route from Navigation:") adb_command = ("adb shell am broadcast -a de.esolutions.navigation.REPLAY_ROUTE") print("===> " + adb_command) subprocess.call(adb_command, shell=True) self.adb_command = adb_command self.record() ### tab Vehicle ############################################# def tab2UI(self): self.tabs.addTab(self.tab2, "Vehicle") pushButton_Width = 350 pushButton_Height = 35 textEdit_width_small = 50 textEdit_height_small = 35 diff_width = 10 diff_height = 10 self.pushButton_consumptionVelocity = QPushButton() self.pushButton_consumptionVelocity.setGeometry(QtCore.QRect(diff_width, diff_height, pushButton_Width, pushButton_Height)) self.pushButton_consumptionVelocity.setFixedSize(pushButton_Width,pushButton_Height) self.pushButton_consumptionVelocity.setObjectName("pushButton_consumptionVelocity") self.pushButton_consumptionVelocity.clicked.connect(self.consumptionVelocity) self.pushButton_consumptionVelocity.setText("set velocity [km/h]") self.textEdit_VELOCITY_VALUE_1 = QTextEdit() self.textEdit_VELOCITY_VALUE_1.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*0,diff_height, textEdit_width_small, textEdit_height_small)) self.textEdit_VELOCITY_VALUE_1.setFixedSize(textEdit_width_small,textEdit_height_small) self.textEdit_VELOCITY_VALUE_1.setObjectName("textEdit_VELOCITY_VALUE_1") self.textEdit_VELOCITY_VALUE_1.setPlaceholderText('VELOCITY_VALUE_1') self.textEdit_VELOCITY_VALUE_1.setText('28.0') self.textEdit_VELOCITY_VALUE_2 = QTextEdit() self.textEdit_VELOCITY_VALUE_2.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*1,diff_height, textEdit_width_small, textEdit_height_small)) self.textEdit_VELOCITY_VALUE_2.setFixedSize(textEdit_width_small,textEdit_height_small) self.textEdit_VELOCITY_VALUE_2.setObjectName("textEdit_VELOCITY_VALUE_2") self.textEdit_VELOCITY_VALUE_2.setPlaceholderText('VELOCITY_VALUE_2') self.textEdit_VELOCITY_VALUE_2.setText('44.0') self.textEdit_VELOCITY_VALUE_3 = QTextEdit() self.textEdit_VELOCITY_VALUE_3.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*2,diff_height, textEdit_width_small, textEdit_height_small)) self.textEdit_VELOCITY_VALUE_3.setFixedSize(textEdit_width_small,textEdit_height_small) self.textEdit_VELOCITY_VALUE_3.setObjectName("textEdit_VELOCITY_VALUE_3") self.textEdit_VELOCITY_VALUE_3.setPlaceholderText('VELOCITY_VALUE_3') self.textEdit_VELOCITY_VALUE_3.setText('60.0') self.textEdit_VELOCITY_VALUE_4 = QTextEdit() self.textEdit_VELOCITY_VALUE_4.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*3,diff_height, textEdit_width_small, textEdit_height_small)) self.textEdit_VELOCITY_VALUE_4.setFixedSize(textEdit_width_small,textEdit_height_small) self.textEdit_VELOCITY_VALUE_4.setObjectName("textEdit_VELOCITY_VALUE_4") self.textEdit_VELOCITY_VALUE_4.setPlaceholderText('VELOCITY_VALUE_4') self.textEdit_VELOCITY_VALUE_4.setText('76.0') self.textEdit_VELOCITY_VALUE_5 = QTextEdit() self.textEdit_VELOCITY_VALUE_5.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*4,diff_height, textEdit_width_small, textEdit_height_small)) self.textEdit_VELOCITY_VALUE_5.setFixedSize(textEdit_width_small,textEdit_height_small) self.textEdit_VELOCITY_VALUE_5.setObjectName("textEdit_VELOCITY_VALUE_5") self.textEdit_VELOCITY_VALUE_5.setPlaceholderText('VELOCITY_VALUE_5') self.textEdit_VELOCITY_VALUE_5.setText('90.0') self.textEdit_VELOCITY_VALUE_6 = QTextEdit() self.textEdit_VELOCITY_VALUE_6.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*5,diff_height, textEdit_width_small, textEdit_height_small)) self.textEdit_VELOCITY_VALUE_6.setFixedSize(textEdit_width_small,textEdit_height_small) self.textEdit_VELOCITY_VALUE_6.setObjectName("textEdit_VELOCITY_VALUE_6") self.textEdit_VELOCITY_VALUE_6.setPlaceholderText('VELOCITY_VALUE_6') self.textEdit_VELOCITY_VALUE_6.setText('110.0') self.textEdit_VELOCITY_VALUE_7 = QTextEdit() self.textEdit_VELOCITY_VALUE_7.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*6,diff_height, textEdit_width_small, textEdit_height_small)) self.textEdit_VELOCITY_VALUE_7.setFixedSize(textEdit_width_small,textEdit_height_small) self.textEdit_VELOCITY_VALUE_7.setObjectName("textEdit_VELOCITY_VALUE_7") self.textEdit_VELOCITY_VALUE_7.setPlaceholderText('VELOCITY_VALUE_7') self.textEdit_VELOCITY_VALUE_7.setText('130.0') self.textEdit_VELOCITY_VALUE_8 = QTextEdit() self.textEdit_VELOCITY_VALUE_8.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*7,diff_height, textEdit_width_small, textEdit_height_small)) self.textEdit_VELOCITY_VALUE_8.setFixedSize(textEdit_width_small,textEdit_height_small) self.textEdit_VELOCITY_VALUE_8.setObjectName("textEdit_VELOCITY_VALUE_8") self.textEdit_VELOCITY_VALUE_8.setPlaceholderText('VELOCITY_VALUE_8') self.textEdit_VELOCITY_VALUE_8.setText('150.0') self.textEdit_VELOCITY_VALUE_9 = QTextEdit() self.textEdit_VELOCITY_VALUE_9.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*8,diff_height, textEdit_width_small, textEdit_height_small)) self.textEdit_VELOCITY_VALUE_9.setFixedSize(textEdit_width_small,textEdit_height_small) self.textEdit_VELOCITY_VALUE_9.setObjectName("textEdit_VELOCITY_VALUE_9") self.textEdit_VELOCITY_VALUE_9.setPlaceholderText('VELOCITY_VALUE_9') self.textEdit_VELOCITY_VALUE_9.setText('180.0') self.textEdit_VELOCITY_VALUE_10 = QTextEdit() self.textEdit_VELOCITY_VALUE_10.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*9,diff_height, textEdit_width_small, textEdit_height_small)) self.textEdit_VELOCITY_VALUE_10.setFixedSize(textEdit_width_small,textEdit_height_small) self.textEdit_VELOCITY_VALUE_10.setObjectName("textEdit_VELOCITY_VALUE_10") self.textEdit_VELOCITY_VALUE_10.setPlaceholderText('VELOCITY_VALUE_10') self.textEdit_VELOCITY_VALUE_10.setText('210.0') #zeilen Nr zz = 1 self.pushButton_speedConsumption = QPushButton() self.pushButton_speedConsumption.setGeometry(QtCore.QRect(diff_width, (diff_height+pushButton_Height)*zz, pushButton_Width, pushButton_Height)) self.pushButton_speedConsumption.setFixedSize(pushButton_Width,pushButton_Height) self.pushButton_speedConsumption.setObjectName("pushButton_speedConsumption") self.pushButton_speedConsumption.clicked.connect(self.speedConsumption) self.pushButton_speedConsumption.setText("set consumption [kWh/100km]") self.textEdit_CONSUMPTION_VALUE_1 = QTextEdit() self.textEdit_CONSUMPTION_VALUE_1.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*0,(diff_height+pushButton_Height)*zz, textEdit_width_small, textEdit_height_small)) self.textEdit_CONSUMPTION_VALUE_1.setFixedSize(textEdit_width_small,textEdit_height_small) self.textEdit_CONSUMPTION_VALUE_1.setObjectName("textEdit_CONSUMPTION_VALUE_1") self.textEdit_CONSUMPTION_VALUE_1.setPlaceholderText('CONSUMPTION_VALUE_1') self.textEdit_CONSUMPTION_VALUE_1.setText('11.77') self.textEdit_CONSUMPTION_VALUE_2 = QTextEdit() self.textEdit_CONSUMPTION_VALUE_2.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*1,(diff_height+pushButton_Height)*zz, textEdit_width_small, textEdit_height_small)) self.textEdit_CONSUMPTION_VALUE_2.setFixedSize(textEdit_width_small,textEdit_height_small) self.textEdit_CONSUMPTION_VALUE_2.setObjectName("textEdit_CONSUMPTION_VALUE_2") self.textEdit_CONSUMPTION_VALUE_2.setPlaceholderText('CONSUMPTION_VALUE_2') self.textEdit_CONSUMPTION_VALUE_2.setText('13.75') self.textEdit_CONSUMPTION_VALUE_3 = QTextEdit() self.textEdit_CONSUMPTION_VALUE_3.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*2,(diff_height+pushButton_Height)*zz, textEdit_width_small, textEdit_height_small)) self.textEdit_CONSUMPTION_VALUE_3.setFixedSize(textEdit_width_small,textEdit_height_small) self.textEdit_CONSUMPTION_VALUE_3.setObjectName("textEdit_CONSUMPTION_VALUE_3") self.textEdit_CONSUMPTION_VALUE_3.setPlaceholderText('CONSUMPTION_VALUE_3') self.textEdit_CONSUMPTION_VALUE_3.setText('15.62') self.textEdit_CONSUMPTION_VALUE_4 = QTextEdit() self.textEdit_CONSUMPTION_VALUE_4.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*3,(diff_height+pushButton_Height)*zz, textEdit_width_small, textEdit_height_small)) self.textEdit_CONSUMPTION_VALUE_4.setFixedSize(textEdit_width_small,textEdit_height_small) self.textEdit_CONSUMPTION_VALUE_4.setObjectName("textEdit_CONSUMPTION_VALUE_4") self.textEdit_CONSUMPTION_VALUE_4.setPlaceholderText('CONSUMPTION_VALUE_4') self.textEdit_CONSUMPTION_VALUE_4.setText('16.39') self.textEdit_CONSUMPTION_VALUE_5 = QTextEdit() self.textEdit_CONSUMPTION_VALUE_5.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*4,(diff_height+pushButton_Height)*zz, textEdit_width_small, textEdit_height_small)) self.textEdit_CONSUMPTION_VALUE_5.setFixedSize(textEdit_width_small,textEdit_height_small) self.textEdit_CONSUMPTION_VALUE_5.setObjectName("textEdit_CONSUMPTION_VALUE_5") self.textEdit_CONSUMPTION_VALUE_5.setPlaceholderText('CONSUMPTION_VALUE_5') self.textEdit_CONSUMPTION_VALUE_5.setText('17.82') self.textEdit_CONSUMPTION_VALUE_6 = QTextEdit() self.textEdit_CONSUMPTION_VALUE_6.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*5,(diff_height+pushButton_Height)*zz, textEdit_width_small, textEdit_height_small)) self.textEdit_CONSUMPTION_VALUE_6.setFixedSize(textEdit_width_small,textEdit_height_small) self.textEdit_CONSUMPTION_VALUE_6.setObjectName("textEdit_CONSUMPTION_VALUE_6") self.textEdit_CONSUMPTION_VALUE_6.setPlaceholderText('CONSUMPTION_VALUE_6') self.textEdit_CONSUMPTION_VALUE_6.setText('21.45') self.textEdit_CONSUMPTION_VALUE_7 = QTextEdit() self.textEdit_CONSUMPTION_VALUE_7.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*6,(diff_height+pushButton_Height)*zz, textEdit_width_small, textEdit_height_small)) self.textEdit_CONSUMPTION_VALUE_7.setFixedSize(textEdit_width_small,textEdit_height_small) self.textEdit_CONSUMPTION_VALUE_7.setObjectName("textEdit_CONSUMPTION_VALUE_7") self.textEdit_CONSUMPTION_VALUE_7.setPlaceholderText('CONSUMPTION_VALUE_7') self.textEdit_CONSUMPTION_VALUE_7.setText('26.51') self.textEdit_CONSUMPTION_VALUE_8 = QTextEdit() self.textEdit_CONSUMPTION_VALUE_8.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*7,(diff_height+pushButton_Height)*zz, textEdit_width_small, textEdit_height_small)) self.textEdit_CONSUMPTION_VALUE_8.setFixedSize(textEdit_width_small,textEdit_height_small) self.textEdit_CONSUMPTION_VALUE_8.setObjectName("textEdit_CONSUMPTION_VALUE_8") self.textEdit_CONSUMPTION_VALUE_8.setPlaceholderText('CONSUMPTION_VALUE_8') self.textEdit_CONSUMPTION_VALUE_8.setText('32.67') self.textEdit_CONSUMPTION_VALUE_9 = QTextEdit() self.textEdit_CONSUMPTION_VALUE_9.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*8,(diff_height+pushButton_Height)*zz, textEdit_width_small, textEdit_height_small)) self.textEdit_CONSUMPTION_VALUE_9.setFixedSize(textEdit_width_small,textEdit_height_small) self.textEdit_CONSUMPTION_VALUE_9.setObjectName("textEdit_CONSUMPTION_VALUE_9") self.textEdit_CONSUMPTION_VALUE_9.setPlaceholderText('CONSUMPTION_VALUE_9') self.textEdit_CONSUMPTION_VALUE_9.setText('43.89') self.textEdit_CONSUMPTION_VALUE_10 = QTextEdit() self.textEdit_CONSUMPTION_VALUE_10.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*9,(diff_height+pushButton_Height)*zz, textEdit_width_small, textEdit_height_small)) self.textEdit_CONSUMPTION_VALUE_10.setFixedSize(textEdit_width_small,textEdit_height_small) self.textEdit_CONSUMPTION_VALUE_10.setObjectName("textEdit_CONSUMPTION_VALUE_10") self.textEdit_CONSUMPTION_VALUE_10.setPlaceholderText('CONSUMPTION_VALUE_10') self.textEdit_CONSUMPTION_VALUE_10.setText('57.53') #zeilen Nr zz = 2 self.pushButton_consumptionFactorDrivingProfile = QPushButton() self.pushButton_consumptionFactorDrivingProfile.setGeometry(QtCore.QRect(diff_width, (diff_height+pushButton_Height)*zz, pushButton_Width, pushButton_Height)) self.pushButton_consumptionFactorDrivingProfile.setFixedSize(pushButton_Width,pushButton_Height) self.pushButton_consumptionFactorDrivingProfile.setObjectName("pushButton_consumptionFactorDrivingProfile") self.pushButton_consumptionFactorDrivingProfile.clicked.connect(self.consumptionFactorDrivingProfile) self.pushButton_consumptionFactorDrivingProfile.setText("consumption factor driving profile []") self.textEdit_consumptionFactorDrivingProfile = QTextEdit() self.textEdit_consumptionFactorDrivingProfile.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*0,(diff_height+pushButton_Height)*zz, textEdit_width_small*3+2*diff_width, pushButton_Height)) self.textEdit_consumptionFactorDrivingProfile.setFixedSize(textEdit_width_small*3+diff_width,pushButton_Height) self.textEdit_consumptionFactorDrivingProfile.setObjectName("textEdit_consumptionFactorDrivingProfile") self.textEdit_consumptionFactorDrivingProfile.setPlaceholderText('consumption factor driving profile') self.textEdit_consumptionFactorDrivingProfile.setText('1') #zeilen Nr zz = 3 self.pushButton_comfortConsumersConsumption = QPushButton() self.pushButton_comfortConsumersConsumption.setGeometry(QtCore.QRect(diff_width, (diff_height+pushButton_Height)*zz, pushButton_Width, pushButton_Height)) self.pushButton_comfortConsumersConsumption.setFixedSize(pushButton_Width,pushButton_Height) self.pushButton_comfortConsumersConsumption.setObjectName("pushButton_comfortConsumersConsumption") self.pushButton_comfortConsumersConsumption.clicked.connect(self.comfortConsumersConsumption) self.pushButton_comfortConsumersConsumption.setText("comfort consumers consumption [kW]") self.textEdit_comfortConsumersConsumption = QTextEdit() self.textEdit_comfortConsumersConsumption.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*0,(diff_height+pushButton_Height)*zz, textEdit_width_small*3+2*diff_width, pushButton_Height)) self.textEdit_comfortConsumersConsumption.setFixedSize(textEdit_width_small*3+diff_width,pushButton_Height) self.textEdit_comfortConsumersConsumption.setObjectName("textEdit_comfortConsumersConsumption") self.textEdit_comfortConsumersConsumption.setPlaceholderText('comfortConsumersConsumption') self.textEdit_comfortConsumersConsumption.setText('1') #zeilen Nr zz = 4 self.pushButton_residualConsumersConsumption = QPushButton() self.pushButton_residualConsumersConsumption.setGeometry(QtCore.QRect(diff_width, (diff_height+pushButton_Height)*zz, pushButton_Width, pushButton_Height)) self.pushButton_residualConsumersConsumption.setFixedSize(pushButton_Width,pushButton_Height) self.pushButton_residualConsumersConsumption.setObjectName("pushButton_residualConsumersConsumption") self.pushButton_residualConsumersConsumption.clicked.connect(self.residualConsumersConsumption) self.pushButton_residualConsumersConsumption.setText("residual consumers consumption [kW]") self.textEdit_residualConsumersConsumption = QTextEdit() self.textEdit_residualConsumersConsumption.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*0,(diff_height+pushButton_Height)*zz, textEdit_width_small*3+2*diff_width, pushButton_Height)) self.textEdit_residualConsumersConsumption.setFixedSize(textEdit_width_small*3+diff_width,pushButton_Height) self.textEdit_residualConsumersConsumption.setObjectName("textEdit_residualConsumersConsumption") self.textEdit_residualConsumersConsumption.setPlaceholderText('residualConsumersConsumption') self.textEdit_residualConsumersConsumption.setText('1') #zeilen Nr zz = 5 self.pushButton_altitudeGainConsumption = QPushButton() self.pushButton_altitudeGainConsumption.setGeometry(QtCore.QRect(diff_width, (diff_height+pushButton_Height)*zz, pushButton_Width, pushButton_Height)) self.pushButton_altitudeGainConsumption.setFixedSize(pushButton_Width,pushButton_Height) self.pushButton_altitudeGainConsumption.setObjectName("pushButton_altitudeGainConsumption") self.pushButton_altitudeGainConsumption.clicked.connect(self.altitudeGainConsumption) self.pushButton_altitudeGainConsumption.setText("altitude gain consumption [kWh/1km_altitude]") self.textEdit_altitudeGainConsumption = QTextEdit() self.textEdit_altitudeGainConsumption.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*0,(diff_height+pushButton_Height)*zz, textEdit_width_small*3+2*diff_width, pushButton_Height)) self.textEdit_altitudeGainConsumption.setFixedSize(textEdit_width_small*3+diff_width,pushButton_Height) self.textEdit_altitudeGainConsumption.setObjectName("textEdit_residualConsumersConsumption") self.textEdit_altitudeGainConsumption.setPlaceholderText('altitudeGainConsumption') self.textEdit_altitudeGainConsumption.setText('7.37') #zeilen Nr zz = 6 self.pushButton_altitudeLossConsumption = QPushButton() self.pushButton_altitudeLossConsumption.setGeometry(QtCore.QRect(diff_width, (diff_height+pushButton_Height)*zz, pushButton_Width, pushButton_Height)) self.pushButton_altitudeLossConsumption.setFixedSize(pushButton_Width,pushButton_Height) self.pushButton_altitudeLossConsumption.setObjectName("pushButton_altitudeGainConsumption") self.pushButton_altitudeLossConsumption.clicked.connect(self.altitudeLossConsumption) self.pushButton_altitudeLossConsumption.setText("altitude loss consumption [kWh/1km_altitude]") self.textEdit_altitudeLossConsumption = QTextEdit() self.textEdit_altitudeLossConsumption.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*0,(diff_height+pushButton_Height)*zz, textEdit_width_small*3+2*diff_width, pushButton_Height)) self.textEdit_altitudeLossConsumption.setFixedSize(textEdit_width_small*3+diff_width,pushButton_Height) self.textEdit_altitudeLossConsumption.setObjectName("textEdit_altitudeLossConsumption") self.textEdit_altitudeLossConsumption.setPlaceholderText('altitudeLossConsumption') self.textEdit_altitudeLossConsumption.setText('5.32') # zeilen Nr zz = 7 self.pushButton_currentEnergyContent = QPushButton() self.pushButton_currentEnergyContent.setGeometry( QtCore.QRect(diff_width, (diff_height + pushButton_Height) * zz, pushButton_Width, pushButton_Height)) self.pushButton_currentEnergyContent.setFixedSize(pushButton_Width, pushButton_Height) self.pushButton_currentEnergyContent.setObjectName("pushButton_currentEnergyContent") self.pushButton_currentEnergyContent.clicked.connect(self.currentEnergyContent) self.pushButton_currentEnergyContent.setText("current energy content [kWh]") self.textEdit_currentEnergyContent = QTextEdit() self.textEdit_currentEnergyContent.setGeometry( QtCore.QRect(2 * diff_width + pushButton_Width + (diff_width + textEdit_width_small) * 0, (diff_height + pushButton_Height) * zz, textEdit_width_small * 3 + 2 * diff_width, pushButton_Height)) self.textEdit_currentEnergyContent.setFixedSize(textEdit_width_small * 3 +diff_width, pushButton_Height) self.textEdit_currentEnergyContent.setObjectName("textEdit_currentEnergyContent") self.textEdit_currentEnergyContent.setPlaceholderText('currentEnergyContent') self.textEdit_currentEnergyContent.setText('70') # zeilen Nr zz = 8 self.pushButton_maximumEnergyContent = QPushButton() self.pushButton_maximumEnergyContent.setGeometry( QtCore.QRect(diff_width, (diff_height + pushButton_Height) * zz, pushButton_Width, pushButton_Height)) self.pushButton_maximumEnergyContent.setFixedSize(pushButton_Width, pushButton_Height) self.pushButton_maximumEnergyContent.setObjectName("pushButton_maximumEnergyContent") self.pushButton_maximumEnergyContent.clicked.connect(self.maximumEnergyContent) self.pushButton_maximumEnergyContent.setText("maximum energy content [kWh]") self.textEdit_maximumEnergyContent = QTextEdit() self.textEdit_maximumEnergyContent.setGeometry( QtCore.QRect(2 * diff_width + pushButton_Width + (diff_width + textEdit_width_small) * 0, (diff_height + pushButton_Height) * zz, textEdit_width_small * 3 + 2 * diff_width, pushButton_Height)) self.textEdit_maximumEnergyContent.setFixedSize(textEdit_width_small * 3 + diff_width, pushButton_Height) self.textEdit_maximumEnergyContent.setObjectName("textEdit_maximumEnergyContent") self.textEdit_maximumEnergyContent.setPlaceholderText('maximumEnergyContent') self.textEdit_maximumEnergyContent.setText('92') # zeilen Nr zz = 9 self.pushButton_VELOCITY_OFFSET = QPushButton() self.pushButton_VELOCITY_OFFSET.setGeometry( QtCore.QRect(diff_width, (diff_height + pushButton_Height) * zz, pushButton_Width, pushButton_Height)) self.pushButton_VELOCITY_OFFSET.setFixedSize(pushButton_Width, pushButton_Height) self.pushButton_VELOCITY_OFFSET.setObjectName("pushButton_VELOCITY_OFFSET") self.pushButton_VELOCITY_OFFSET.clicked.connect(self.VELOCITY_OFFSET) self.pushButton_VELOCITY_OFFSET.setText("set vehicle velocity offset [km/h]") self.textEdit_VELOCITY_OFFSET_1 = QTextEdit() self.textEdit_VELOCITY_OFFSET_1.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*0,(diff_height+pushButton_Height)*zz, textEdit_width_small, textEdit_height_small)) self.textEdit_VELOCITY_OFFSET_1.setFixedSize(textEdit_width_small,textEdit_height_small) self.textEdit_VELOCITY_OFFSET_1.setObjectName("textEdit_VELOCITY_OFFSET_1") self.textEdit_VELOCITY_OFFSET_1.setPlaceholderText('VELOCITY_OFFSET_1') self.textEdit_VELOCITY_OFFSET_1.setText('20') self.textEdit_VELOCITY_OFFSET_2 = QTextEdit() self.textEdit_VELOCITY_OFFSET_2.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*1,(diff_height+pushButton_Height)*zz, textEdit_width_small, textEdit_height_small)) self.textEdit_VELOCITY_OFFSET_2.setFixedSize(textEdit_width_small,textEdit_height_small) self.textEdit_VELOCITY_OFFSET_2.setObjectName("textEdit_VELOCITY_OFFSET_2") self.textEdit_VELOCITY_OFFSET_2.setPlaceholderText('VELOCITY_OFFSET_2') self.textEdit_VELOCITY_OFFSET_2.setText('15') self.textEdit_VELOCITY_OFFSET_3 = QTextEdit() self.textEdit_VELOCITY_OFFSET_3.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*2,(diff_height+pushButton_Height)*zz, textEdit_width_small, textEdit_height_small)) self.textEdit_VELOCITY_OFFSET_3.setFixedSize(textEdit_width_small,textEdit_height_small) self.textEdit_VELOCITY_OFFSET_3.setObjectName("textEdit_VELOCITY_OFFSET_3") self.textEdit_VELOCITY_OFFSET_3.setPlaceholderText('VELOCITY_OFFSET_3') self.textEdit_VELOCITY_OFFSET_3.setText('10') self.textEdit_VELOCITY_OFFSET_4 = QTextEdit() self.textEdit_VELOCITY_OFFSET_4.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*3,(diff_height+pushButton_Height)*zz, textEdit_width_small, textEdit_height_small)) self.textEdit_VELOCITY_OFFSET_4.setFixedSize(textEdit_width_small,textEdit_height_small) self.textEdit_VELOCITY_OFFSET_4.setObjectName("textEdit_VELOCITY_OFFSET_4") self.textEdit_VELOCITY_OFFSET_4.setPlaceholderText('VELOCITY_OFFSET_4') self.textEdit_VELOCITY_OFFSET_4.setText('5') self.textEdit_VELOCITY_OFFSET_5 = QTextEdit() self.textEdit_VELOCITY_OFFSET_5.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*4,(diff_height+pushButton_Height)*zz, textEdit_width_small, textEdit_height_small)) self.textEdit_VELOCITY_OFFSET_5.setFixedSize(textEdit_width_small,textEdit_height_small) self.textEdit_VELOCITY_OFFSET_5.setObjectName("textEdit_VELOCITY_OFFSET_5") self.textEdit_VELOCITY_OFFSET_5.setPlaceholderText('VELOCITY_OFFSET_5') self.textEdit_VELOCITY_OFFSET_5.setText('0') self.textEdit_VELOCITY_OFFSET_6 = QTextEdit() self.textEdit_VELOCITY_OFFSET_6.setGeometry(QtCore.QRect(2*diff_width+pushButton_Width+(diff_width+textEdit_width_small)*5,(diff_height+pushButton_Height)*zz, textEdit_width_small, textEdit_height_small)) self.textEdit_VELOCITY_OFFSET_6.setFixedSize(textEdit_width_small,textEdit_height_small) self.textEdit_VELOCITY_OFFSET_6.setObjectName("textEdit_VELOCITY_OFFSET_6") self.textEdit_VELOCITY_OFFSET_6.setPlaceholderText('VELOCITY_OFFSET_6') self.textEdit_VELOCITY_OFFSET_6.setText('0') # zeilen Nr zz = 10 self.pushButton_CUSTOMER_ACTION_TRIGGER_VALUE = QPushButton() self.pushButton_CUSTOMER_ACTION_TRIGGER_VALUE.setGeometry( QtCore.QRect(diff_width, (diff_height + pushButton_Height) * zz, pushButton_Width, pushButton_Height)) self.pushButton_CUSTOMER_ACTION_TRIGGER_VALUE.setFixedSize(pushButton_Width, pushButton_Height) self.pushButton_CUSTOMER_ACTION_TRIGGER_VALUE.setObjectName("pushButton_CUSTOMER_ACTION_TRIGGER_VALUE") self.pushButton_CUSTOMER_ACTION_TRIGGER_VALUE.clicked.connect(self.CUSTOMER_ACTION_TRIGGER_VALUE) self.pushButton_CUSTOMER_ACTION_TRIGGER_VALUE.setText("customer action trigger []") self.textEdit_CUSTOMER_ACTION_TRIGGER_VALUE = QTextEdit() self.textEdit_CUSTOMER_ACTION_TRIGGER_VALUE.setGeometry( QtCore.QRect(2 * diff_width + pushButton_Width + (diff_width + textEdit_width_small) * 0, (diff_height + pushButton_Height) * zz, textEdit_width_small * 3 + 2 * diff_width, pushButton_Height)) self.textEdit_CUSTOMER_ACTION_TRIGGER_VALUE.setFixedSize(textEdit_width_small * 3 + diff_width, pushButton_Height) self.textEdit_CUSTOMER_ACTION_TRIGGER_VALUE.setObjectName("textEdit_CUSTOMER_ACTION_TRIGGER_VALUE") self.textEdit_CUSTOMER_ACTION_TRIGGER_VALUE.setPlaceholderText('CUSTOMER ACTION TRIGGER') self.textEdit_CUSTOMER_ACTION_TRIGGER_VALUE.setText('10') # zeilen Nr zz = 11 self.pushButton_Occupants = QPushButton() self.pushButton_Occupants.setGeometry( QtCore.QRect(diff_width, (diff_height + pushButton_Height) * zz, pushButton_Width, pushButton_Height)) self.pushButton_Occupants.setFixedSize(pushButton_Width, pushButton_Height) self.pushButton_Occupants.setObjectName("pushButton_Occupants") self.pushButton_Occupants.clicked.connect(self.Occupants) self.pushButton_Occupants.setText("set occupants []") self.textEdit_Occupants = QTextEdit() self.textEdit_Occupants.setGeometry( QtCore.QRect(2 * diff_width + pushButton_Width + (diff_width + textEdit_width_small) * 0, (diff_height + pushButton_Height) * zz, textEdit_width_small * 3 + 2 * diff_width, pushButton_Height)) self.textEdit_Occupants.setFixedSize(textEdit_width_small * 3 + diff_width, pushButton_Height) self.textEdit_Occupants.setObjectName("textEdit_Occupants") self.textEdit_Occupants.setPlaceholderText('occupants') self.textEdit_Occupants.setText('3') # zeilen Nr zz = 12 self.pushButton_EngineType = QPushButton() self.pushButton_EngineType.setGeometry( QtCore.QRect(diff_width, (diff_height + pushButton_Height) * zz, pushButton_Width, pushButton_Height)) self.pushButton_EngineType.setFixedSize(pushButton_Width, pushButton_Height) self.pushButton_EngineType.setObjectName("pushButton_EngineType") self.pushButton_EngineType.clicked.connect(self.setEngineType) self.pushButton_EngineType.setText("set engine type []") self.combo_box_EngineType = QComboBox() self.combo_box_EngineType.setGeometry( QtCore.QRect(2 * diff_width + pushButton_Width + (diff_width + textEdit_width_small) * 0, (diff_height + pushButton_Height) * zz, textEdit_width_small * 3 + 2 * diff_width, pushButton_Height)) self.combo_box_EngineType.setFixedSize(textEdit_width_small * 3 + diff_width, pushButton_Height) self.combo_box_EngineType.setObjectName("combo_box_identifierType") self.combo_box_EngineType.addItems(["BEV", "PHEV", "HEV", "COMBUSTION", "CNG", "LPG", "FUEL_CELL"]) self.combo_box_EngineType.setEditable(True) # zeilen Nr zz = 13 self.pushButton_setAllServices = QPushButton() self.pushButton_setAllServices.setGeometry( QtCore.QRect(diff_width, (diff_height + pushButton_Height) * zz, pushButton_Width, pushButton_Height)) self.pushButton_setAllServices.setFixedSize(pushButton_Width, pushButton_Height) self.pushButton_setAllServices.setObjectName("pushButton_setAllServices") self.pushButton_setAllServices.clicked.connect(self.setAllServices) self.pushButton_setAllServices.setText("enable ALL services []") # zeilen Nr zz = 14 self.pushButton_setCMCServices = QPushButton() self.pushButton_setCMCServices.setGeometry( QtCore.QRect(diff_width, (diff_height + pushButton_Height) * zz, pushButton_Width, pushButton_Height)) self.pushButton_setCMCServices.setFixedSize(pushButton_Width, pushButton_Height) self.pushButton_setCMCServices.setObjectName("pushButton_setCMCServices") self.pushButton_setCMCServices.clicked.connect(self.setCMCServices) self.pushButton_setCMCServices.setText("enable CMC service []") # zeilen Nr zz = 15 self.pushButton_setEPPServices = QPushButton() self.pushButton_setEPPServices.setGeometry( QtCore.QRect(diff_width, (diff_height + pushButton_Height) * zz, pushButton_Width, pushButton_Height)) self.pushButton_setEPPServices.setFixedSize(pushButton_Width, pushButton_Height) self.pushButton_setEPPServices.setObjectName("pushButton_setEPPServices") self.pushButton_setEPPServices.clicked.connect(self.setEPPServices) self.pushButton_setEPPServices.setText("enable EPP service []") # zeilen Nr zz = 16 self.pushButton_setRWBServices = QPushButton() self.pushButton_setRWBServices.setGeometry( QtCore.QRect(diff_width, (diff_height + pushButton_Height) * zz, pushButton_Width, pushButton_Height)) self.pushButton_setRWBServices.setFixedSize(pushButton_Width, pushButton_Height) self.pushButton_setRWBServices.setObjectName("pushButton_setRWBServices") self.pushButton_setRWBServices.clicked.connect(self.setRWBServices) self.pushButton_setRWBServices.setText("enable RWB service []") ################################### hbox = QHBoxLayout() hbox.addWidget(self.pushButton_consumptionVelocity) hbox.addWidget(self.textEdit_VELOCITY_VALUE_1) hbox.addWidget(self.textEdit_VELOCITY_VALUE_2) hbox.addWidget(self.textEdit_VELOCITY_VALUE_3) hbox.addWidget(self.textEdit_VELOCITY_VALUE_4) hbox.addWidget(self.textEdit_VELOCITY_VALUE_5) hbox.addWidget(self.textEdit_VELOCITY_VALUE_6) hbox.addWidget(self.textEdit_VELOCITY_VALUE_7) hbox.addWidget(self.textEdit_VELOCITY_VALUE_8) hbox.addWidget(self.textEdit_VELOCITY_VALUE_9) hbox.addWidget(self.textEdit_VELOCITY_VALUE_10) hbox.addStretch(0) vbox = QVBoxLayout() vbox.addLayout(hbox) hbox = QHBoxLayout() hbox.addWidget(self.pushButton_speedConsumption) hbox.addWidget(self.textEdit_CONSUMPTION_VALUE_1) hbox.addWidget(self.textEdit_CONSUMPTION_VALUE_2) hbox.addWidget(self.textEdit_CONSUMPTION_VALUE_3) hbox.addWidget(self.textEdit_CONSUMPTION_VALUE_4) hbox.addWidget(self.textEdit_CONSUMPTION_VALUE_5) hbox.addWidget(self.textEdit_CONSUMPTION_VALUE_6) hbox.addWidget(self.textEdit_CONSUMPTION_VALUE_7) hbox.addWidget(self.textEdit_CONSUMPTION_VALUE_8) hbox.addWidget(self.textEdit_CONSUMPTION_VALUE_9) hbox.addWidget(self.textEdit_CONSUMPTION_VALUE_10) hbox.addStretch(0) vbox.addLayout(hbox) hbox = QHBoxLayout() hbox.addWidget(self.pushButton_consumptionFactorDrivingProfile) hbox.addWidget(self.textEdit_consumptionFactorDrivingProfile) hbox.addStretch(0) vbox.addLayout(hbox) hbox = QHBoxLayout() hbox.addWidget(self.pushButton_comfortConsumersConsumption) hbox.addWidget(self.textEdit_comfortConsumersConsumption) hbox.addStretch(0) vbox.addLayout(hbox) hbox = QHBoxLayout() hbox.addWidget(self.pushButton_residualConsumersConsumption) hbox.addWidget(self.textEdit_residualConsumersConsumption) hbox.addStretch(0) vbox.addLayout(hbox) hbox = QHBoxLayout() hbox.addWidget(self.pushButton_altitudeGainConsumption) hbox.addWidget(self.textEdit_altitudeGainConsumption) hbox.addStretch(0) vbox.addLayout(hbox) hbox = QHBoxLayout() hbox.addWidget(self.pushButton_altitudeLossConsumption) hbox.addWidget(self.textEdit_altitudeLossConsumption) hbox.addStretch(0) vbox.addLayout(hbox) hbox = QHBoxLayout() hbox.addWidget(self.pushButton_currentEnergyContent) hbox.addWidget(self.textEdit_currentEnergyContent) hbox.addStretch(0) vbox.addLayout(hbox) hbox = QHBoxLayout() hbox.addWidget(self.pushButton_maximumEnergyContent) hbox.addWidget(self.textEdit_maximumEnergyContent) hbox.addStretch(0) vbox.addLayout(hbox) vbox.addSpacing(pushButton_Height) hbox = QHBoxLayout() hbox.addWidget(self.pushButton_VELOCITY_OFFSET) hbox.addWidget(self.textEdit_VELOCITY_OFFSET_1) hbox.addWidget(self.textEdit_VELOCITY_OFFSET_2) hbox.addWidget(self.textEdit_VELOCITY_OFFSET_3) hbox.addWidget(self.textEdit_VELOCITY_OFFSET_4) hbox.addWidget(self.textEdit_VELOCITY_OFFSET_5) hbox.addWidget(self.textEdit_VELOCITY_OFFSET_6) hbox.addStretch(0) vbox.addLayout(hbox) hbox = QHBoxLayout() hbox.addWidget(self.pushButton_CUSTOMER_ACTION_TRIGGER_VALUE) hbox.addWidget(self.textEdit_CUSTOMER_ACTION_TRIGGER_VALUE) hbox.addStretch(0) vbox.addLayout(hbox) hbox = QHBoxLayout() hbox.addWidget(self.pushButton_Occupants) hbox.addWidget(self.textEdit_Occupants) hbox.addStretch(0) vbox.addLayout(hbox) hbox = QHBoxLayout() hbox.addWidget(self.pushButton_EngineType) hbox.addWidget(self.combo_box_EngineType) hbox.addStretch(0) vbox.addLayout(hbox) vbox.addSpacing(pushButton_Height) vbox.addWidget(self.pushButton_setAllServices) vbox.addWidget(self.pushButton_setCMCServices) vbox.addWidget(self.pushButton_setEPPServices) vbox.addWidget(self.pushButton_setRWBServices) #vbox.addLayout(hbox) vbox.addStretch(0) #hbox = QHBoxLayout() self.tab2.setLayout(vbox) def consumptionVelocity(self): print("set velocity for velocity speed consumption:") arr = [self.textEdit_VELOCITY_VALUE_1.toPlainText(), self.textEdit_VELOCITY_VALUE_2.toPlainText(), self.textEdit_VELOCITY_VALUE_3.toPlainText(), self.textEdit_VELOCITY_VALUE_4.toPlainText(), self.textEdit_VELOCITY_VALUE_5.toPlainText(), self.textEdit_VELOCITY_VALUE_6.toPlainText(), self.textEdit_VELOCITY_VALUE_7.toPlainText(), self.textEdit_VELOCITY_VALUE_8.toPlainText(), self.textEdit_VELOCITY_VALUE_9.toPlainText(), self.textEdit_VELOCITY_VALUE_10.toPlainText()] for i in range(1,11): adb_command = ("adb shell am broadcast -a de.esolutions.navigation.CONSUMPTION_SEND --ef VELOCITY_VALUE_%d %sf"%(i,arr[i-1])) print("===> " + adb_command) subprocess.call(adb_command, shell=True) self.adb_command = adb_command self.record() time.sleep(.2) def speedConsumption(self): print("set consumption for velocity speed consumption:") arr = [self.textEdit_CONSUMPTION_VALUE_1.toPlainText(), self.textEdit_CONSUMPTION_VALUE_2.toPlainText(), self.textEdit_CONSUMPTION_VALUE_3.toPlainText(), self.textEdit_CONSUMPTION_VALUE_4.toPlainText(), self.textEdit_CONSUMPTION_VALUE_5.toPlainText(), self.textEdit_CONSUMPTION_VALUE_6.toPlainText(), self.textEdit_CONSUMPTION_VALUE_7.toPlainText(), self.textEdit_CONSUMPTION_VALUE_8.toPlainText(), self.textEdit_CONSUMPTION_VALUE_9.toPlainText(), self.textEdit_CONSUMPTION_VALUE_10.toPlainText()] for i in range(1,11): adb_command = ("adb shell am broadcast -a de.esolutions.navigation.CONSUMPTION_SEND --ef CONSUMPTION_VALUE_%d %sf"%(i, str(float(arr[i-1])/10))) print("===> " + adb_command) subprocess.call(adb_command, shell=True) self.adb_command = adb_command self.record() time.sleep(.2) def consumptionFactorDrivingProfile(self): print("set consumptionFactorDrivingProfile:") adb_command = ("adb shell am broadcast -a de.esolutions.navigation.CONSUMPTION_SEND --ef consumptionFactorDrivingProfile %sf" % (self.textEdit_consumptionFactorDrivingProfile.toPlainText())) print("===> " + adb_command) subprocess.call(adb_command, shell=True) self.adb_command = adb_command self.record() def comfortConsumersConsumption(self): print("set comfortConsumersConsumption:") adb_command = ("adb shell am broadcast -a de.esolutions.navigation.CONSUMPTION_SEND --ef comfortConsumersConsumption %sf" % (str(float(self.textEdit_comfortConsumersConsumption.toPlainText())*10))) print("===> " + adb_command) subprocess.call(adb_command, shell=True) self.adb_command = adb_command self.record() def residualConsumersConsumption(self): print("set residualConsumersConsumption:") adb_command = ("adb shell am broadcast -a de.esolutions.navigation.CONSUMPTION_SEND --ef residualConsumersConsumption %sf" % (str(float(self.textEdit_residualConsumersConsumption.toPlainText())*10))) print("===> " + adb_command) subprocess.call(adb_command, shell=True) self.adb_command = adb_command self.record() def altitudeGainConsumption(self): print("set altitudeGainConsumption:") adb_command = ("adb shell am broadcast -a de.esolutions.navigation.CONSUMPTION_SEND --ef altitudeGainConsumption %sf" % (str(float(self.textEdit_altitudeGainConsumption.toPlainText())*10))) print("===> " + adb_command) subprocess.call(adb_command, shell=True) self.adb_command = adb_command self.record() def altitudeLossConsumption(self): print("set altitudeLossConsumption:") adb_command = ("adb shell am broadcast -a de.esolutions.navigation.CONSUMPTION_SEND --ef altitudeLossConsumption %sf" % (str(float(self.textEdit_altitudeLossConsumption.toPlainText())*10))) print("===> " + adb_command) subprocess.call(adb_command, shell=True) self.adb_command = adb_command self.record() def currentEnergyContent(self): print("set currentEnergyContent:") adb_command = ("adb shell am broadcast -a de.esolutions.navigation.CONSUMPTION_SEND --ef currentEnergyContent %sf" % (str(float(self.textEdit_currentEnergyContent.toPlainText())*10))) print("===> " + adb_command) subprocess.call(adb_command, shell=True) self.adb_command = adb_command self.record() def maximumEnergyContent(self): print("set maximumEnergyContent:") adb_command = ("adb shell am broadcast -a de.esolutions.navigation.CONSUMPTION_SEND --ef maximumEnergyContent %sf" % (str(float(self.textEdit_maximumEnergyContent.toPlainText())*10))) print("===> " + adb_command) subprocess.call(adb_command, shell=True) self.adb_command = adb_command self.record() def VELOCITY_OFFSET(self): print("set VELOCITY_OFFSET:") arr = [self.textEdit_VELOCITY_OFFSET_1.toPlainText(), self.textEdit_VELOCITY_OFFSET_2.toPlainText(), self.textEdit_VELOCITY_OFFSET_3.toPlainText(), self.textEdit_VELOCITY_OFFSET_4.toPlainText(), self.textEdit_VELOCITY_OFFSET_5.toPlainText(), self.textEdit_VELOCITY_OFFSET_6.toPlainText()] arr_txt = ["VELOCITY_UNLIMITED_HIGHWAY_VALUE", "VELOCITY_OFFSET_VALUE_1", "VELOCITY_OFFSET_VALUE_2", "VELOCITY_OFFSET_VALUE_3", "VELOCITY_OFFSET_VALUE_4", "VELOCITY_OFFSET_VALUE_5"] for i in range(6): adb_command = ("adb shell am broadcast -a de.esolutions.navigation.CONSUMPTION_SEND --ei %s %s"%(arr_txt[i],arr[i])) print("===> " + adb_command) subprocess.call(adb_command, shell=True) self.adb_command = adb_command self.record() time.sleep(.2) def CUSTOMER_ACTION_TRIGGER_VALUE(self): print("set CUSTOMER_ACTION_TRIGGER_VALUE:") adb_command = ("adb shell am broadcast -a de.esolutions.navigation.CONSUMPTION_SEND --ei CUSTOMER_ACTION_TRIGGER_VALUE %s" % (self.textEdit_CUSTOMER_ACTION_TRIGGER_VALUE.toPlainText())) print("===> " + adb_command) subprocess.call(adb_command, shell=True) self.adb_command = adb_command self.record() def Occupants(self): print("set Occupants:") adb_command = ("adb shell am broadcast -a de.esolutions.navigation.VEHICLE_CONFIG --ei Occupants %s" % (self.textEdit_Occupants.toPlainText())) print("===> " + adb_command) subprocess.call(adb_command, shell=True) self.adb_command = adb_command self.record() def setEngineType(self): print("set Engine Type:") adb_command = ("adb shell am broadcast -a de.esolutions.navigation.VEHICLE_CONFIG --es Enginetype %s" % ( self.combo_box_EngineType.currentText())) print("===> " + adb_command) subprocess.call(adb_command, shell=True) self.adb_command = adb_command self.record() def setAllServices(self): print("enable all EV Services:") adb_command = ("adb shell am broadcast -a de.esolutions.navigation.MOCK_ALL_SERVICES") print("===> " + adb_command) subprocess.call(adb_command, shell=True) self.adb_command = adb_command self.record() def setCMCServices(self): print("enable CMC Services:") adb_command = ("adb shell am broadcast -a de.esolutions.navigation.SWITCH_TO_SERVICE --ei serviceID 2 --es serviceName ChargingManagementCore") print("===> " + adb_command) subprocess.call(adb_command, shell=True) self.adb_command = adb_command self.record() def setEPPServices(self): print("enable energyPowerPrediction (EPP) Services:") adb_command = ("adb shell am broadcast -a de.esolutions.navigation.SWITCH_TO_SERVICE --ei serviceID 2 --es serviceName EnergyPowerPrediction") print("===> " + adb_command) subprocess.call(adb_command, shell=True) self.adb_command = adb_command self.record() def setRWBServices(self): print("enable RouteBasedConsumption (RWB) Services:") adb_command = ("adb shell am broadcast -a de.esolutions.navigation.SWITCH_TO_SERVICE --ei serviceID 2 --es serviceName RouteBasedConsumption") print("===> " + adb_command) subprocess.call(adb_command, shell=True) self.adb_command = adb_command self.record() ### tab Gen ############################################# def tab3UI(self): self.tabs.addTab(self.tab3, "Gen") pushButtonWidth = 300 pushButtonHeight = 30 self.pushButton_forceStopp = QPushButton() self.pushButton_forceStopp.setGeometry(QtCore.QRect(10, 10, pushButtonWidth, pushButtonHeight)) self.pushButton_forceStopp.setFixedSize(pushButtonWidth, pushButtonHeight) self.pushButton_forceStopp.setObjectName("pushButton_forceStopp") self.pushButton_forceStopp.clicked.connect(self.forceStopp) self.pushButton_forceStopp.setText("force stop Audi nav.apk") self.pushButton_clearCash = QPushButton() self.pushButton_clearCash.setGeometry(QtCore.QRect(10, 10, pushButtonWidth, pushButtonHeight)) self.pushButton_clearCash.setFixedSize(pushButtonWidth, pushButtonHeight) self.pushButton_clearCash.setObjectName("pushButton_clearCash") self.pushButton_clearCash.clicked.connect(self.clearCash) self.pushButton_clearCash.setText("clear storage Audi nav.apk") self.pushButton_reboot = QPushButton() self.pushButton_reboot.setGeometry(QtCore.QRect(10, (10+pushButtonHeight)*1, pushButtonWidth, pushButtonHeight)) self.pushButton_reboot.setFixedSize(pushButtonWidth, pushButtonHeight) self.pushButton_reboot.setObjectName("pushButton_reboot") self.pushButton_reboot.clicked.connect(self.reboot) self.pushButton_reboot.setText("reboot HCP3") self.pushButton_forwardEsoTrace = QPushButton() self.pushButton_forwardEsoTrace.setGeometry(QtCore.QRect(10, (10+pushButtonHeight)*2, pushButtonWidth, pushButtonHeight)) self.pushButton_forwardEsoTrace.setFixedSize(pushButtonWidth, pushButtonHeight) self.pushButton_forwardEsoTrace.setObjectName("pushButton_forwardEsoTrace") self.pushButton_forwardEsoTrace.clicked.connect(self.forwardEsoTrace) self.pushButton_forwardEsoTrace.setText("forward Eso Trace") self.pushButton_setTime = QPushButton() self.pushButton_setTime.setGeometry(QtCore.QRect(10, (10+pushButtonHeight)*3, pushButtonWidth, pushButtonHeight)) self.pushButton_setTime.setFixedSize(pushButtonWidth, pushButtonHeight) self.pushButton_setTime.setObjectName("pushButton_setTime") self.pushButton_setTime.clicked.connect(self.setTime) self.pushButton_setTime.setText("set current time") self.pushButton_startNav = QPushButton() self.pushButton_startNav.setGeometry(QtCore.QRect(10, (10+pushButtonHeight)*3, pushButtonWidth, pushButtonHeight)) self.pushButton_startNav.setFixedSize(pushButtonWidth, pushButtonHeight) self.pushButton_startNav.setObjectName("pushButton_startNav") self.pushButton_startNav.clicked.connect(self.startNav) self.pushButton_startNav.setText("start navigation app") self.pushButton_developerOption = QPushButton() self.pushButton_developerOption.setGeometry(QtCore.QRect(10, (10+pushButtonHeight)*3, pushButtonWidth, pushButtonHeight)) self.pushButton_developerOption.setFixedSize(pushButtonWidth, pushButtonHeight) self.pushButton_developerOption.setObjectName("pushButton_developerOption") self.pushButton_developerOption.clicked.connect(self.developerOption) self.pushButton_developerOption.setText("enable developer mode") self.pushButton_mockLocation = QPushButton() self.pushButton_mockLocation.setGeometry(QtCore.QRect(10, (10+pushButtonHeight)*3, pushButtonWidth, pushButtonHeight)) self.pushButton_mockLocation.setFixedSize(pushButtonWidth, pushButtonHeight) self.pushButton_mockLocation.setObjectName("pushButton_mockLocation") self.pushButton_mockLocation.clicked.connect(self.mockLocation) self.pushButton_mockLocation.setText("nav as mock location provider") self.pushButton_CoreServicesApp = QPushButton() self.pushButton_CoreServicesApp.setGeometry(QtCore.QRect(10, (10+pushButtonHeight)*3, pushButtonWidth, pushButtonHeight)) self.pushButton_CoreServicesApp.setFixedSize(pushButtonWidth, pushButtonHeight) self.pushButton_CoreServicesApp.setObjectName("pushButton_CoreServicesApp") self.pushButton_CoreServicesApp.clicked.connect(self.coreServicesApp) self.pushButton_CoreServicesApp.setText("show CoreServicesApp") self.pushButton_Recording = QPushButton() self.pushButton_Recording.setGeometry(QtCore.QRect(10, (10+pushButtonHeight)*3, pushButtonWidth, pushButtonHeight)) self.pushButton_Recording.setFixedSize(pushButtonWidth, pushButtonHeight) self.pushButton_Recording.setObjectName("pushButton_Recording") self.pushButton_Recording.clicked.connect(self.recording) self.pushButton_Recording.setText("start Recording") self.pushButton_Recording.setStyleSheet("background-color : rgb(150,150,150)") self.recording = False self.rec_init = False self.adb_command = "" #hbox = QHBoxLayout() vbox = QVBoxLayout() vbox.addWidget(self.pushButton_forceStopp) vbox.addWidget(self.pushButton_clearCash) vbox.addWidget(self.pushButton_reboot) vbox.addSpacing(pushButtonHeight) vbox.addWidget(self.pushButton_startNav) vbox.addWidget(self.pushButton_setTime) vbox.addSpacing(pushButtonHeight) vbox.addWidget(self.pushButton_developerOption) vbox.addWidget(self.pushButton_mockLocation) vbox.addWidget(self.pushButton_CoreServicesApp) vbox.addWidget(self.pushButton_forwardEsoTrace) #vbox.addStretch(1) vbox.addSpacing(pushButtonHeight) vbox.addWidget(self.pushButton_Recording) vbox.addStretch(0) self.tab3.setLayout(vbox) def forceStopp(self): print("kill navigation:") adb_command = ("adb shell am force-stop technology.cariad.navi.audi") print("===> " + adb_command) subprocess.call(adb_command, shell=True) self.adb_command = adb_command self.record() def clearCash(self): print("clear storage AUDI nav.apk") adb_command = ("adb shell pm clear technology.cariad.navi.audi") print("===> " + adb_command) subprocess.call(adb_command, shell=True) self.adb_command = adb_command self.record() def reboot(self): print("reboot HCP3:") adb_command = ("adb reboot") print("===> " + adb_command) subprocess.call(adb_command, shell=True) self.adb_command = adb_command self.record() def forwardEsoTrace(self): print("forward ESO Trace:") adb_command = ("adb forward tcp:21002 tcp:21002") print("===> " + adb_command) subprocess.call(adb_command, shell=True) self.adb_command = adb_command self.record() def setTime(self): print("set Time:") adb_command = ("adb shell date `date +%m%d%H%M%G.%S`") print("===> " + adb_command) subprocess.call("adb root", shell=True) self.adb_command = "adb root" self.record() time.sleep(.8) subprocess.call(adb_command, shell=True) self.adb_command = adb_command self.record() def startNav(self): print("sart navigation app:") adb_command = ("adb shell monkey -p technology.cariad.navi.audi -c android.intent.category.LAUNCHER 1") print("===> " + adb_command) subprocess.call(adb_command, shell=True) self.adb_command=adb_command self.record() def developerOption(self): print("enable developer mode") adb_command = ("adb shell settings put global development_settings_enabled 1") print("===> " + adb_command) subprocess.call(adb_command, shell=True) self.adb_command=adb_command self.record() def mockLocation(self): print("navigation as mock location provider") adb_command = ("adb shell appops set technology.cariad.navi.audi android:mock_location allow") print("===> " + adb_command) subprocess.call(adb_command, shell=True) self.adb_command=adb_command self.record() def coreServicesApp(self): print("show CoreServices App") subprocess.call("adb root", shell=True) time.sleep(.8) adb_command = ("adb shell am startservice -n de.esolutions.coreservices/.gem.ui.HideGemService --ez isHidden false") print("===> " + adb_command) subprocess.call(adb_command, shell=True) self.adb_command=adb_command self.record() def recording(self): if self.pushButton_Recording.text() == "start Recording": # ToDo: Popup with File + start Timer options = QFileDialog.Options() options |= QFileDialog.DontUseNativeDialog fileName, _ = QFileDialog.getSaveFileName(self, "QFileDialog.getSaveFileName()", "", "All files (*);; Text files (*.txt)", options=options) if fileName: print(fileName) file = open(fileName, 'w') date = datetime.now().strftime("%Y %m %d - %I:%M:%S %p") file.write("#!/bin/bash\n#########################################################\n# Automatic test script from "+ date +"\n# Autor: Johannes Ziegmann\n# Mail: johannes.ziegmann@audi.de\n#########################################################\n\n\n") file.close() self.fileName = fileName else: print("no file saved") return print("start recording") self.pushButton_Recording.setText("stopp Recording") self.pushButton_Recording.setStyleSheet("background-color : rgb(89,33,21)") self.recording=True self.start = time.perf_counter() else: print("stopp recording") self.pushButton_Recording.setText("start Recording") self.pushButton_Recording.setStyleSheet("background-color : rgb(120,120,120)") self.recording=False def record(self): if self.recording: print("Print to File (%s): %s"%(self.fileName,self.adb_command)) file = open(self.fileName, 'a') delta_time = round(time.perf_counter() - self.start, 4) file.write("sleep "+str(delta_time)+"\n") file.write(self.adb_command + "\n") file.close() self.start = time.perf_counter() ### tab INFO ############################################# def tab4UI(self): self.tabs.addTab(self.tab4, "Info") # Create label self.label = QLabel('Writen by: \n Johannes Ziegmann \n johannes.ziegmann@audi.de',self) self.label.setGeometry(10,10,400,50) vbox = QVBoxLayout() vbox.addWidget(self.label) self.tab4.setLayout(vbox) ######################################################### if __name__ == '__main__': app = QApplication(sys.argv) app.setStyleSheet('QMainWindow{border: 2px solid gray;}') ex = App() sys.exit(app.exec_())