richClubb / python-uds

A uds library for python
MIT License
95 stars 54 forks source link

More Enums and Constants would help #12

Open beckyc567 opened 5 years ago

beckyc567 commented 5 years ago

General (occurs in both the examples and non-example code) - I'd have been tempted to have defined some of the values as constant, to make the code a little more readable - the code could then use the defined constants - you know this stuff backwards, so you don't need it so much, so it's easily overlooked. You have assigned them to variables in some cases, but it's embedded within the code, e.g. "positiveResponse = 0x62"

Also in the past, we used to follow a convention of using all caps with underscores for constants - I don't know if people still use that these days?

Same with things like "3" & "4" (num modules), and "4" & "28" (boot s/w id) used as payload indexing to extract number of modules - not the worse magic numbers ever, but worth 5 secs thought?

... there is some good enum use though - ODB.py, and ISO14229.py enums are good, so good look to those for examples for the rest