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).
-
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.
-
Clone this project.
-
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.
-
Build the app and install it on your phone.
-
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)
-
Start the app.
-
If Bluetooth is not enabled yet, it asks you to enable it (Press yes).
-
Choose the OBD2 dongle from the paired devices.
-
Choose your translation language (German or English) in the App.
-
Input the first 11 digits of your vehicle identification number (VIN).
-
Press the 'GET RESULTS' button.
-
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.
-
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 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.