GithubHelp home page GithubHelp logo

mattyoliveira / android-obd-example-app Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hellaventures/android-obd-example-app

0.0 0.0 0.0 230 KB

Boilerplate App for reading and translating OBD data

License: Other

Java 100.00%

android-obd-example-app's Introduction

Android-OBD-Example-App

Content

  1. Overview
  2. Features
  3. Usage
    1. Getting started
    2. Error Handling
  4. Development
    1. Hardware
    2. Dependencies
    3. Project Expansion
    4. Project Structure
  5. Feedback
*** This App can be used as a boilerplate for reading Diagnostic Trouble Codes (DTCs) from the OBD2 port of a car via Bluetooth. These trouble codes can be translated with the Car Diagnostic API by Hella Ventures and their translation will be displayed in the App.

Request View

Response View

Note: This App's OBD communication is based on the Android OBD-II Reader application by pires but was strongly adapted to fit the needed requirements.

Android's Bluetooth features are used to receive the DTCs and the HTTP library Volley for the API connection. The App provides the following main features:

  • OBD2 communication (Bluetooth).
  • API communication (Volley).
  1. If you want to use our API for translating error codes, follow the Getting Started Guide to get access to the Car Diagnostic API. If you just want to read error codes, you can skip this step.

  2. Clone this project.

  3. Open the ApiHelper.java file with an editor and input your client id and client secret, which you got from IBM Bluemix, as value of the constants CLIENT_ID and CLIENT_SECRET. These values are necessary for using the API.

  4. Build the app and install it on your phone.

  5. In your phone's Bluetooth settings, pair your phone with your OBD2 dongle. As a Bluetooth dongle, we can recommend the "BerryKing Autoscan 2016". (For PIN: See your Bluetooth dongle's instructions)

  6. Start the app.

  7. If Bluetooth is not enabled yet, it asks you to enable it (Press yes).

  8. Choose the OBD2 dongle from the paired devices.

  9. Choose your translation language (German or English) in the App.

  10. Input the first 11 digits of your vehicle identification number (VIN).

  11. Press the 'GET RESULTS' button.

  12. The results will be displayed, after they have been received and translated.

  • OBD Command Failure: Appears from time to time while using the ISO9141-2 protocol. Just try again until it works.

  • Cannot connect to bluetooth device!: Appears if you have chosen the wrong device to connect to or if the Bluetooth dongle is not inserted properly. Check the dongle and your chosen device again.

You need the following hardware in combination with this app:
  • a vehicle with OBD2 port
    or a simulator, e.g. Diamex OBD2 Profi Simulator, supporting at least one of the following protocols:

    • ISO9141-2

    • KWP2K slow

    • KWP2K fast

    • CAN 11/500

    • CAN 29/500

    • CAN 11/250

    • CAN 29/250

  • a Bluetooth dongle, e.g. BerryKing Autoscan 2016

  • a smartphone with Android 4.1 or higher installed

Our test environment included: Diamex OBD2 Profi Simulator, BerryKing Autoscan 2016 and LG-H320 with Android 5.0.1 installed.

The app has the following dependencies: - **[Android Volley](https://developer.android.com/training/volley/index.html)**: HTTP library for networking in Android apps - **[obd-java-api](https://github.com/pires/obd-java-api)**: OBD java api for OBD2 communications - Click the "Clone or download" button and then "Download ZIP". Unzip the project. In Android Studio do the follwoing steps: **File -> New -> Import Project... -> _Select the unzipped folder_ -> OK**
  • Input your client id and client secret (by IBM Bluemix API Connect) as values of the constants CLIENT_ID and CLIENT_SECRET in ApiHelper.java file.

  • Adapt the project to your needs.

The project is structured in three main packages: [ui](app/src/main/java/veronika/hella/obdapp/ui), [obd](app/src/main/java/veronika/hella/obdapp/obd) and [api](app/src/main/java/veronika/hella/obdapp/api)

The ui package contains the classes for the user interactions:

  • RequestActivity (+ activity_request.xml): The main/launch activity.
    Includes information about the action to be performed, the connection mode and the translator API. You can choose one of two translation languages - English (EN) or German (DE) - and you can input your car's VIN or take the default VIN. With pressing the send button the input values will be read and further processes will be started.
    -> Takes user input.

  • ResponseActivity (+ activity_response.xml): The result activity.
    Lists the results of the communcations.
    -> Displays the translation results.

  • ResultAdapter (+ result_item.xml): Adapter for the listview of the ResponseActivity.
    -> Holds the data for the ResponseActivity.

The obd package includes all classes needed to communicate with the Bluetooth dongle connected to the OBD port:

  • ObdHelper: Main OBD communication class.
    Sets up Bluetooth, chooses a device to communicate to and establishes a connection.
    -> Establishes Bluetooth connection and sends obd commands.

  • MyTroubleCodesCommand: Adapted version of TroubleCodesCommand
    This subclass of TroubleCodesCommand was adapted to read the CAN response, send by our OBD Bluetooth dongle, correctly.
    -> Formats the raw data received from the obd to standard error code format.

The api package holds the resources used for the API communication:

  • ApiHelper: Main API communication class.
    Generates URLs and uses them to make a HTTP GET request using the Volley library.
    Uses client id and secret as API's authentication paramters .

If you want to file a bug report or make a feature request for this App, please use the issues section of this repo.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.