DIscover and print all information #84
DIscover and print all information #84ffries wants to merge 6 commits intobrendan-w:masterfrom ffries:master
Conversation
…t_baud_rate() to query speed of connection.
…otocol, port name, port speed and supported commands.
|
An option would be to write a simpler discover_and_exit() clause, which would auto-connect, discover, print OBD available commands and exit. |
|
|
||
| else: | ||
| print ("Impossible to print discovered information: no connection to the ECU.") | ||
|
|
There was a problem hiding this comment.
Hey, thanks for the PR!
While I don't have a problem with the printing code, I don't think the library core is the right place for this. I'd like to separate the concerns of OBD communications and tool-like terminal printing. I've been meaning to remove the print_commands function above (which I've intentionally not documented). Instead, I'd be totally supportive of adding a /tools directory for CLI applications akin to this.
|
|
||
| o.interface = FakeELM("A different port name") | ||
| assert o.port_name() == o.interface._portname | ||
| assert o.get_port_name() == o.interface.get_port_name() |
There was a problem hiding this comment.
I suppose it just comes down to preference; I'd prefer to leave these the way they were. I'd argue shorter is usually better. Also, if we decide to change them, lets do that in a separate PR.
There was a problem hiding this comment.
Shorter is never better unless there is a concern for memory, which there is not. More descriptive is better IMO.
| if self.interface is None: | ||
| return [] | ||
| else: | ||
| return self.interface.get_ecus() |
There was a problem hiding this comment.
Do you have a specific use for this function? I couldn't quite justify yet, since we only really label the tx ID of the engine.
According to feature #82
This patch adds a print_discovered() clause which prints all detailed information about a connection.
It can simply be triggered using:
It also modified some functions with the prefix "get_" for clarity and updates testing accordingly.
Feel free to modify, but we probably need some kind of utility to help and debug users.