From 6b60ef8025e3d741af113c249444e4adbd9cd2eb Mon Sep 17 00:00:00 2001 From: Andrei Bechet Date: Fri, 26 Jun 2015 09:52:50 +0200 Subject: [PATCH 1/4] Update documentation for the android task --- 2015/android/README.md | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/2015/android/README.md b/2015/android/README.md index 5815953..54228f6 100644 --- a/2015/android/README.md +++ b/2015/android/README.md @@ -4,7 +4,22 @@ In this task you have to create an android application which will use a geofence ## Receive the current location -Use the [Android] +Use the [android location manager](http://developer.android.com/reference/android/location/LocationManager.html) to request location updates. If the location is retrieved correctly, then the following test will pass. + +```java +shouldReceiveTheLatestLocation() +``` + +## Bind to a remote service to be able to display notifications + +Use the [AIDL](http://developer.android.com/guide/components/aidl.html) to allow interprocess communication between your app and another service which will allow you to display notifications. The AIDL you will use is **HeadUnit.aidl**. You are on the client side. You will need to bind to the service using a **ServiceConnection** object ([like here](http://developer.android.com/guide/components/aidl.html#Expose)). + +```java +Intent headUnitServiceIntent = new Intent(HeadUnit.class.getName()); +headUnitServiceIntent.setPackage("com.esrlabs.headunitinterface"); +bindService(headUnitServiceIntent, serviceConnection_object, BIND_AUTO_CREATE); +``` + +## Implement a geofence object to tell if the current is inside a designated area or not + -- The controller responsible for what is displayed on the headunit runs a custom android OS. Your task is to create an android application which will use a geofence and the vehicle’s current location data in order to inform the user that he or she has just driven outside of the free parking area. You will receive the data to build the geofence prior to the development. The current -location data will come from the application developed by your fellow teammates, on the other controller of the system. In order to display a popup on the headunit you will have to implement an AIDL. To help the development process you will use a test framework which will give you fake location data and will test that you have displayed or hidden the popup accordingly. You will also have the possibility to check this in the android simulator by observing a notification in the task bar when the “current” location will be outside of the given geofence. From 13643cd6f01de937edbe3126d590d6faa9f9ea64 Mon Sep 17 00:00:00 2001 From: Andrei Bechet Date: Fri, 26 Jun 2015 10:29:17 +0200 Subject: [PATCH 2/4] Update documentation for the android task --- 2015/android/README.md | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/2015/android/README.md b/2015/android/README.md index 54228f6..fe2251c 100644 --- a/2015/android/README.md +++ b/2015/android/README.md @@ -7,12 +7,12 @@ In this task you have to create an android application which will use a geofence Use the [android location manager](http://developer.android.com/reference/android/location/LocationManager.html) to request location updates. If the location is retrieved correctly, then the following test will pass. ```java -shouldReceiveTheLatestLocation() +GeofenceAppTest.shouldReceiveTheLatestLocation() ``` ## Bind to a remote service to be able to display notifications -Use the [AIDL](http://developer.android.com/guide/components/aidl.html) to allow interprocess communication between your app and another service which will allow you to display notifications. The AIDL you will use is **HeadUnit.aidl**. You are on the client side. You will need to bind to the service using a **ServiceConnection** object ([like here](http://developer.android.com/guide/components/aidl.html#Expose)). +Use the [AIDL](http://developer.android.com/guide/components/aidl.html) to allow interprocess communication between your app and another service which will allow you to display notifications. The AIDL you will use is *HeadUnit.aidl*. You are on the client side. You will need to bind to the service using a [ServiceConnection](http://developer.android.com/reference/android/content/ServiceConnection.html) object (like [here](http://developer.android.com/guide/components/aidl.html#Expose)). ```java Intent headUnitServiceIntent = new Intent(HeadUnit.class.getName()); @@ -20,6 +20,22 @@ headUnitServiceIntent.setPackage("com.esrlabs.headunitinterface"); bindService(headUnitServiceIntent, serviceConnection_object, BIND_AUTO_CREATE); ``` -## Implement a geofence object to tell if the current is inside a designated area or not +## Implement a circle geofence object to tell if the current is inside a designated area or not + +The first step is to implement a circle geofence. You cannot use the google API because that is part of the play API, and it is not supported by our android controller. You have included in the test suite a test class for the circle geofence to help you. + +The second step is to display a popup if the current location is outside of a given geofence (alternatively to close if the location is inside). If this is correctly implemented than all the tests should be green (**Note** that unless you are going for the bonus you should disable the test in the *PolygonGeofenceTest* class). + +## **Bonus** Implement a polygon geofence instead + +You can use the [Ray-casting algorithm](https://en.wikipedia.org/wiki/Point_in_polygon). + +#### HINT + +Use the slope of a straight line in order to tell if the ray starting from the given point and going in a fixed direction, intersects an edge of the polygon. Take care that *Math.atan()* return radians, and you will have to correct a negative angle: + +```java +90 + (90 - Math.abs(angle)) +``` From 193bfdbd88578ead6b5df942a72e30dab362e790 Mon Sep 17 00:00:00 2001 From: Andrei Bechet Date: Fri, 26 Jun 2015 10:33:56 +0200 Subject: [PATCH 3/4] Update documentation for the android task --- 2015/android/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2015/android/README.md b/2015/android/README.md index fe2251c..43fa601 100644 --- a/2015/android/README.md +++ b/2015/android/README.md @@ -12,7 +12,7 @@ GeofenceAppTest.shouldReceiveTheLatestLocation() ## Bind to a remote service to be able to display notifications -Use the [AIDL](http://developer.android.com/guide/components/aidl.html) to allow interprocess communication between your app and another service which will allow you to display notifications. The AIDL you will use is *HeadUnit.aidl*. You are on the client side. You will need to bind to the service using a [ServiceConnection](http://developer.android.com/reference/android/content/ServiceConnection.html) object (like [here](http://developer.android.com/guide/components/aidl.html#Expose)). +Use the [AIDL](http://developer.android.com/guide/components/aidl.html) to allow interprocess communication between your app and another service which will allow you to display notifications. The AIDL you will use is *HeadUnit.aidl*. You are on the client side. You will need to bind to the service using an intent and a [ServiceConnection](http://developer.android.com/reference/android/content/ServiceConnection.html) object (see [here](http://developer.android.com/guide/components/aidl.html#Expose)). ```java Intent headUnitServiceIntent = new Intent(HeadUnit.class.getName()); From ab38db2ce08dadb6e0ac2903c15a0e4ea2c11a5d Mon Sep 17 00:00:00 2001 From: Andrei Bechet Date: Fri, 26 Jun 2015 10:45:53 +0200 Subject: [PATCH 4/4] small word refactoring in the general description --- 2015/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2015/README.md b/2015/README.md index 0ec167e..415f711 100644 --- a/2015/README.md +++ b/2015/README.md @@ -2,7 +2,7 @@ You are part of a 4 member team. Your task is to enhance the usability of our car-sharing system, by alerting users when they have exited the free parking area. The system comprises of two different controllers: one which is in charge of the communication with the car buses and the other which is responsible for what gets displayed on the car headunit. -- The controller in charge of the communication with the car buses will run only C++ code. Your task is to create an application which will register itself to one of the CANs and retrieve the location data. Afterwards you have to process it in order to obtain a tuple (Lat, Long), which you will later have to send to the other controller of the system. A test framework will be provided to help you in the development of this task, which will give you fake CAN location related messages and check that the output tuple is correct. A solution is considered correct only when all tests are green. +- The controller in charge of the communication with the car buses will run C++ code. Your task is to create an application which will register itself to one of the CANs and retrieve the location data. Afterwards you have to process it in order to obtain a tuple (Lat, Long), which you will later have to send to the other controller of the system. A test framework will be provided to help you in the development of this task, which will give you fake CAN location related messages and check that the output tuple is correct. A solution is considered correct only when all tests are green. - The controller responsible for what is displayed on the headunit runs a custom android OS. Your task is to create an android application which will use a geofence and the vehicle’s current location data in order to inform the user that he or she has just driven outside of the free parking area. You will receive the data to build the geofence prior to the development. The current location data will come from the application developed by your fellow teammates, on the other controller of the system. In order to display a popup on the headunit you will have to implement an AIDL. To help the development process you will use a test framework which will give you fake location data and will test that you have displayed or hidden the popup accordingly. You will also have the possibility to check this in the android simulator by observing a notification in the task bar when the “current” location will be outside of the given geofence.