PyVLCB 0.2.1__tar.gz → 0.2.6__tar.gz
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.
- {pyvlcb-0.2.1/src/PyVLCB.egg-info → pyvlcb-0.2.6}/PKG-INFO +1 -1
- {pyvlcb-0.2.1 → pyvlcb-0.2.6}/pyproject.toml +1 -1
- {pyvlcb-0.2.1 → pyvlcb-0.2.6/src/PyVLCB.egg-info}/PKG-INFO +1 -1
- {pyvlcb-0.2.1 → pyvlcb-0.2.6}/src/pyvlcb/__init__.py +2 -2
- {pyvlcb-0.2.1 → pyvlcb-0.2.6}/src/pyvlcb/vlcbformat.py +24 -5
- {pyvlcb-0.2.1 → pyvlcb-0.2.6}/LICENSE +0 -0
- {pyvlcb-0.2.1 → pyvlcb-0.2.6}/README.md +0 -0
- {pyvlcb-0.2.1 → pyvlcb-0.2.6}/setup.cfg +0 -0
- {pyvlcb-0.2.1 → pyvlcb-0.2.6}/src/PyVLCB.egg-info/SOURCES.txt +0 -0
- {pyvlcb-0.2.1 → pyvlcb-0.2.6}/src/PyVLCB.egg-info/dependency_links.txt +0 -0
- {pyvlcb-0.2.1 → pyvlcb-0.2.6}/src/PyVLCB.egg-info/requires.txt +0 -0
- {pyvlcb-0.2.1 → pyvlcb-0.2.6}/src/PyVLCB.egg-info/top_level.txt +0 -0
- {pyvlcb-0.2.1 → pyvlcb-0.2.6}/src/pyvlcb/canusb.py +0 -0
- {pyvlcb-0.2.1 → pyvlcb-0.2.6}/src/pyvlcb/exceptions.py +0 -0
- {pyvlcb-0.2.1 → pyvlcb-0.2.6}/src/pyvlcb/tests/run_tests.py +0 -0
- {pyvlcb-0.2.1 → pyvlcb-0.2.6}/src/pyvlcb/tests/test_canusb4.py +0 -0
- {pyvlcb-0.2.1 → pyvlcb-0.2.6}/src/pyvlcb/tests/test_vlcb.py +0 -0
- {pyvlcb-0.2.1 → pyvlcb-0.2.6}/src/pyvlcb/utils.py +0 -0
|
@@ -124,8 +124,8 @@ class VLCB:
|
|
|
124
124
|
opcode_string = f'{opcode} - {VLCBOpcode.opcode_mnemonic(opcode)}'
|
|
125
125
|
#data_string = f"{VLCBOpcode.parse_data(vlcb_entry.data)}"
|
|
126
126
|
data_string = dict_to_string(VLCBOpcode.parse_data(vlcb_entry.data))
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
description_string = vlcb_entry.get_description()
|
|
128
|
+
return [date_string, direction, message, str(vlcb_entry.can_id), opcode_string, data_string, description_string]
|
|
129
129
|
|
|
130
130
|
|
|
131
131
|
# Static Methods moved to utils
|
|
@@ -62,6 +62,24 @@ class VLCBFormat :
|
|
|
62
62
|
"""
|
|
63
63
|
return VLCBOpcode.parse_data(self.data)
|
|
64
64
|
|
|
65
|
+
|
|
66
|
+
def get_description (self): # -> str:
|
|
67
|
+
"""Returns a human readable string based on the data string
|
|
68
|
+
|
|
69
|
+
Returns:
|
|
70
|
+
String
|
|
71
|
+
|
|
72
|
+
Raises:
|
|
73
|
+
ValueError: If opcode not found
|
|
74
|
+
"""
|
|
75
|
+
str_value = self.data[0:2]
|
|
76
|
+
if str_value in VLCBOpcode.opcodes.keys():
|
|
77
|
+
#TODO: Currently returns title - in future look to parse loco ID if appropriate
|
|
78
|
+
return VLCBOpcode.opcodes[str_value]['title']
|
|
79
|
+
else:
|
|
80
|
+
raise ValueError(f"Opcode {str_value} is not defined.")
|
|
81
|
+
|
|
82
|
+
|
|
65
83
|
def format_data (self) -> OpcodeData:
|
|
66
84
|
"""Returns the opcode associated with the data string
|
|
67
85
|
|
|
@@ -463,14 +481,15 @@ class VLCBOpcode:
|
|
|
463
481
|
|
|
464
482
|
Returns:
|
|
465
483
|
String: shortened opcode string
|
|
484
|
+
or empty string for NULL opcode
|
|
466
485
|
|
|
467
|
-
Raises:
|
|
468
|
-
ValueError: If string does not contain at least 2 characters
|
|
469
486
|
"""
|
|
470
|
-
|
|
487
|
+
# Also ignore - in position 1 (eg. " - ")
|
|
488
|
+
if len(opcode_string) >= 2 and opcode_string[1] != "-":
|
|
471
489
|
return opcode_string[0:2]
|
|
472
490
|
else:
|
|
473
|
-
|
|
491
|
+
# If not a opcode_string (eg. Null) return ""
|
|
492
|
+
return ""
|
|
474
493
|
|
|
475
494
|
# Get min priority from opcode
|
|
476
495
|
@staticmethod
|
|
@@ -484,7 +503,7 @@ class VLCBOpcode:
|
|
|
484
503
|
ValueError: If opcode not found
|
|
485
504
|
"""
|
|
486
505
|
opcode = VLCBOpcode.opcode_extract(opcode)
|
|
487
|
-
if opcode in VLCBOpcode.opcodes
|
|
506
|
+
if opcode in VLCBOpcode.opcodes:
|
|
488
507
|
return VLCBOpcode.opcodes[opcode]['minpri']
|
|
489
508
|
else:
|
|
490
509
|
raise ValueError(f"Opcode {opcode} is not defined.")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|