brendan-w / python-OBD

OBD-II serial module for reading engine data
GNU General Public License v2.0
1.03k stars 363 forks source link

Implement interactive mode #91

Closed ffries closed 7 years ago

ffries commented 7 years ago

I would like to be able to start python-OBD in interactive mode.

In interactive mode, a Python terminal is launched and all commands are printed. In the end of the script, the user remains inside the interpreter and can run commands manually.

In obd.py, I am planning to add a set_interactive_mode(True/False) to enable/disable interactive mode. Interactive mode is disabled by default.

It would be as easy as: connection = obd.OBD("/dev/pts/1") connection.set_interactive_mode(True)

When interactive mode is enabled, you should still be able to continue running commands. connection = obd.OBD("/dev/pts/1") connection.set_interactive_mode(True) cmd = obd.commands.SPEED

The interactive mode is the equivalent of an interactive shell with dedicated commands. Just like psql for PostgreSQL: you can run SQL command or utilities that are not in SQL. Example: in psql, \t returns list of tables.

The interactive shell would be a nice place to add small utilities. I think about testing ELM327 compliance, sniffing, managing rules, loading a list of CAN commands from file, loading agregators, etc ...

AT would run the AT command and \ would run the utllity. Example: \help (command) \test_ELM327_compliance_fast \test_ELM327_compliance_complete \load_CAN_commands(/some/file) \add_sniffing_rule(some_rule) \list_sniffing_rules

The interactive mode is NOT a GUI but is a good start to implement a lot of features WITHOUT a gui.

ffries commented 7 years ago

The question that I am asking myself is whether interactive mode would be a shell with utilities (not programmable, i.e. a separate executable) or still remain inside obd class (to remain programmable).

All comments are welcome.

ffries commented 7 years ago

Project is inactive, closing now.