RobotFramework-UDS 0.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- RobotFramework_UDS/DiagnosticServices.py +52 -0
- RobotFramework_UDS/RobotFramework_UDS.pdf +0 -0
- RobotFramework_UDS/UDSKeywords.py +914 -0
- RobotFramework_UDS/__init__.py +24 -0
- RobotFramework_UDS/version.py +16 -0
- RobotFramework_UDS-0.1.1.dist-info/LICENSE +201 -0
- RobotFramework_UDS-0.1.1.dist-info/METADATA +159 -0
- RobotFramework_UDS-0.1.1.dist-info/RECORD +10 -0
- RobotFramework_UDS-0.1.1.dist-info/WHEEL +5 -0
- RobotFramework_UDS-0.1.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
from robot.api import logger
|
|
2
|
+
import odxtools
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class DiagnosticServices:
|
|
6
|
+
def __init__(self, pdx_file, variant):
|
|
7
|
+
self.variant = variant
|
|
8
|
+
self.pdx_file = pdx_file
|
|
9
|
+
# load pdx file
|
|
10
|
+
odxtools.exceptions.strict_mode = False
|
|
11
|
+
self.odx_db = odxtools.load_pdx_file(self.pdx_file)
|
|
12
|
+
odxtools.exceptions.strict_mode = True
|
|
13
|
+
self.odx_ecu = self.odx_db.ecus[self.variant]
|
|
14
|
+
self.diag_services = self.odx_db.ecus[self.variant].services
|
|
15
|
+
|
|
16
|
+
def get_data_by_name(self, service_name_list):
|
|
17
|
+
diag_service_list = []
|
|
18
|
+
for service_name in service_name_list:
|
|
19
|
+
try:
|
|
20
|
+
diag_service = getattr(self.diag_services, service_name)
|
|
21
|
+
diag_service_list.append(diag_service)
|
|
22
|
+
except:
|
|
23
|
+
logger.error(f"Diagnostic service does not contain an item named {service_name}")
|
|
24
|
+
|
|
25
|
+
return diag_service_list
|
|
26
|
+
|
|
27
|
+
def get_encoded_request_message(self, diag_service_list, parameters=None):
|
|
28
|
+
uds_list = []
|
|
29
|
+
for diag_service in diag_service_list:
|
|
30
|
+
param_dict = {}
|
|
31
|
+
uds = ""
|
|
32
|
+
logger.info(f"[uds] Service name: {diag_service}")
|
|
33
|
+
if parameters:
|
|
34
|
+
for param in parameters:
|
|
35
|
+
isolate_list = param.split("=")
|
|
36
|
+
param_dict[isolate_list[0]] = eval(isolate_list[1])
|
|
37
|
+
|
|
38
|
+
logger.info(f"[uds] Parameters: {param_dict}")
|
|
39
|
+
try:
|
|
40
|
+
uds = diag_service(**param_dict).hex()
|
|
41
|
+
uds_list.append(uds)
|
|
42
|
+
except:
|
|
43
|
+
logger.info(f"UDS: Retrieve uds failed.")
|
|
44
|
+
else:
|
|
45
|
+
uds = diag_service().hex()
|
|
46
|
+
if len(uds) > 0:
|
|
47
|
+
logger.info(f"UDS: {uds}")
|
|
48
|
+
uds_list.append(uds)
|
|
49
|
+
else:
|
|
50
|
+
logger.info("UDS: Retrieve uds failed.")
|
|
51
|
+
|
|
52
|
+
return uds_list
|
|
Binary file
|