1e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park/* 2e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park * Copyright (C) 2016 The Android Open Source Project 3e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park * 4e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park * Licensed under the Apache License, Version 2.0 (the "License"); 5e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park * you may not use this file except in compliance with the License. 6e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park * You may obtain a copy of the License at 7e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park * 8e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park * http://www.apache.org/licenses/LICENSE-2.0 9e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park * 10e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park * Unless required by applicable law or agreed to in writing, software 11e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park * distributed under the License is distributed on an "AS IS" BASIS, 12e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park * See the License for the specific language governing permissions and 14e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park * limitations under the License. 15e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park */ 16e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Parkpackage android.support.car.navigation; 17e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park 18e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Parkimport android.graphics.Bitmap; 193388e7848f3a30029935463afafe9b8280939127Keun-young Parkimport android.support.annotation.IntDef; 20e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Parkimport android.support.car.CarManagerBase; 21e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Parkimport android.support.car.CarNotConnectedException; 223388e7848f3a30029935463afafe9b8280939127Keun-young Parkimport java.lang.annotation.Retention; 233388e7848f3a30029935463afafe9b8280939127Keun-young Parkimport java.lang.annotation.RetentionPolicy; 243388e7848f3a30029935463afafe9b8280939127Keun-young Park 25e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park/** 2619c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * APIs for providing navigation status to the instrument cluster. For cars that have a navigation 2719c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * display built into the instrument cluster, a navigation application should also provide 2819c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * turn-by-turn information to the cluster through this manager. 299aaf8b91bdef693f555632c9ca491423e457efa1Jason Tholstrup * <p/> 30ed493f7ffcfaf46819913825a4edddde7736b429Jason Tholstrup * Navigation applications should first call 31ed493f7ffcfaf46819913825a4edddde7736b429Jason Tholstrup * {@link android.support.car.CarAppFocusManager#requestAppFocus(int, 32ed493f7ffcfaf46819913825a4edddde7736b429Jason Tholstrup * android.support.car.CarAppFocusManager.OnAppFocusOwnershipCallback)} and request 33ed493f7ffcfaf46819913825a4edddde7736b429Jason Tholstrup * {@link android.support.car.CarAppFocusManager#APP_FOCUS_TYPE_NAVIGATION}. 349aaf8b91bdef693f555632c9ca491423e457efa1Jason Tholstrup * <p/> 353388e7848f3a30029935463afafe9b8280939127Keun-young Park * After navigation focus is granted, applications should call {@code 3619c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * sendNavigationStatus(STATUS_ACTIVE);} to initialize the cluster and let it know the app will be 3719c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * sending turn events. Then, for each turn of the turn-by-turn guidance, the app calls {@link 389d08dc39212e6ecd5a60024f724ac383ab3f8e6eJason Tholstrup * #sendNavigationTurnEvent(int, CharSequence, int, int, int)}; this sends image data to the cluster 3919c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * (and is why that data is not sent in subsequent turn distance events). To update the distance 4019c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * and time to the next turn, the app should make periodic calls to {@link 4119c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * #sendNavigationTurnDistanceEvent(int, int, int, int)}. 429aaf8b91bdef693f555632c9ca491423e457efa1Jason Tholstrup * <p/> 4319c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * Calling {@code sendNavigationStatus(STATUS_INACTIVE);} when the route is completed allows the 4419c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * car to use the cluster panel for other data (such as media, weather, etc.) and is what a well 451ac59caa6b1bc760aef0adb3c675b49bfa53af9fJason Tholstrup * behaved app is expected to do. 46e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park */ 47141349407981da8a88f61c0b906240a1c3603ef7Keun-young Parkpublic abstract class CarNavigationStatusManager implements CarManagerBase { 48e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park 49e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park /** 5019c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * Listener for navigation related events. Callbacks are called in the Looper context. 51e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park */ 52d72b53500006e84b0c69e650878267c693c164a3Jason Tholstrup public interface CarNavigationCallback { 539aaf8b91bdef693f555632c9ca491423e457efa1Jason Tholstrup /** 5419c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * Instrument Cluster started in navigation mode. 559d08dc39212e6ecd5a60024f724ac383ab3f8e6eJason Tholstrup * @param manager The manager the callback is attached to. Useful if the app wishes to 56d72b53500006e84b0c69e650878267c693c164a3Jason Tholstrup * unregister. 571ac59caa6b1bc760aef0adb3c675b49bfa53af9fJason Tholstrup * @param instrumentCluster An object describing the configuration and state of the car's 581ac59caa6b1bc760aef0adb3c675b49bfa53af9fJason Tholstrup * navigation instrument cluster. 599aaf8b91bdef693f555632c9ca491423e457efa1Jason Tholstrup */ 60d72b53500006e84b0c69e650878267c693c164a3Jason Tholstrup void onInstrumentClusterStarted(CarNavigationStatusManager manager, 61d72b53500006e84b0c69e650878267c693c164a3Jason Tholstrup CarNavigationInstrumentCluster instrumentCluster); 629aaf8b91bdef693f555632c9ca491423e457efa1Jason Tholstrup 639aaf8b91bdef693f555632c9ca491423e457efa1Jason Tholstrup /** 6419c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * Instrument cluster ended. 65d72b53500006e84b0c69e650878267c693c164a3Jason Tholstrup * @param manager The manager the callback is attached to. Useful if the app wished to 66d72b53500006e84b0c69e650878267c693c164a3Jason Tholstrup * unregister. 679aaf8b91bdef693f555632c9ca491423e457efa1Jason Tholstrup */ 68d72b53500006e84b0c69e650878267c693c164a3Jason Tholstrup void onInstrumentClusterStopped(CarNavigationStatusManager manager); 69e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park } 70e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park 711ac59caa6b1bc760aef0adb3c675b49bfa53af9fJason Tholstrup /* Navigation statuses */ 72e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park public static final int STATUS_UNAVAILABLE = 0; 73e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park public static final int STATUS_ACTIVE = 1; 74e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park public static final int STATUS_INACTIVE = 2; 751ac59caa6b1bc760aef0adb3c675b49bfa53af9fJason Tholstrup 763388e7848f3a30029935463afafe9b8280939127Keun-young Park /** @hide */ 773388e7848f3a30029935463afafe9b8280939127Keun-young Park @IntDef({ 783388e7848f3a30029935463afafe9b8280939127Keun-young Park STATUS_UNAVAILABLE, 793388e7848f3a30029935463afafe9b8280939127Keun-young Park STATUS_ACTIVE, 803388e7848f3a30029935463afafe9b8280939127Keun-young Park STATUS_INACTIVE 813388e7848f3a30029935463afafe9b8280939127Keun-young Park }) 823388e7848f3a30029935463afafe9b8280939127Keun-young Park @Retention(RetentionPolicy.SOURCE) 833388e7848f3a30029935463afafe9b8280939127Keun-young Park public @interface Status {} 843388e7848f3a30029935463afafe9b8280939127Keun-young Park 851ac59caa6b1bc760aef0adb3c675b49bfa53af9fJason Tholstrup /* Turn Types */ 861ac59caa6b1bc760aef0adb3c675b49bfa53af9fJason Tholstrup /** Turn is of an unknown type.*/ 87e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park public static final int TURN_UNKNOWN = 0; 8819c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham /** Starting point of the navigation. */ 89e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park public static final int TURN_DEPART = 1; 9019c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham /** No turn, but the street name changes. */ 91e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park public static final int TURN_NAME_CHANGE = 2; 9219c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham /** Slight turn. */ 93e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park public static final int TURN_SLIGHT_TURN = 3; 9419c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham /** Regular turn. */ 95e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park public static final int TURN_TURN = 4; 9619c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham /** Sharp turn. */ 97e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park public static final int TURN_SHARP_TURN = 5; 9819c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham /** U-turn. */ 99e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park public static final int TURN_U_TURN = 6; 10019c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham /** On ramp. */ 101e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park public static final int TURN_ON_RAMP = 7; 10219c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham /** Off ramp. */ 103e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park public static final int TURN_OFF_RAMP = 8; 10419c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham /** Road forks (diverges). */ 105e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park public static final int TURN_FORK = 9; 10619c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham /** Road merges. */ 107e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park public static final int TURN_MERGE = 10; 1081ac59caa6b1bc760aef0adb3c675b49bfa53af9fJason Tholstrup /** Roundabout entrance on which the route ends. Instruction says "Enter roundabout". */ 109e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park public static final int TURN_ROUNDABOUT_ENTER = 11; 1101ac59caa6b1bc760aef0adb3c675b49bfa53af9fJason Tholstrup /** Roundabout exit. */ 111e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park public static final int TURN_ROUNDABOUT_EXIT = 12; 1121ac59caa6b1bc760aef0adb3c675b49bfa53af9fJason Tholstrup /** 11319c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * Roundabout entrance and exit. For example, "At the roundabout, take Nth exit." Be sure to 11419c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * specify the "turnNumber" parameter when using this type. 1151ac59caa6b1bc760aef0adb3c675b49bfa53af9fJason Tholstrup */ 116e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park public static final int TURN_ROUNDABOUT_ENTER_AND_EXIT = 13; 1171ac59caa6b1bc760aef0adb3c675b49bfa53af9fJason Tholstrup /** Potentially confusing intersection where the user should steer straight. */ 118e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park public static final int TURN_STRAIGHT = 14; 1191ac59caa6b1bc760aef0adb3c675b49bfa53af9fJason Tholstrup /** You're on a boat! */ 120e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park public static final int TURN_FERRY_BOAT = 16; 1211ac59caa6b1bc760aef0adb3c675b49bfa53af9fJason Tholstrup /** Train ferries for vehicles. */ 122e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park public static final int TURN_FERRY_TRAIN = 17; 1231ac59caa6b1bc760aef0adb3c675b49bfa53af9fJason Tholstrup /** You have arrived. */ 124e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park public static final int TURN_DESTINATION = 19; 1251ac59caa6b1bc760aef0adb3c675b49bfa53af9fJason Tholstrup 1263388e7848f3a30029935463afafe9b8280939127Keun-young Park /** @hide */ 1273388e7848f3a30029935463afafe9b8280939127Keun-young Park @IntDef({ 1283388e7848f3a30029935463afafe9b8280939127Keun-young Park TURN_UNKNOWN, 1293388e7848f3a30029935463afafe9b8280939127Keun-young Park TURN_DEPART, 1303388e7848f3a30029935463afafe9b8280939127Keun-young Park TURN_NAME_CHANGE, 1313388e7848f3a30029935463afafe9b8280939127Keun-young Park TURN_SLIGHT_TURN, 1323388e7848f3a30029935463afafe9b8280939127Keun-young Park TURN_TURN, 1333388e7848f3a30029935463afafe9b8280939127Keun-young Park TURN_SHARP_TURN, 1343388e7848f3a30029935463afafe9b8280939127Keun-young Park TURN_U_TURN, 1353388e7848f3a30029935463afafe9b8280939127Keun-young Park TURN_ON_RAMP, 1363388e7848f3a30029935463afafe9b8280939127Keun-young Park TURN_OFF_RAMP, 1373388e7848f3a30029935463afafe9b8280939127Keun-young Park TURN_FORK, 1383388e7848f3a30029935463afafe9b8280939127Keun-young Park TURN_MERGE, 1393388e7848f3a30029935463afafe9b8280939127Keun-young Park TURN_ROUNDABOUT_ENTER, 1403388e7848f3a30029935463afafe9b8280939127Keun-young Park TURN_ROUNDABOUT_EXIT, 1413388e7848f3a30029935463afafe9b8280939127Keun-young Park TURN_ROUNDABOUT_ENTER_AND_EXIT, 1423388e7848f3a30029935463afafe9b8280939127Keun-young Park TURN_STRAIGHT, 1433388e7848f3a30029935463afafe9b8280939127Keun-young Park TURN_FERRY_BOAT, 1443388e7848f3a30029935463afafe9b8280939127Keun-young Park TURN_FERRY_TRAIN, 1453388e7848f3a30029935463afafe9b8280939127Keun-young Park TURN_DESTINATION 1463388e7848f3a30029935463afafe9b8280939127Keun-young Park }) 1473388e7848f3a30029935463afafe9b8280939127Keun-young Park @Retention(RetentionPolicy.SOURCE) 1483388e7848f3a30029935463afafe9b8280939127Keun-young Park public @interface TurnEvent {} 1493388e7848f3a30029935463afafe9b8280939127Keun-young Park 1501ac59caa6b1bc760aef0adb3c675b49bfa53af9fJason Tholstrup /* Turn Side */ 1511ac59caa6b1bc760aef0adb3c675b49bfa53af9fJason Tholstrup /** Turn is on the left side of the vehicle. */ 152e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park public static final int TURN_SIDE_LEFT = 1; 1531ac59caa6b1bc760aef0adb3c675b49bfa53af9fJason Tholstrup /** Turn is on the right side of the vehicle. */ 154e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park public static final int TURN_SIDE_RIGHT = 2; 1551ac59caa6b1bc760aef0adb3c675b49bfa53af9fJason Tholstrup /** Turn side is unspecified. */ 156e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park public static final int TURN_SIDE_UNSPECIFIED = 3; 157e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park 1583388e7848f3a30029935463afafe9b8280939127Keun-young Park /** @hide */ 1593388e7848f3a30029935463afafe9b8280939127Keun-young Park @IntDef({ 1603388e7848f3a30029935463afafe9b8280939127Keun-young Park TURN_SIDE_LEFT, 1613388e7848f3a30029935463afafe9b8280939127Keun-young Park TURN_SIDE_RIGHT, 1623388e7848f3a30029935463afafe9b8280939127Keun-young Park TURN_SIDE_UNSPECIFIED 1633388e7848f3a30029935463afafe9b8280939127Keun-young Park }) 1643388e7848f3a30029935463afafe9b8280939127Keun-young Park public @interface TurnSide {} 165cd89ffb12b2195b70fb6983cc0abaf181f793e49Jason Tholstrup 1661ac59caa6b1bc760aef0adb3c675b49bfa53af9fJason Tholstrup /* 167cd89ffb12b2195b70fb6983cc0abaf181f793e49Jason Tholstrup * Distance units for use in {@link #sendNavigationTurnDistanceEvent(int, int, int, int)}. 168cd89ffb12b2195b70fb6983cc0abaf181f793e49Jason Tholstrup */ 1691ac59caa6b1bc760aef0adb3c675b49bfa53af9fJason Tholstrup /** Distance is specified in meters. */ 170cd89ffb12b2195b70fb6983cc0abaf181f793e49Jason Tholstrup public static final int DISTANCE_METERS = 1; 1711ac59caa6b1bc760aef0adb3c675b49bfa53af9fJason Tholstrup /** Distance is specified in kilometers. */ 172cd89ffb12b2195b70fb6983cc0abaf181f793e49Jason Tholstrup public static final int DISTANCE_KILOMETERS = 2; 1731ac59caa6b1bc760aef0adb3c675b49bfa53af9fJason Tholstrup /** Distance is specified in miles. */ 1743388e7848f3a30029935463afafe9b8280939127Keun-young Park public static final int DISTANCE_MILES = 3; 1751ac59caa6b1bc760aef0adb3c675b49bfa53af9fJason Tholstrup /** Distance is specified in feet. */ 1763388e7848f3a30029935463afafe9b8280939127Keun-young Park public static final int DISTANCE_FEET = 4; 1771ac59caa6b1bc760aef0adb3c675b49bfa53af9fJason Tholstrup /** Distance is specified in yards. */ 1783388e7848f3a30029935463afafe9b8280939127Keun-young Park public static final int DISTANCE_YARDS = 5; 1793388e7848f3a30029935463afafe9b8280939127Keun-young Park 1803388e7848f3a30029935463afafe9b8280939127Keun-young Park /** @hide */ 1813388e7848f3a30029935463afafe9b8280939127Keun-young Park @IntDef({ 1823388e7848f3a30029935463afafe9b8280939127Keun-young Park DISTANCE_METERS, 1833388e7848f3a30029935463afafe9b8280939127Keun-young Park DISTANCE_KILOMETERS, 1843388e7848f3a30029935463afafe9b8280939127Keun-young Park DISTANCE_MILES, 1853388e7848f3a30029935463afafe9b8280939127Keun-young Park DISTANCE_FEET, 1863388e7848f3a30029935463afafe9b8280939127Keun-young Park DISTANCE_YARDS 1873388e7848f3a30029935463afafe9b8280939127Keun-young Park }) 1883388e7848f3a30029935463afafe9b8280939127Keun-young Park public @interface DistanceUnit {} 189cd89ffb12b2195b70fb6983cc0abaf181f793e49Jason Tholstrup 190e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park /** 1919aaf8b91bdef693f555632c9ca491423e457efa1Jason Tholstrup * Inform the instrument cluster if navigation is active or not. 19219c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * @param status New instrument cluster navigation status, one of the STATUS_* constants in 1939aaf8b91bdef693f555632c9ca491423e457efa1Jason Tholstrup * this class. 194d72b53500006e84b0c69e650878267c693c164a3Jason Tholstrup * @throws CarNotConnectedException if the connection to the car service has been lost. 195e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park */ 196141349407981da8a88f61c0b906240a1c3603ef7Keun-young Park public abstract void sendNavigationStatus(@Status int status) throws CarNotConnectedException; 197e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park 198e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park /** 19919c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * Send a Navigation Next Step event to the car. 2009aaf8b91bdef693f555632c9ca491423e457efa1Jason Tholstrup * <p/> 20119c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * Roundabout Example: In a roundabout with four, evenly spaced exits, the 20219c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * first exit is turnNumber=1, turnAngle=90; the second exit is turnNumber=2, 20319c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * turnAngle=180; the third exit is turnNumber=3, turnAngle=270. turnNumber and turnAngle are 204e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park * counted in the direction of travel around the roundabout (clockwise for roads where the car 20519c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * drives on the left side of the road, such as Australia; counter-clockwise for roads 20619c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * where the car drives on the right side of the road, such as the USA). 207e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park * 2083388e7848f3a30029935463afafe9b8280939127Keun-young Park * @param turnEvent Turn event type ({@link #TURN_TURN}, {@link #TURN_U_TURN}, {@link 2099aaf8b91bdef693f555632c9ca491423e457efa1Jason Tholstrup * #TURN_ROUNDABOUT_ENTER_AND_EXIT}, etc). 2103388e7848f3a30029935463afafe9b8280939127Keun-young Park * @param eventName Name of the turn event like road name to turn. For example "Charleston road" 2113388e7848f3a30029935463afafe9b8280939127Keun-young Park * in "Turn right to Charleston road" 21219c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * @param turnAngle Turn angle in degrees between the roundabout entry and exit (0..359). Used 21319c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * only for event type {@link #TURN_ROUNDABOUT_ENTER_AND_EXIT}. -1 if unused. 21419c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * @param turnNumber Turn number, counting from the roundabout entry to the exit. Used only 21519c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * for event type {@link #TURN_ROUNDABOUT_ENTER_AND_EXIT}. -1 if unused. 21619c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * @param turnSide Turn side ({@link #TURN_SIDE_LEFT}, {@link #TURN_SIDE_RIGHT} or {@link 2179aaf8b91bdef693f555632c9ca491423e457efa1Jason Tholstrup * #TURN_SIDE_UNSPECIFIED}). 218d72b53500006e84b0c69e650878267c693c164a3Jason Tholstrup * @throws CarNotConnectedException if the connection to the car service has been lost. 2199aaf8b91bdef693f555632c9ca491423e457efa1Jason Tholstrup */ 2209d08dc39212e6ecd5a60024f724ac383ab3f8e6eJason Tholstrup public abstract void sendNavigationTurnEvent(@TurnEvent int turnEvent, CharSequence eventName, 221141349407981da8a88f61c0b906240a1c3603ef7Keun-young Park int turnAngle, int turnNumber, @TurnSide int turnSide) throws CarNotConnectedException; 2229aaf8b91bdef693f555632c9ca491423e457efa1Jason Tholstrup 2239aaf8b91bdef693f555632c9ca491423e457efa1Jason Tholstrup /** 2249d08dc39212e6ecd5a60024f724ac383ab3f8e6eJason Tholstrup * Same as the public version ({@link #sendNavigationTurnEvent(int, CharSequence, int, int, 2259d08dc39212e6ecd5a60024f724ac383ab3f8e6eJason Tholstrup * Bitmap, int)}) except a custom image can be sent to the cluster. See documentation for that 2269d08dc39212e6ecd5a60024f724ac383ab3f8e6eJason Tholstrup * method. 2279aaf8b91bdef693f555632c9ca491423e457efa1Jason Tholstrup * 22819c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * @param image image to be shown in the instrument cluster. Null if instrument cluster type is 2299d08dc39212e6ecd5a60024f724ac383ab3f8e6eJason Tholstrup * {@link CarNavigationInstrumentCluster.ClusterType#CLUSTER_TYPE_IMAGE_CODES_ONLY}, or if 2309d08dc39212e6ecd5a60024f724ac383ab3f8e6eJason Tholstrup * the image parameters are malformed (length or width non-positive, or illegal 2319d08dc39212e6ecd5a60024f724ac383ab3f8e6eJason Tholstrup * imageColorDepthBits) in the initial NavigationStatusService call. 232e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park * 2339aaf8b91bdef693f555632c9ca491423e457efa1Jason Tholstrup * @hide only first party applications may send a custom image to the cluster. 234e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park */ 235141349407981da8a88f61c0b906240a1c3603ef7Keun-young Park public abstract void sendNavigationTurnEvent(@TurnEvent int turnEvent, CharSequence eventName, 236141349407981da8a88f61c0b906240a1c3603ef7Keun-young Park int turnAngle, int turnNumber, Bitmap image, @TurnSide int turnSide) 237141349407981da8a88f61c0b906240a1c3603ef7Keun-young Park throws CarNotConnectedException; 238e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park 239e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park /** 24019c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * Send a Navigation Next Step Distance event to the car. 241e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park * 24219c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * @param distanceMeters Distance to next event in meters. 24319c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * @param timeSeconds Time to next event in seconds. 24419c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * @param displayDistanceMillis Distance to the next event formatted as it will be displayed by 24519c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * the calling app, in milli-units. For example, 1.25 should be supplied as 1250. 24619c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * @param displayDistanceUnit Unit type to use on of the DISTANCE_* types defined in this 247cd89ffb12b2195b70fb6983cc0abaf181f793e49Jason Tholstrup * file. 24819c8ab20a71c725316241f4b0c8f44ce18c39d39Heidi von Markham * @return Returns {@code true} if successful. 249d72b53500006e84b0c69e650878267c693c164a3Jason Tholstrup * @throws CarNotConnectedException if the connection to the car service has been lost. 250e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park */ 251141349407981da8a88f61c0b906240a1c3603ef7Keun-young Park public abstract void sendNavigationTurnDistanceEvent(int distanceMeters, int timeSeconds, 252cd89ffb12b2195b70fb6983cc0abaf181f793e49Jason Tholstrup int displayDistanceMillis, int displayDistanceUnit) throws CarNotConnectedException; 253e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park 254e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park /** 255d72b53500006e84b0c69e650878267c693c164a3Jason Tholstrup * @param callback {@link CarNavigationCallback} to be registered, replacing any existing 2569aaf8b91bdef693f555632c9ca491423e457efa1Jason Tholstrup * listeners. 257d72b53500006e84b0c69e650878267c693c164a3Jason Tholstrup * @throws CarNotConnectedException if the connection to the car service has been lost. 258e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park */ 259141349407981da8a88f61c0b906240a1c3603ef7Keun-young Park public abstract void addListener(CarNavigationCallback callback) 260141349407981da8a88f61c0b906240a1c3603ef7Keun-young Park throws CarNotConnectedException; 261e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park 262e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park /** 263d72b53500006e84b0c69e650878267c693c164a3Jason Tholstrup * Unregister the {@link CarNavigationCallback} associated with this instance. 264e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park */ 265141349407981da8a88f61c0b906240a1c3603ef7Keun-young Park public abstract void removeListener(); 266e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park} 267