• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2019 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto3";
18
19package android.car.cluster.navigation;
20
21option java_package = "android.car.cluster.navigation";
22option java_outer_classname = "NavigationState";
23
24// A reference to an image. This consists of a 'content://' style URI plus
25// attributes describing the image.
26//
27// Sizing: The aspect ratio of the image is given in aspect_ratio.
28//         When requesting the image using this URI a 'w' and 'h' parameter
29//         must be added to the URI parameter list to request an image size.
30//         There is no guarantee that the specific size requested will actually
31//         be returned, however.
32// Margins: The referenced image does not have internal margins.
33// Format: Content URI must reference a file with MIME type
34//         'image/png', 'image/jpeg' or 'image/bmp'.
35// Color: Images can be either "tintable" or not. A "tintable" image is such that
36//        all its content is defined in its alpha channel, while its color
37//        (all other channels) can be altered without losing information
38//        (e.g. icons). A non "tintable" images contains information in all its
39//        channels (e.g. photos).
40// Caching: Given the same image reference and the same requested size,
41//          it is assumed that the exact same image will always be returned.
42//          This means that it should be safe to cache an image once requested
43//          the first time, using this image reference plus requested size as key,
44//          for as long as needed.
45message ImageReference {
46  // A URI defining the location that the image can be retrieved from.
47  //
48  // When requesting the image from this URI, a desired image size must be
49  // specified by editing the parameter list to add the following two
50  // parameters:
51  //   w: width desired maximum width (must be greater than 0)
52  //   h: height desired maximum height (must be greater than 0)
53  //
54  // For example, if the `content_uri` is
55  // `content://some.package.name/some/path`, then the request must be:
56  // `content://some.package.name/some/path?w=<width>&h=<height>` (with <width>
57  // and <height> replaced with the requested values).
58  //
59  // Note that the resulting image is not guaranteed to match the requested
60  // size.
61  string content_uri = 1;
62
63  // The aspect ratio of the image, being width divided by height.
64  double aspect_ratio = 2;
65
66  // Indicates whether this image is "tintable" or not.
67  // An image is "tintable" when all its content is defined in its
68  // alpha-channel, designed to be colorized
69  // (e.g. using android.graphics.PorterDuff.Mode#SRC_ATOP image composition).
70  bool is_tintable = 3;
71}
72
73// Distance along the planned route between relevant points in the navigation
74message Distance {
75  // Possible units used to display this distance.
76  enum Unit {
77    // Display unit is unknown, no distance information should be displayed.
78    UNKNOWN = 0;
79    METERS = 1;
80    KILOMETERS = 2;
81    MILES = 3;
82    FEET = 4;
83    YARDS = 5;
84  }
85
86  // The distance in meters.
87  int32 meters = 1;
88
89  // The distance measured in the unit indicated at `display_units`, already
90  // internationalized and ready for display, or empty if no distance value was
91  // provided. If empty, the distance shouldn’t be displayed to the driver.
92  //
93  // This distance is for display only (it might be a rounded representation of
94  // the actual distance) and must match the distance displayed anywhere else
95  // in the vehicle.
96  //
97  // For example, a distance of 1200 meters in ES_es locale could be
98  // represented with `display_value` of "1,2" and `display_units` of KILOMETERS.
99  string display_value = 2;
100
101  // The distance unit that should be used to display the distance value
102  // (adjusted to the current user's locale and/or location). This matches the
103  // unit used in `display_value`.
104  Unit display_units = 3;
105}
106
107// Information about a maneuver that the driver will be required to perform.
108message Maneuver {
109
110  // Next ID: 57
111  enum Type {
112    // Maneuver type is unknown, no maneuver information should be displayed.
113    UNKNOWN = 0;
114
115    // Starting point of the navigation (e.g. "Start driving on Main St.")
116    DEPART = 1;
117
118    // No turn, but the street name changes (e.g. "Continue on Main St.")
119    NAME_CHANGE = 2;
120
121    // No turn, from 0 (included) to 10 (excluded) degrees. Used when we just
122    // wish to say "Keep left" or "Keep right". Note that this is used in
123    // contrast to STRAIGHT for disambiguating cases where there is more than
124    // one option to go into the same general direction.
125    KEEP_LEFT = 3;
126    KEEP_RIGHT = 4;
127
128    // Slight turn at an intersection, from 10 (included) to 45 (excluded)
129    // degrees.
130    TURN_SLIGHT_LEFT = 5;
131    TURN_SLIGHT_RIGHT = 6;
132
133    // Regular turn at an intersection, from 45 (included) to 135 (excluded)
134    // degrees.
135    TURN_NORMAL_LEFT = 7;
136    TURN_NORMAL_RIGHT = 8;
137
138    // Sharp turn at an intersection, from 135 (included) to 175 (excluded)
139    // degrees
140    TURN_SHARP_LEFT = 9;
141    TURN_SHARP_RIGHT = 10;
142
143    // A turn onto the opposite side of the same street, from 175 (included) to
144    // 180 (included) degrees.
145    U_TURN_LEFT = 11;
146    U_TURN_RIGHT = 12;
147
148    // A turn to enter a turnpike or freeway. See TURN_NORMAL_LEFT,
149    // TURN_SLIGHT_RIGHT, etc., for the difference between slight, sharp, etc.
150    ON_RAMP_SLIGHT_LEFT = 13;
151    ON_RAMP_SLIGHT_RIGHT = 14;
152    ON_RAMP_NORMAL_LEFT = 15;
153    ON_RAMP_NORMAL_RIGHT = 16;
154    ON_RAMP_SHARP_LEFT = 17;
155    ON_RAMP_SHARP_RIGHT = 18;
156    ON_RAMP_U_TURN_LEFT = 19;
157    ON_RAMP_U_TURN_RIGHT = 20;
158
159    // A turn to exit a turnpike or freeway. See TURN_NORMAL_LEFT,
160    // TURN_SLIGHT_RIGHT, etc., for the difference between slight, sharp, etc.
161    OFF_RAMP_SLIGHT_LEFT = 21;
162    OFF_RAMP_SLIGHT_RIGHT = 22;
163    OFF_RAMP_NORMAL_LEFT = 23;
164    OFF_RAMP_NORMAL_RIGHT = 24;
165
166    // Road diverges (e.g. "Keep left/right at the fork").
167    FORK_LEFT = 25;
168    FORK_RIGHT = 26;
169
170    // Current road joins another (e.g. "Merge left/right onto Main St.").
171    MERGE_LEFT = 27;
172    MERGE_RIGHT = 28;
173    MERGE_SIDE_UNSPECIFIED = 54;
174
175    // Roundabout entrance on which the current road ends (e.g. "Enter the
176    // roundabout").
177    ROUNDABOUT_ENTER = 29;
178
179    // Used when leaving a roundabout when the step starts in it (e.g. "Exit
180    // the roundabout").
181    ROUNDABOUT_EXIT = 30;
182
183    // The following are entrance and exit (e.g. "At the roundabout, take Nth
184    // exit") on a clockwise roundabout (as seen from above, typical for
185    // left-hand drive countries) where the exit is a particular turn amount
186    // (sharp right, vs. normal left, etc. - see the definitions for
187    // TURN_SHARP_LEFT, TURN_SLIGHT_RIGHT, etc., for a definition of what "sharp"
188    // vs. "normal" vs. "slight" is.
189    ROUNDABOUT_ENTER_AND_EXIT_CW = 55;
190    ROUNDABOUT_ENTER_AND_EXIT_CW_SHARP_RIGHT = 31;
191    ROUNDABOUT_ENTER_AND_EXIT_CW_NORMAL_RIGHT = 32;
192    ROUNDABOUT_ENTER_AND_EXIT_CW_SLIGHT_RIGHT = 33;
193    ROUNDABOUT_ENTER_AND_EXIT_CW_STRAIGHT = 34;
194    ROUNDABOUT_ENTER_AND_EXIT_CW_SHARP_LEFT = 35;
195    ROUNDABOUT_ENTER_AND_EXIT_CW_NORMAL_LEFT = 36;
196    ROUNDABOUT_ENTER_AND_EXIT_CW_SLIGHT_LEFT = 37;
197    ROUNDABOUT_ENTER_AND_EXIT_CW_U_TURN = 38;
198
199    // The following are entrance and exit (e.g. "At the roundabout, take Nth
200    // exit") on a counter-clockwise roundabout (as seen from above, typical
201    // for right-hand drive countries) where the exit is a particular turn
202    // amount (sharp right, vs. normal left, etc. - see the definitions for
203    // TURN_SHARP_LEFT, TURN_SLIGHT_RIGHT, etc., for a definition of what "sharp"
204    // vs. "normal" vs. "slight" is.
205    ROUNDABOUT_ENTER_AND_EXIT_CCW = 56;
206    ROUNDABOUT_ENTER_AND_EXIT_CCW_SHARP_RIGHT = 39;
207    ROUNDABOUT_ENTER_AND_EXIT_CCW_NORMAL_RIGHT = 40;
208    ROUNDABOUT_ENTER_AND_EXIT_CCW_SLIGHT_RIGHT = 41;
209    ROUNDABOUT_ENTER_AND_EXIT_CCW_STRAIGHT = 42;
210    ROUNDABOUT_ENTER_AND_EXIT_CCW_SHARP_LEFT = 43;
211    ROUNDABOUT_ENTER_AND_EXIT_CCW_NORMAL_LEFT = 44;
212    ROUNDABOUT_ENTER_AND_EXIT_CCW_SLIGHT_LEFT = 45;
213    ROUNDABOUT_ENTER_AND_EXIT_CCW_U_TURN = 46;
214
215    // Driver should steer straight.
216    STRAIGHT = 47;
217
218    // Drive towards a boat ferry for vehicles (e.g. "Take the ferry").
219    FERRY_BOAT = 48;
220
221    // Drive towards a train ferry for vehicles (e.g. "Take the train").
222    FERRY_TRAIN = 49;
223
224    // Arrival to a destination where the direction is unknown.
225    DESTINATION = 50;
226
227    // Arrival to a destination located in a particular direction (straight
228    // ahead, left side of the road, right side of the road).
229    DESTINATION_STRAIGHT = 51;
230    DESTINATION_LEFT = 52;
231    DESTINATION_RIGHT = 53;
232  }
233
234  // The type of the maneuver.
235  Type type = 1;
236
237  // The roundabout exit number, starting from 1 to designate the first exit
238  // after joining the roundabout, and increasing in circulation order.
239  // Only relevant if type is ROUNDABOUT_EXIT or any variation of
240  // ROUNDABOUT_ENTER_AND_EXIT.
241  //
242  // For example, if the driver is joining a counter-clockwise roundabout
243  // with 4 exits, then the exit to the right would be exit #1, the one
244  // straight ahead would be exit #2, the one to the left would be exit #3
245  // and the one used by the driver to join the roundabout would be exit #4.
246  int32 roundabout_exit_number = 2;
247
248  // A reference to an image representing this maneuver,
249  // or not present if image representation is not available.
250  ImageReference icon = 3;
251}
252
253// Configuration of a single lane of a road at a particular point in the
254// navigation. It describes all possible directions the driver could go
255// from this lane, and indicates which directions the driver could take
256// to stay on the navigation route.
257message Lane {
258  // One of the possible directions a driver can go when using a particular
259  // lane at a particular step in the navigation. This defines the icon(s)
260  // that must be combined to display a lane configuration to the user.
261  message LaneDirection {
262    enum Shape {
263      // The shape is unknown, in which case no lane information should be
264      // shown.
265      UNKNOWN = 0;
266
267      // No turn.
268      STRAIGHT = 1;
269
270      // Slight left turn, from 10 (included) to 45 (excluded) degrees.
271      SLIGHT_LEFT = 2;
272
273      // Slight right turn, from 10 (included) to 45 (excluded) degrees.
274      SLIGHT_RIGHT = 3;
275
276      // Regular left turn, from 45 (included) to 135 (excluded) degrees.
277      NORMAL_LEFT = 4;
278
279      // Regular right turn, from 45 (included) to 135 (excluded) degrees.
280      NORMAL_RIGHT = 5;
281
282      // Sharp left turn, from 135 (included) to 175 (excluded) degrees.
283      SHARP_LEFT = 6;
284
285      // Sharp right turn, from 135 (included) to 175 (excluded) degrees.
286      SHARP_RIGHT = 7;
287
288      // A left turn onto the opposite side of the same street, from 175
289      // (included) to 180 (included) degrees
290      U_TURN_LEFT = 8;
291
292      // A right turn onto the opposite side of the same street, from 175
293      // (included) to 180 (included) degrees
294      U_TURN_RIGHT = 9;
295    }
296
297    // The shape of this lane direction.
298    Shape shape = 1;
299
300    // True if this is a valid direction the driver can take in order to stay
301    // in the navigation route, or false if it will take the drive off the
302    // navigation route.
303    bool is_highlighted = 2;
304  }
305
306  // The possible directions a driver can take from this lane.
307  repeated LaneDirection lane_directions = 1;
308}
309
310// An instruction to a user to perform an action during their drive composed of
311// a sequence of graphic elements (e.g. text, images) to be displayed
312// one after another.
313//
314// Each sequence will have a plain text representation in `alternate_text`
315// and in the case of the absence of a rich representation,
316// the sequence of elements in `elements` may be left empty.
317// The textual representation may also be used as a fallback for when the
318// elements fail to render.
319message Cue {
320  // One item in the sequence that makes up a Cue,
321  // a sequence of graphic elements that can be displayed one after another.
322  //
323  // A CueElement can contain text, a graphic element, or both.
324  // The text of a CueElement with an image reference should be representative
325  // of the image.
326  //
327  // The image should be rendered if possible instead of the
328  // text. Otherwise, `CueElement.text` should be used as a fallback.
329  //
330  // If rendering fails and the text is empty, then no elements in the sequence
331  // should be rendered and `Cue.alternate_text` must be used instead.
332  //
333  // New graphic elements might be added in the future. If such elements are
334  // unknown to the OEM rendering service, they will be delivered as text.
335  message CueElement {
336    // The textual representation of this element.
337    //
338    // If image is provided, then this is used as a fallback in the case of
339    // render failures, otherwise this is the string to be used when rendering
340    // this element.
341    string text = 1;
342
343    // An image representing this element. This representation should be used
344    // over the textual representation whenever possible.
345    //
346    // In case of failure to render, `text` should be shown instead. If
347    // rendering fails and text is empty, then no elements should be shown and
348    // instead the `alternate_text` should be shown.
349    ImageReference image = 2;
350  }
351
352  // The sequence of graphic elements.
353  //
354  // If no rich cue representation is available,
355  // the list may be empty and `alternate_text` should be used as a fallback.
356  // Spacing between the elements is provided, and rendering services should
357  // not attempt to add their own spacing between the CueElement objects.
358  repeated CueElement elements = 1;
359
360  // The plain-text string representing the content of this Cue.
361  string alternate_text = 2;
362}
363
364// An action that the driver should take in order to remain on the current
365// navigation route.
366//
367// For example: turning onto a street, taking a highway exit and merging onto
368// a different highway, continuing straight through a roundabout, etc.
369message Step {
370  // The distance from the current position to the point where
371  // this navigation step should be executed.
372  Distance distance = 1;
373
374  // The maneuver to be performed on this step,
375  // or not present if this step doesn't involve a maneuver.
376  Maneuver maneuver = 2;
377
378  // The configuration of road lanes at the point where the driver should
379  // execute this step, or an empty list if lane configuration metadata
380  // is not available. Lane configurations are listed from left to right.
381  repeated Lane lanes = 3;
382
383  // An image representing the lane configuration at this point in the
384  // navigation, or not present if the lanes configuration image was not
385  // provided. The image, if provided, is expected to contain:
386  //   - A representation of all lanes, one next to the other in a single row.
387  //   - For each lane, a set of arrows, representing each possible driving
388  //     direction (e.g. straight, left turn, etc.) within such lane.
389  //   - Each of such driving directions that would keep the driver within
390  //     the navigation route should be highlighted.
391  // Lane configuration images are expected to be displayed in a canvas
392  // with fixed height and variable width.
393  ImageReference lanes_image = 4;
394
395  // Auxiliary instructions on how to complete this navigation step,
396  // described as a Cue object containing a sequence of texts
397  // (e.g. "onto ", "Wallaby way") and images (e.g. road badge of a highway).
398  // Separators, such as spaces, should be provided in the sequence.
399  // If space is not enough to display the complete content of this Cue
400  // instance, the beginning of these instructions must be displayed,
401  // cutting as much from the end as needed to fit.
402  Cue cue = 5;
403}
404
405// An object representing a latitude/longitude pair. This is expressed as a pair
406// of doubles representing degrees latitude and degrees longitude. Unless
407// specified otherwise, this must conform to the WGS84 standard
408// (http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf) Values must be
409// within normalized ranges.
410//
411// Copied from:
412// https://github.com/googleapis/googleapis/blob/master/google/type/latlng.proto
413message LatLng {
414  // The latitude in degrees. It must be in the range [-90.0, +90.0].
415  double latitude = 1;
416  // The longitude in degrees. It must be in the range [-180.0, +180.0].
417  double longitude = 2;
418}
419
420// A Timestamp represents a point in time independent of any time zone
421// or calendar, represented as seconds and fractions of seconds at
422// nanosecond resolution in UTC Epoch time. It is encoded using the
423// Proleptic Gregorian Calendar which extends the Gregorian calendar
424// backwards to year one. It is encoded assuming all minutes are 60
425// seconds long, i.e. leap seconds are "smeared" so that no leap second
426// table is needed for interpretation. Range is from
427// 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z.
428// By restricting to that range, we ensure that we can convert to
429// and from  RFC 3339 date strings.
430// See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt).
431//
432// This is a subset of
433// https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/timestamp.proto
434message Timestamp {
435  // Reserved fields
436  reserved 2;
437
438  // Represents seconds of UTC time since Unix epoch
439  // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to
440  // 9999-12-31T23:59:59Z inclusive.
441  int64 seconds = 1;
442}
443
444// Final or intermediate stop in a navigation route.
445message Destination {
446  // Congestion level on the way to a destination,
447  // compared to ideal driving conditions.
448  enum Traffic {
449    // Traffic information is not available
450    UNKNOWN = 0;
451
452    // High amount of traffic
453    HIGH = 1;
454
455    // Intermediate amount of traffic
456    MEDIUM = 2;
457
458    // Traffic level close to free flow
459    LOW = 3;
460  }
461
462  // The name of the destination (formatted for the current user's locale),
463  // or empty if destination name is unknown.
464  string title = 1;
465
466  // The address of the destination (formatted for the current user's locale),
467  // or empty if there is no address associated with this destination
468  string address = 2;
469
470  // The travel distance along the route from the current position to this
471  // destination, or not set if distance was not provided or is unknown.
472  Distance distance = 3;
473
474  // The estimated time at arrival at this destination,
475  // or not set if it was not provided or is unknown.
476  Timestamp estimated_time_at_arrival = 4;
477
478  // The timezone at destination (for example, ‘Europe/Paris’)
479  string zone_id = 5;
480
481  // The geo-location of this destination,
482  // or not set if not provided or unknown.
483  LatLng location = 6;
484
485  // The congestion level on the route to this destination,
486  // compared to to ideal driving conditions.
487  Traffic traffic = 7;
488
489  // The estimated duration between now and arrival, formatted for desired
490  // rounding (formatted for the current user's locale). For example, a
491  // duration of seven minutes and 15 seconds could be set here as "7 min".
492  string formatted_duration_until_arrival = 8;
493}
494
495// The description for a road.
496message Road {
497  // Name of the road, for example "Main St" or "101-S".
498  string name = 1;
499}
500
501// Navigation state data to be displayed on the instrument cluster of a car.
502// This is composed of:
503//   - a list of destinations
504//   - the immediate step or steps in order to drive towards those destinations
505message NavigationStateProto {
506  // The navigation steps, in order of execution.
507  // It is up to the third-party navigation app to decide how many steps in
508  // advance will be provided (and need not be truncated by an upcoming
509  // destination).
510  repeated Step steps = 1;
511
512  // The destinations and intermediate stops in the navigation,
513  // sorted in the order in which the driver will arrive to them.
514  repeated Destination destinations = 2;
515
516  // The current road being driven, may not be set if the road
517  // being driven is unknown. This indicates where the driver is at the moment.
518  Road current_road = 3;
519
520  enum ServiceStatus {
521    // Service status is not known or an unknown value is specified.
522    SERVICE_STATUS_UNSPECIFIED = 0;
523
524    // Default service status,
525    // indicating that navigation state data is valid and up-to-date.
526    NORMAL = 1;
527
528    // New navigation information is being fetched, and an updated navigation
529    // state will be provided soon. OEM rendering services can use this signal
530    // to display a progress indicator to the user.
531    REROUTING = 2;
532  }
533
534  // Current status of the navigation.
535  ServiceStatus service_status = 4;
536}
537