Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial project layout #1

Open
DrChat opened this issue Aug 24, 2019 · 0 comments
Open

Initial project layout #1

DrChat opened this issue Aug 24, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@DrChat
Copy link
Owner

DrChat commented Aug 24, 2019

Introduction

Let's think about the initial layout for the libobd project. How do we intend for end-users to communicate to the library?

First off - what do they want to do?

Retrieve OBD2 engine codes

Maybe the MIL is on, and the user wants to retrieve the diagnostic codes from the engine using standard OBD2 (without needing to know anything about the specific scanner used).
They would connect to the vehicle using any transport they want, and once a connection is established they can start communicating via OBD2.

E.g.

int main() {
  // Initiate a connection.
  BTTransport bt;
  if (!bt.ConnectToMAC(const uint8_t* mac))
    return 1;
  
  // Create an ELM327 scanner on top of the BT transport.
  ELM327 elm(bt);

  // Create OBD2 on top of the scanner.
  // OBD2 will have the protocol logic, which should be able to work at an abstract level across scanners.
  OBD2 obd(elm);
  // We could also just return an array of codes, or something.
  obd.EnumMILCodes([] () {
    // ... do something
  });

  // Object destructor will shut down the connection implicitly.
}

Spy on CAN bus traffic

This is going to require knowledge of the scanner being used. The user would initialize a transport and a scanner, and then ask the scanner politely to start spying on CAN bus traffic.
With the ELM327 scanner, this puts it into a mode where we cannot send any other commands (it dominates traffic to the scanner).

@DrChat DrChat added the enhancement New feature or request label Sep 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant