From 6f473ff4c7dc55ab7a4da2a6eb7b8d8bf3434e30 Mon Sep 17 00:00:00 2001 From: "florian.bramer" Date: Mon, 15 Jun 2015 15:56:31 +0200 Subject: [PATCH] implemented 1st draft of service mock --- .../src/main/AndroidManifest.xml | 16 +++++-- .../headunitservicemock/HeadUnitService.java | 45 ++++++++++++++++++ .../src/main/res/drawable/tum_logo.gif | Bin 0 -> 1542 bytes 3 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 2015/android/Geofence/headunitservicemock/src/main/java/com/esrlabs/headunitservicemock/HeadUnitService.java create mode 100644 2015/android/Geofence/headunitservicemock/src/main/res/drawable/tum_logo.gif diff --git a/2015/android/Geofence/headunitservicemock/src/main/AndroidManifest.xml b/2015/android/Geofence/headunitservicemock/src/main/AndroidManifest.xml index ca8576c..a35541e 100644 --- a/2015/android/Geofence/headunitservicemock/src/main/AndroidManifest.xml +++ b/2015/android/Geofence/headunitservicemock/src/main/AndroidManifest.xml @@ -1,9 +1,17 @@ + - - + package="com.esrlabs.headunitservicemock" > + + + diff --git a/2015/android/Geofence/headunitservicemock/src/main/java/com/esrlabs/headunitservicemock/HeadUnitService.java b/2015/android/Geofence/headunitservicemock/src/main/java/com/esrlabs/headunitservicemock/HeadUnitService.java new file mode 100644 index 0000000..3013b2f --- /dev/null +++ b/2015/android/Geofence/headunitservicemock/src/main/java/com/esrlabs/headunitservicemock/HeadUnitService.java @@ -0,0 +1,45 @@ +package com.esrlabs.headunitservicemock; + +import android.app.Notification; +import android.app.NotificationManager; +import android.app.Service; +import android.content.Context; +import android.content.Intent; +import android.os.IBinder; +import android.os.RemoteException; + +import com.esrlabs.headunitinterface.HeadUnit; + +/** + * A test implementation of the HeadUnit interface + * + * Provides a way to run against the interface without the presence of a real headunit + * + * Will use the Android UI instead + */ +public class HeadUnitService extends Service { + public HeadUnitService() { + } + + @Override + public IBinder onBind(Intent intent) { + return binder; + } + + private final HeadUnit.Stub binder = new HeadUnit.Stub() { + @Override + public void showNotification(String text) throws RemoteException { + Notification.Builder builder = new Notification.Builder(getBaseContext()).setContentText(text).setSmallIcon(R.drawable.tum_logo); + notificationService().notify(0,builder.build()); + } + + @Override + public void hideAllNotifications() throws RemoteException { + notificationService().cancelAll(); + } + }; + + private NotificationManager notificationService() { + return (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); + } +} diff --git a/2015/android/Geofence/headunitservicemock/src/main/res/drawable/tum_logo.gif b/2015/android/Geofence/headunitservicemock/src/main/res/drawable/tum_logo.gif new file mode 100644 index 0000000000000000000000000000000000000000..6e628f7ca1595642b21c8bd772544efc853d3ed5 GIT binary patch literal 1542 zcmV+h2Ko6%Nk%w1VZH!l0Q4RJ0A;;Ki^N5Y#8HpORExz>l*m$+$y1ieT#(0FmC9tB z&1js>beqk3tkiv})QPv+kFwam)#}IB>&oBm&e-hK-R{-g?&In6;pp_|>-F*T`S$qw z{QUj@|Nj5~{{R30A^8LW0015UA^sIZa%Ew3Wn>_CX>@2HRA^-&M@dak04x9i006!K zWB>pK{-6YmWNDsgs;=z0cyKJwb8FvtuB+ni|F;)yNCO&=$Wt%L^a+VjPjgCbEvwkn zGdj$AvDfc+%dLse$S}G}F2~kzpE}NLyQTEJRZq3M`G6>MflhZtgouNPIeuk}go=+g zja-s|k(MizQJH#}ohX}7pmd+4C89*9aHgvOsa>vTt*fwyvR|~Pwr03q7!JY0!^92> zI|K;I%goKoJG?T!UmY6O*Vx$_5jq1D7vSOI59j=)%V9yF2Ln4Q2;9J6hd+He_z48a$RHkq1`q5g=#Qa8d=PO+^hXf~Iv5-N zGp6j=P{+f4{YVBhxYD0S9USp_bO{pX#F+wX;=75F#QO9y_^g<=J*?M;**%_YJa2&5jOih&Y$qHgdZ$ZUebrEO{Z>PcCCy;t9uvgrE)%E^&-G6BX zh#P+BwTIw)3dYA^Y4$zH7G#|v_L*XUSteM1Za~)pYr0Ly0(>lpmK}3p>`BhvI!mUWn#h7GW7Q5*Z$Eu=yq%fal$5 z+m|U;3B{EuWNGG>m2^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