LoggingClusterRenderingService.java revision 0477e29bb17ee8ec99acfa5fa966889cd45ebf34
18cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev/*
28cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev * Copyright (C) 2016 The Android Open Source Project
38cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev *
48cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev * Licensed under the Apache License, Version 2.0 (the "License");
58cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev * you may not use this file except in compliance with the License.
68cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev * You may obtain a copy of the License at
78cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev *
88cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev *      http://www.apache.org/licenses/LICENSE-2.0
98cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev *
108cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev * Unless required by applicable law or agreed to in writing, software
118cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev * distributed under the License is distributed on an "AS IS" BASIS,
128cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
138cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev * See the License for the specific language governing permissions and
148cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev * limitations under the License.
158cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev */
168cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsevpackage android.car.cluster.loggingrenderer;
178cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev
180477e29bb17ee8ec99acfa5fa966889cd45ebf34Pavel Maltsevimport android.car.cluster.renderer.InstrumentClusterRenderingService;
198cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsevimport android.car.cluster.renderer.NavigationRenderer;
208cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsevimport android.car.navigation.CarNavigationInstrumentCluster;
218cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsevimport android.graphics.Bitmap;
228cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsevimport android.util.Log;
238cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev
248cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev/**
250477e29bb17ee8ec99acfa5fa966889cd45ebf34Pavel Maltsev * Dummy implementation of {@link LoggingClusterRenderingService} to log all interaction.
268cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev */
270477e29bb17ee8ec99acfa5fa966889cd45ebf34Pavel Maltsevpublic class LoggingClusterRenderingService extends InstrumentClusterRenderingService {
288cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev
290477e29bb17ee8ec99acfa5fa966889cd45ebf34Pavel Maltsev    private static final String TAG = LoggingClusterRenderingService.class.getSimpleName();
308cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev
318cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev    @Override
320477e29bb17ee8ec99acfa5fa966889cd45ebf34Pavel Maltsev    protected NavigationRenderer getNavigationRenderer() {
338cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev        NavigationRenderer navigationRenderer = new NavigationRenderer() {
348cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev            @Override
358cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev            public CarNavigationInstrumentCluster getNavigationProperties() {
368cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev                Log.i(TAG, "getNavigationProperties");
378cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev                CarNavigationInstrumentCluster config =
388cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev                        CarNavigationInstrumentCluster.createCluster(1000);
398cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev                Log.i(TAG, "getNavigationProperties, returns: " + config);
408cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev                return config;
418cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev            }
428cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev
438cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev
448cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev            @Override
458cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev            public void onStartNavigation() {
468cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev                Log.i(TAG, "onStartNavigation");
478cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev            }
488cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev
498cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev            @Override
508cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev            public void onStopNavigation() {
518cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev                Log.i(TAG, "onStopNavigation");
528cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev            }
538cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev
548cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev            @Override
558cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev            public void onNextTurnChanged(int event, String road, int turnAngle, int turnNumber,
568cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev                    Bitmap image, int turnSide) {
578cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev                Log.i(TAG, "event: " + event + ", road: " + road + ", turnAngle: " + turnAngle
588cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev                        + ", turnNumber: " + turnNumber + ", image: " + image + ", turnSide: "
598cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev                        + turnSide);
608cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev            }
618cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev
628cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev            @Override
638cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev            public void onNextTurnDistanceChanged(int distanceMeters, int timeSeconds) {
648cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev                Log.i(TAG, "onNextTurnDistanceChanged, distanceMeters: " + distanceMeters
658cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev                        + ", timeSeconds: " + timeSeconds);
668cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev            }
678cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev        };
688cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev
698cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev        Log.i(TAG, "createNavigationRenderer, returns: " + navigationRenderer);
708cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev        return navigationRenderer;
718cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev    }
728cf86912f5abf7ceb2cf39d799a8f3b5a79d3608Pavel Maltsev}
73