├── DriverBehavior ├── bin │ ├── classes.dex │ ├── resources.ap_ │ ├── jarlist.cache │ ├── DriverBehavior.apk │ ├── res │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ │ └── ic_launcher.png │ │ └── drawable-xxhdpi │ │ │ └── ic_launcher.png │ ├── classes │ │ └── com │ │ │ └── hrmb │ │ │ └── driverbehavior │ │ │ ├── R.class │ │ │ ├── R$id.class │ │ │ ├── R$attr.class │ │ │ ├── R$dimen.class │ │ │ ├── R$layout.class │ │ │ ├── R$menu.class │ │ │ ├── R$string.class │ │ │ ├── R$style.class │ │ │ ├── sensors.class │ │ │ ├── R$drawable.class │ │ │ ├── constants.class │ │ │ ├── sensordata.class │ │ │ ├── BuildConfig.class │ │ │ ├── MainActivity.class │ │ │ ├── MainActivity$1.class │ │ │ ├── MainActivity$2.class │ │ │ ├── MainActivity$3.class │ │ │ ├── locationReader.class │ │ │ ├── MainActivity$3$1.class │ │ │ ├── behaviorAnalyser.class │ │ │ ├── drivingParameters.class │ │ │ └── MainActivity$computeDrivingParams.class │ ├── dexedLibs │ │ └── android-support-v4-7966fe4fddbfaf0b2551af7ea6f4542a.jar │ └── AndroidManifest.xml ├── ic_launcher-web.png ├── libs │ └── android-support-v4.jar ├── res │ ├── drawable-hdpi │ │ └── ic_launcher.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── drawable-xxhdpi │ │ └── ic_launcher.png │ ├── values-sw600dp │ │ └── dimens.xml │ ├── values │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ ├── menu │ │ └── main.xml │ ├── values-sw720dp-land │ │ └── dimens.xml │ ├── values-v11 │ │ └── styles.xml │ ├── values-v14 │ │ └── styles.xml │ └── layout │ │ └── activity_main.xml ├── gen │ └── com │ │ └── hrmb │ │ └── driverbehavior │ │ ├── BuildConfig.java │ │ └── R.java ├── src │ └── com │ │ └── hrmb │ │ └── driverbehavior │ │ ├── drivingParameters.java │ │ ├── sensordata.java │ │ ├── constants.java │ │ ├── locationReader.java │ │ ├── behaviorAnalyser.java │ │ ├── sensors.java │ │ └── MainActivity.java ├── project.properties ├── proguard-project.txt └── AndroidManifest.xml ├── Recognition Of Driver behavior.pptx └── README.md /DriverBehavior/bin/classes.dex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/classes.dex -------------------------------------------------------------------------------- /DriverBehavior/bin/resources.ap_: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/resources.ap_ -------------------------------------------------------------------------------- /DriverBehavior/bin/jarlist.cache: -------------------------------------------------------------------------------- 1 | # cache for current jar dependecy. DO NOT EDIT. 2 | # format is 3 | # Encoding is UTF-8 4 | -------------------------------------------------------------------------------- /DriverBehavior/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/ic_launcher-web.png -------------------------------------------------------------------------------- /Recognition Of Driver behavior.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/Recognition Of Driver behavior.pptx -------------------------------------------------------------------------------- /DriverBehavior/bin/DriverBehavior.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/DriverBehavior.apk -------------------------------------------------------------------------------- /DriverBehavior/libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/libs/android-support-v4.jar -------------------------------------------------------------------------------- /DriverBehavior/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /DriverBehavior/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /DriverBehavior/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /DriverBehavior/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /DriverBehavior/bin/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /DriverBehavior/bin/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /DriverBehavior/bin/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /DriverBehavior/bin/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /DriverBehavior/bin/classes/com/hrmb/driverbehavior/R.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/classes/com/hrmb/driverbehavior/R.class -------------------------------------------------------------------------------- /DriverBehavior/bin/classes/com/hrmb/driverbehavior/R$id.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/classes/com/hrmb/driverbehavior/R$id.class -------------------------------------------------------------------------------- /DriverBehavior/bin/classes/com/hrmb/driverbehavior/R$attr.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/classes/com/hrmb/driverbehavior/R$attr.class -------------------------------------------------------------------------------- /DriverBehavior/bin/classes/com/hrmb/driverbehavior/R$dimen.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/classes/com/hrmb/driverbehavior/R$dimen.class -------------------------------------------------------------------------------- /DriverBehavior/bin/classes/com/hrmb/driverbehavior/R$layout.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/classes/com/hrmb/driverbehavior/R$layout.class -------------------------------------------------------------------------------- /DriverBehavior/bin/classes/com/hrmb/driverbehavior/R$menu.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/classes/com/hrmb/driverbehavior/R$menu.class -------------------------------------------------------------------------------- /DriverBehavior/bin/classes/com/hrmb/driverbehavior/R$string.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/classes/com/hrmb/driverbehavior/R$string.class -------------------------------------------------------------------------------- /DriverBehavior/bin/classes/com/hrmb/driverbehavior/R$style.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/classes/com/hrmb/driverbehavior/R$style.class -------------------------------------------------------------------------------- /DriverBehavior/bin/classes/com/hrmb/driverbehavior/sensors.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/classes/com/hrmb/driverbehavior/sensors.class -------------------------------------------------------------------------------- /DriverBehavior/bin/classes/com/hrmb/driverbehavior/R$drawable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/classes/com/hrmb/driverbehavior/R$drawable.class -------------------------------------------------------------------------------- /DriverBehavior/bin/classes/com/hrmb/driverbehavior/constants.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/classes/com/hrmb/driverbehavior/constants.class -------------------------------------------------------------------------------- /DriverBehavior/bin/classes/com/hrmb/driverbehavior/sensordata.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/classes/com/hrmb/driverbehavior/sensordata.class -------------------------------------------------------------------------------- /DriverBehavior/bin/classes/com/hrmb/driverbehavior/BuildConfig.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/classes/com/hrmb/driverbehavior/BuildConfig.class -------------------------------------------------------------------------------- /DriverBehavior/bin/classes/com/hrmb/driverbehavior/MainActivity.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/classes/com/hrmb/driverbehavior/MainActivity.class -------------------------------------------------------------------------------- /DriverBehavior/bin/classes/com/hrmb/driverbehavior/MainActivity$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/classes/com/hrmb/driverbehavior/MainActivity$1.class -------------------------------------------------------------------------------- /DriverBehavior/bin/classes/com/hrmb/driverbehavior/MainActivity$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/classes/com/hrmb/driverbehavior/MainActivity$2.class -------------------------------------------------------------------------------- /DriverBehavior/bin/classes/com/hrmb/driverbehavior/MainActivity$3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/classes/com/hrmb/driverbehavior/MainActivity$3.class -------------------------------------------------------------------------------- /DriverBehavior/bin/classes/com/hrmb/driverbehavior/locationReader.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/classes/com/hrmb/driverbehavior/locationReader.class -------------------------------------------------------------------------------- /DriverBehavior/bin/classes/com/hrmb/driverbehavior/MainActivity$3$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/classes/com/hrmb/driverbehavior/MainActivity$3$1.class -------------------------------------------------------------------------------- /DriverBehavior/bin/classes/com/hrmb/driverbehavior/behaviorAnalyser.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/classes/com/hrmb/driverbehavior/behaviorAnalyser.class -------------------------------------------------------------------------------- /DriverBehavior/bin/classes/com/hrmb/driverbehavior/drivingParameters.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/classes/com/hrmb/driverbehavior/drivingParameters.class -------------------------------------------------------------------------------- /DriverBehavior/gen/com/hrmb/driverbehavior/BuildConfig.java: -------------------------------------------------------------------------------- 1 | /** Automatically generated file. DO NOT MODIFY */ 2 | package com.hrmb.driverbehavior; 3 | 4 | public final class BuildConfig { 5 | public final static boolean DEBUG = true; 6 | } -------------------------------------------------------------------------------- /DriverBehavior/bin/dexedLibs/android-support-v4-7966fe4fddbfaf0b2551af7ea6f4542a.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/dexedLibs/android-support-v4-7966fe4fddbfaf0b2551af7ea6f4542a.jar -------------------------------------------------------------------------------- /DriverBehavior/bin/classes/com/hrmb/driverbehavior/MainActivity$computeDrivingParams.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mohebbihr/Recognition-of-Driver-behavior-using-Smartphone/HEAD/DriverBehavior/bin/classes/com/hrmb/driverbehavior/MainActivity$computeDrivingParams.class -------------------------------------------------------------------------------- /DriverBehavior/res/values-sw600dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | -------------------------------------------------------------------------------- /DriverBehavior/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | -------------------------------------------------------------------------------- /DriverBehavior/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | DriverBehavior 5 | Settings 6 | Hello world! 7 | 8 | -------------------------------------------------------------------------------- /DriverBehavior/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /DriverBehavior/res/values-sw720dp-land/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 128dp 8 | 9 | -------------------------------------------------------------------------------- /DriverBehavior/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /DriverBehavior/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | -------------------------------------------------------------------------------- /DriverBehavior/src/com/hrmb/driverbehavior/drivingParameters.java: -------------------------------------------------------------------------------- 1 | package com.hrmb.driverbehavior; 2 | 3 | public class drivingParameters { 4 | 5 | public int rightLaneChange =0; 6 | public int leftLaneChange =0; 7 | public int normalBrake =0; 8 | public int fastBrake =0; 9 | public int turnRightNormal =0; 10 | public int turnRightFast =0; 11 | public int turnLeftNormal =0; 12 | public int turnLeftFast =0; 13 | public int uTurnNormal =0; 14 | public int uTurnFast =0; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /DriverBehavior/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system edit 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | # 10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): 11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt 12 | 13 | # Project target. 14 | target=android-17 15 | -------------------------------------------------------------------------------- /DriverBehavior/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | -------------------------------------------------------------------------------- /DriverBehavior/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Recognition-of-Driver-behavior-using-Smartphone 2 | The goal of this project was to build a smartphone application that can recognize hazardous behavior of a car driver. The driver actions divided into several categories and the smart scoring system recognize unsafe actions. The android application has been developed for this project using Java. 3 | 4 | In this project we collect the sensor data and using this we are able to recognize driver actions. We consider these actions: Acceleration pattern, Turn left/right, U-Turn, Lane Change and Braking. Also, we assign a weight to each of these actions based on the sensor data. The scoring system divide the actions into two parts the normal and hazardous actions. The scoring system will alarm an unsafe action based on this score. You can see the architecture of this sytem in below picture. 5 | 6 | ![alt tag](https://cloud.githubusercontent.com/assets/7381026/21089013/41282a44-c002-11e6-8d6d-9da152ebf5e1.png) 7 | 8 | In Java project in the DriverBehavior folder contains the source code for this project. 9 | 10 | The Recognition Of Driver behavior.pptx file contains a presentation about this project that explains the scoring system and how we are able to recognize different actions of the car driver. 11 | -------------------------------------------------------------------------------- /DriverBehavior/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /DriverBehavior/bin/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /DriverBehavior/src/com/hrmb/driverbehavior/sensordata.java: -------------------------------------------------------------------------------- 1 | package com.hrmb.driverbehavior; 2 | 3 | import java.io.Serializable; 4 | 5 | public class sensordata implements Serializable { 6 | // accelerometer data 7 | public double ACC_X = 0; 8 | public double ACC_Y = 0; 9 | public double ACC_Z = 0; 10 | 11 | // LINEAR_ACCELERATION data 12 | public double LINACC_X = 0; 13 | public double LINACC_Y = 0; 14 | public double LINACC_Z = 0; 15 | 16 | // GYROSCOPE data 17 | public double GYR_X = 0; 18 | public double GYR_Y = 0; 19 | public double GYR_Z = 0; 20 | 21 | // GRAVITY data 22 | public double GRA_X = 0; 23 | public double GRA_Y = 0; 24 | public double GRA_Z = 0; 25 | 26 | // LIGHT data 27 | public double LIGHT = 0; 28 | 29 | // MAGNETIC_FIELD data 30 | public double MAG_X = 0; 31 | public double MAG_Y = 0; 32 | public double MAG_Z = 0; 33 | 34 | // SOUND LEVEL data 35 | public double SOUNDLEVEL = 0; 36 | 37 | // LOCATION data 38 | public double LOC_LNG = 0; 39 | public double LOC_LAT = 0; 40 | 41 | // data and time 42 | public String CURR_DATE = ""; 43 | public String CURR_TIME = ""; 44 | 45 | //frame Rate 46 | public int frameRate = 0; 47 | 48 | public sensordata(){ 49 | 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /DriverBehavior/src/com/hrmb/driverbehavior/constants.java: -------------------------------------------------------------------------------- 1 | package com.hrmb.driverbehavior; 2 | 3 | public class constants { 4 | 5 | // the maximum score in driving (the best) 6 | public static final int max_score = 10; 7 | // the minimum score in driving (the worst) 8 | public static final int min_score = 0; 9 | // default weights for each sensor data 10 | public static final int W_ACC = 1; 11 | public static final int W_LINACC = 1; 12 | public static final int W_GYR = 1; 13 | public static final int W_GRA = 1; 14 | public static final int W_LIGHT = 1; 15 | public static final int W_MAG = 1; 16 | public static final int W_SOUNDLEVEL = 1; 17 | public static final int W_LOC = 1; 18 | public static final int W_DATE = 1; 19 | public static final int W_TIME = 1; 20 | 21 | // the window size 22 | public static final int windowSize = 100; // it must be 2000 for every 100 sec 23 | //delay between getting each sample data 24 | public static final int SAMPLE_DELAY = 50; 25 | 26 | // tolerance of normal driving 27 | // we use this measure for evaluating the current score. 28 | // for example if the current score is 5 and tolerance is 2 29 | // we consider good driving between 3 to 7 30 | // lower than 3 is bad , and higher than 7 is excellent 31 | public static final float normScoreTolerance = 1.5f; 32 | 33 | } 34 | -------------------------------------------------------------------------------- /DriverBehavior/src/com/hrmb/driverbehavior/locationReader.java: -------------------------------------------------------------------------------- 1 | package com.hrmb.driverbehavior; 2 | 3 | import android.content.Context; 4 | import android.location.Location; 5 | import android.location.LocationListener; 6 | import android.location.LocationManager; 7 | import android.os.Bundle; 8 | 9 | public class locationReader implements LocationListener { 10 | 11 | private LocationManager lm; 12 | private Location myCurrentLocation; 13 | 14 | public locationReader(LocationManager lm){ 15 | this.lm = lm; 16 | 17 | lm.requestLocationUpdates(LocationManager.GPS_PROVIDER,0,0,this); 18 | this.myCurrentLocation = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER); 19 | } 20 | 21 | @Override 22 | public void onLocationChanged(Location location) { 23 | // TODO Auto-generated method stub 24 | if (location != null) { 25 | this.myCurrentLocation = location; 26 | } 27 | } 28 | 29 | @Override 30 | public void onProviderDisabled(String provider) { 31 | // TODO Auto-generated method stub 32 | 33 | } 34 | 35 | @Override 36 | public void onProviderEnabled(String provider) { 37 | // TODO Auto-generated method stub 38 | 39 | } 40 | 41 | @Override 42 | public void onStatusChanged(String provider, int status, Bundle extras) { 43 | // TODO Auto-generated method stub 44 | 45 | } 46 | 47 | public Location getCurrentLocation(){ 48 | return myCurrentLocation; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /DriverBehavior/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 19 | 20 |