android-auto 0.3.8

A crate for implementing the android auto protocol.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
syntax = "proto2";

package androidauto.wifi;

message NonspecificMessage 
{
    enum Enum 
    {
        VERSION_REQUEST = 0x0001;
    }
}

enum CommonMessage 
{
    CHANNEL_OPEN_REQUEST = 0x0007;
    CHANNEL_OPEN_RESPONSE = 0x0008;
}

enum ControlMessage
{
    MESSAGE_NONE = 0x0000;
    VERSION_REQUEST = 0x0001;
    VERSION_RESPONSE = 0x0002;
    SSL_HANDSHAKE = 0x0003;
    AUTH_COMPLETE = 0x0004;
    SERVICE_DISCOVERY_REQUEST = 0x0005;
    SERVICE_DISCOVERY_RESPONSE = 0x0006;
    PING_REQUEST = 0x000b;
    PING_RESPONSE = 0x000c;
    NAVIGATION_FOCUS_REQUEST = 0x000d;
    NAVIGATION_FOCUS_RESPONSE = 0x000e;
    SHUTDOWN_REQUEST = 0x000f;
    SHUTDOWN_RESPONSE = 0x0010;
    VOICE_SESSION_REQUEST = 0x0011;
    AUDIO_FOCUS_REQUEST = 0x0012;
    AUDIO_FOCUS_RESPONSE = 0x0013;
}

message AVChannelMessage
{
    enum Enum
    {
        AV_MEDIA_WITH_TIMESTAMP_INDICATION = 0x0000;
        AV_MEDIA_INDICATION = 0x0001;
        SETUP_REQUEST = 0x8000;
        START_INDICATION = 0x8001;
        STOP_INDICATION = 0x8002;
        SETUP_RESPONSE = 0x8003;
        AV_MEDIA_ACK_INDICATION = 0x8004;
        AV_INPUT_OPEN_REQUEST = 0x8005;
        AV_INPUT_OPEN_RESPONSE = 0x8006;
        VIDEO_FOCUS_REQUEST = 0x8007;
        VIDEO_FOCUS_INDICATION = 0x8008;
    }
}

message InputChannelMessage
{
    enum Enum
    {
        NONE = 0x0000;
        INPUT_EVENT_INDICATION = 0x8001;
        BINDING_REQUEST = 0x8002;
        BINDING_RESPONSE = 0x8003;
    }
}

enum MessageType {
    SPECIFIC = 0;
    CONTROL = 4;
}

enum AuthCompleteIndicationStatus
{
    OK = 0;
    FAIL = 1;
}

message AuthCompleteIndication
{
    required AuthCompleteIndicationStatus status = 1;
}

message ServiceDiscoveryRequest
{
    required string device_name = 4;
    required string device_brand = 5;
}

message SensorType
{
    enum Enum
    {
        NONE = 0;
        LOCATION = 1;
        COMPASS = 2;
        CAR_SPEED = 3;
        RPM = 4;
        ODOMETER = 5;
        FUEL_LEVEL = 6;
        PARKING_BRAKE = 7;
        GEAR = 8;
        DIAGNOSTICS = 9;
        NIGHT_DATA = 10;
        ENVIRONMENT = 11;
        HVAC = 12;
        DRIVING_STATUS = 13;
        DEAD_RECONING = 14;
        PASSENGER = 15;
        DOOR = 16;
        LIGHT = 17;
        TIRE = 18;
        ACCEL = 19;
        GYRO = 20;
        GPS = 21;
    }
}

message Sensor
{
    required SensorType.Enum type = 1;
}

message SensorChannel
{
    repeated Sensor sensors = 1;
}

message SensorChannelMessage
{
    enum Enum
    {
        NONE = 0x0000;
        SENSOR_START_REQUEST = 0x8001;
        SENSOR_START_RESPONSE = 0x8002;
        SENSOR_EVENT_INDICATION = 0x8003;
    }
}

message SensorStartRequestMessage
{
    required SensorType.Enum sensor_type = 1;
    required int64 refresh_interval = 2;
}

message SensorStartResponseMessage
{
    required Status.Enum status = 1;
}

message GPSLocation
{
    required uint64 timestamp = 1;
    required int32 latitude = 2;
    required int32 longitude = 3;
    required uint32 accuracy = 4;
    optional int32 altitude = 5;
    optional int32 speed = 6;
    optional int32 bearing = 7;
}

message Compass
{
    required int32 bearing =1;
    required int32 pitch = 2;
    required int32 roll = 3;
}

message Speed
{
    required int32 speed = 1;
    optional bool cruise_engaged = 2;
    optional bool cruise_set_speed = 3;
}

message RPM
{
    required int32 rpm = 1;
}

message Odometer
{
    required int32 total_mileage = 1;
    required int32 trip_mileage = 2;
}

message FuelLevel
{
    required int32 fuel_level = 1;
    required int32 range = 2;
    required bool low_fuel = 3;
}

message ParkingBrake
{
    required bool parking_brake = 1;
}

message NightMode
{
    required bool is_night = 1;
}

message Environment
{
    required int32 temperature =1;
    required int32 pressure = 2;
    required int32 rain = 3;
}

message HVAC
{
    required int32 target_temperature = 1;
    required int32 current_temperature = 2;
}

enum DrivingStatusEnum
{
    UNRESTRICTED = 0;
    NO_VIDEO = 1;
    NO_KEYBOARD_INPUT = 2;
    NO_VOICE_INPUT = 4;
    NO_CONFIG = 8;
    LIMIT_MESSAGE_LEN = 16;
    FULLY_RESTRICTED = 31;
}

message DrivingStatus
{
    required int32 status = 1;
}

message SteeringWheel
{
    required int32 steering_angle = 1;
    required int32 wheel_speed = 2;
}

message Passenger
{
    required bool passenger_present = 1;
}

message Door
{
    required bool hood_open = 1;
    required bool boot_open = 2;
    repeated bool door_open = 3;
}

message Light
{
    required HeadlightStatus.Enum headlight = 1;
    required IndicatorStatus.Enum indicator = 2;
    required bool hazard_light_on = 3;
}

message Accel
{
    required int32 acceleration_x = 1;
    required int32 acceleration_y = 2;
    required int32 acceleration_z = 3;
}

message Gyro
{
    required int32 rotation_speed_x = 1;
    required int32 rotation_speed_y = 2;
    required int32 rotation_speed_z = 3;
}

message HeadlightStatus
{
    enum Enum
    {
        STATE_0 = 0;
        STATE_1 = 1;
        STATE_2 = 2;
        STATE_3 = 3;
    }
}

message IndicatorStatus
{
    enum Enum
    {
        STATE_0 = 0;
        STATE_1 = 1;
        STATE_2 = 2;
        STATE_3 = 3;
    }
}

message Diagnostics
{
    required bytes diagnostics = 1;
}

message Gear
{
    enum Enum
    {
        NEUTRAL = 0;
        FIRST = 1;
        SECOND = 2;
        THIRD = 3;
        FOURTH = 4;
        FIFTH = 5;
        SIXTH = 6;
        SEVENTH = 7;
        EIGHTH = 8;
        NINTH = 9;
        TENTH = 10;
        DRIVE = 100;
        PARK = 101;
        REVERSE = 102;
    }
    required Gear.Enum gear = 1;
}

message SensorEventIndication
{
    repeated GPSLocation gps_location = 1;
    repeated Compass compass = 2;
    repeated Speed speed = 3;
    repeated RPM rpm = 4;
    repeated Odometer odometer = 5;
    repeated FuelLevel fuel_level = 6;
    repeated ParkingBrake parking_brake = 7;
    repeated Gear gear = 8;
    repeated Diagnostics diagnostics = 9;
    repeated NightMode night_mode = 10;
    repeated Environment environment = 11;
    repeated HVAC hvac = 12;
    repeated DrivingStatus driving_status = 13;
    repeated SteeringWheel steering_wheel = 14;
    repeated Passenger passenger = 15;
    repeated Door door = 16;
    repeated Light light = 17;
    repeated Accel accel = 19;
    repeated Gyro gyro = 20;
}

message AVStreamType
{
    enum Enum
    {
        NONE = 0;
        AUDIO = 1;
        VIDEO = 3;
    }
}

message AudioType
{
    enum Enum
    {
        NONE = 0;
        SPEECH = 1;
        SYSTEM = 2;
        MEDIA = 3;
        ALARM = 4;
    }
}

message AudioConfig
{
    required uint32 sample_rate = 1;
    required uint32 bit_depth = 2;
    required uint32 channel_count = 3;
}

message VideoResolution
{
    enum Enum
    {
        NONE = 0;
        _480p = 1;
        _720p = 2;
       _1080p = 3;
       _1440p = 4;
       _720p_p = 5;
       _1080pp = 6;
       _108s0p_p = 7;
    }
}

message VideoFPS
{
    enum Enum
    {
        NONE = 0;
        _30 = 1;
        _60 = 2;
    }
}

message VideoConfig
{
    required VideoResolution.Enum video_resolution = 1;
    required VideoFPS.Enum video_fps = 2;
    required uint32 margin_width = 3;
    required uint32 margin_height = 4;
    required uint32 dpi = 5;
    optional uint32 additional_depth = 6;
}

message AVChannel
{
    required AVStreamType.Enum stream_type = 1;
    optional AudioType.Enum audio_type = 2;
    repeated AudioConfig audio_configs = 3;
    repeated VideoConfig video_configs = 4;
    optional bool available_while_in_call = 5;
}

message TouchConfig
{
    required uint32 width = 1;
    required uint32 height = 2;
}

message InputChannel
{
    repeated uint32 supported_keycodes = 1;
    optional TouchConfig touch_screen_config = 2;
    optional TouchConfig touch_pad_config = 3;
}

message AVInputChannel
{
    required AVStreamType.Enum stream_type = 1;
    required AudioConfig audio_config = 2;
    optional bool available_while_in_call = 3;
}

message BluetoothPairingMethod
{
    enum Enum
    {
        NONE = 0;
        UNK_1 = 1;
        A2DP = 2;
        UNK_3 = 3;
        HFP = 4;
    }
}

message BluetoothChannel
{
    required string adapter_address = 1;
    repeated BluetoothPairingMethod.Enum supported_pairing_methods = 2;
}

message NavigationTurnType
{
    enum Enum
    {
        UNKNOWN = 0;
        IMAGE = 1;
        ENUM = 2;
    }
}

message NavigationImageOptions
{
    required int32 width = 1;
    required int32 height = 2;
    required int32 colour_depth_bits = 3;
    required int32 dunno = 4;
}

message NavigationChannel
{
    required uint32 minimum_interval_ms = 1;
    required NavigationTurnType.Enum type = 2;
    required NavigationImageOptions image_options = 3;
}

message MediaInfoChannel
{
   
}

message VendorExtensionChannel
{
    required string name = 1;
    repeated string package_white_list = 2;
    optional bytes data = 3;
}

message WifiChannel
{
    required string ssid = 1;
}

message ChannelDescriptor
{
    required uint32 channel_id = 1;
    optional SensorChannel sensor_channel = 2;
    optional AVChannel av_channel = 3;
    optional InputChannel input_channel = 4;
    optional AVInputChannel av_input_channel = 5;
    optional BluetoothChannel bluetooth_channel = 6;
    optional NavigationChannel navigation_channel = 8;
    optional MediaInfoChannel media_infoChannel = 9;
    optional VendorExtensionChannel vendor_extension_channel = 12;
    optional WifiChannel wifi_channel=16;
}

message ServiceDiscoveryResponse
{
    repeated ChannelDescriptor channels = 1;
    required string head_unit_name = 2;
    required string car_model = 3;
    required string car_year = 4;
    required string car_serial = 5;
    required bool left_hand_drive_vehicle = 6;
    required string headunit_manufacturer = 7;
    required string headunit_model = 8;
    required string sw_build = 9;
    required string sw_version = 10;
    required bool can_play_native_media_during_vr = 11;
    optional bool hide_clock = 12;
}

message AudioFocusType
{
    enum Enum
    {
        NONE = 0;
        GAIN = 1;
        GAIN_TRANSIENT = 2;
        GAIN_NAVI = 3;
        RELEASE = 4;
    }
}

message AudioFocusRequest
{
    required AudioFocusType.Enum audio_focus_type = 1;
}

message AudioFocusState
{
    enum Enum
    {
        NONE = 0;
        GAIN = 1;
        GAIN_TRANSIENT = 2;
        LOSS = 3;
        LOSS_TRANSIENT_CAN_DUCK = 4;
        LOSS_TRANSIENT = 5;
        GAIN_MEDIA_ONLY = 6;
        GAIN_TRANSIENT_GUIDANCE_ONLY = 7;
    }
}

message AudioFocusResponse
{
    required AudioFocusState.Enum audio_focus_state = 1;
}

message ChannelOpenRequest
{
    required int32 priority = 1;
    required int32 channel_id = 2;
}

message Status
{
    enum Enum
    {
        OK = 0;
        FAIL = 1;
    }
}

message ChannelOpenResponse
{
    required Status.Enum status = 1;
}

message PingRequest
{
    required int64 timestamp = 1;
}

message PingResponse
{
    required int64 timestamp = 1;
}

message AVChannelSetupRequest
{
    required uint32 config_index = 1;
}

message AVChannelSetupStatus
{
    enum Enum
    {
        NONE = 0;
        FAIL = 1;
        OK = 2;
    }
}

message AVChannelSetupResponse
{
    required AVChannelSetupStatus.Enum media_status = 1;
    required uint32 max_unacked = 2;
    repeated uint32 configs = 3;
}

message BindingRequest
{
    repeated int32 scan_codes = 1;
}

message BindingResponse
{
    required Status.Enum status = 1;
}

message VideoFocusMode
{
    enum Enum
    {
        NONE = 0;
        FOCUSED = 1;
        UNFOCUSED = 2;
    }
}

message VideoFocusReason
{
    enum Enum
    {
        NONE = 0;
        UNK_1 = 1;
        UNK_2 = 2;
    }
}

message VideoFocusRequest
{
    optional int32 disp_index = 1;
    required VideoFocusMode.Enum focus_mode = 2;
    required VideoFocusReason.Enum focus_reason = 3;
}

message VideoFocusIndication
{
    required VideoFocusMode.Enum focus_mode = 1;
    required bool unrequested = 2;
}

message AVChannelStartIndication
{
    required int32 session = 1;
    required uint32 config = 2;
}

message AVChannelStopIndication
{
}

message MediaInfoChannelMessage
{
   enum Enum
    {
        NONE = 0x0000;
        PLAYBACK = 0x8001;
        METADATA = 0x8003;
    }
}

message MediaInfoChannelPlaybackData
{
    enum PlaybackState
    {
        NONE = 0x0000;
        TRACK_CHANGE = 1;
        PLAY = 2;
        PAUSE = 3;
    }
    required PlaybackState playback_state = 1;
    required string media_source = 2;
    required int32 track_progress = 3;
    required int32 unknown1 = 4;
    required int32 unknown2 = 5;
    required int32 unknown3 = 6;
}

message MediaInfoChannelMetadataData
{
   required string track_name = 1;
   optional string artist_name = 2;
   optional string album_name = 3;
   optional bytes album_art = 4;
   required int32 track_length = 6;
   required int32 unknown1 = 7;
}

message BluetoothChannelMessage
{
    enum Enum
    {
        NONE = 0x0000;
        PAIRING_REQUEST = 0x8001;
        PAIRING_RESPONSE = 0x8002;
        AUTH_DATA = 0x8003;
    }
}

message BluetoothPairingRequest
{
    required string phone_address = 1;
    required BluetoothPairingMethod.Enum pairing_method = 2;
}

message BluetoothPairingStatus
{
    enum Enum
    {
        NONE = 0;
        OK = 1;
        FAIL = 2;
    }
}

message BluetoothPairingResponse
{
    required bool already_paired = 1;
    required BluetoothPairingStatus.Enum status = 2;
}

message AVMediaAckIndication
{
    required int32 session = 1;
    required uint32 value = 2;
}

message TouchAction
{
    enum Enum
    {
        PRESS = 0;
        RELEASE = 1;
        DRAG = 2;
        POINTER_DOWN = 5;
        POINTER_UP = 6;
    }
}

message AbsoluteInputEvent
{
    required uint32 scan_code = 1;
    required int32 value = 2;
}

message AbsoluteInputEvents
{
    repeated AbsoluteInputEvent absolute_input_events = 1;
}

message RelativeInputEvent
{
    required uint32 scan_code = 1;
    required int32 delta = 2;
}

message RelativeInputEvents
{
    repeated RelativeInputEvent relative_input_events = 1;
}

message ButtonEvent
{
    required uint32 scan_code = 1;
    required bool is_pressed = 2;
    optional uint32 meta = 3;
    optional bool long_press = 4;
}

message ButtonEvents
{
    repeated ButtonEvent button_events = 1;
}

message TouchLocation
{
    required uint32 x = 1;
    required uint32 y = 2;
    required uint32 pointer_id = 3;
}

message TouchEvent
{
    repeated TouchLocation touch_location = 1;
    optional uint32 action_index = 2;
    required TouchAction.Enum touch_action = 3;
}

message InputEventIndication
{
    required uint64 timestamp = 1;
    optional int32 disp_channel = 2;
    optional TouchEvent touch_event = 3;
    optional ButtonEvents button_event = 4;
    optional AbsoluteInputEvents absolute_input_event = 5;
    optional RelativeInputEvents relative_input_event = 6;
}

message ShutdownReason
{
    enum Enum
    {
        NONE = 0;
        QUIT = 1;
    }
}

message ShutdownRequest
{
    required ShutdownReason.Enum reason = 1;
}

message ShutdownResponse
{
}

message NavigationFocusRequest
{
    required uint32 type = 1;
}

message NavigationFocusResponse
{
    required uint32 type = 1;
}

message NavigationChannelMessage
{
   enum Enum
    {
        NONE = 0x0000;
        STATUS = 0x8003;
        TURN_EVENT = 0x8004;
        DISTANCE_EVENT = 0x8005;
    }
}

message NavigationStatus
{
    required Enum status = 1;
    enum Enum
    {
        UNAVAILABLE = 0;
        ACTIVE = 1;
        INACTIVE = 2;
        REROUTING = 3;
    }
}

message ManeuverDirection
{
    enum Enum
    {
        UNKNOWN = 0;
        LEFT = 1;
        RIGHT = 2;
        UNSPECIFIED = 3;
    }
}

message ManeuverType
{
    enum Enum
    {
        UNKNOWN = 0;
        DEPART = 1;
        NAME_CHANGE = 2;
        SLIGHT_TURN = 3;
        TURN = 4;
        SHARP_TURN = 5;
        U_TURN = 6;
        ON_RAMP = 7;
        OFF_RAMP = 8;
        FORK = 9;
        MERGE = 10;
        ROUNDABOUT_ENTER = 11;
        ROUNDABOUT_EXIT = 12;
        ROUNDABOUT_ENTER_AND_EXIT = 13;
        STRAIGHT = 14;
        FERRY_BOAT = 16;
        FERRY_TRAIN = 17;
        DESTINATION = 19;
    }
}

message DistanceUnit
{
    enum Enum
    {
        UNKNOWN = 0;
        METERS = 1;
        KILOMETERS = 2;
        KILOMETERS_PARTIAL = 3;
        MILES = 4;
        MILES_PARTIAL = 5;
        FEET = 6;
        YARDS = 7;
    }
}

message NavigationDistanceEvent
{
    required uint32 meters = 1;
    required uint32 timeToStepSeconds = 2;
    required uint32 distanceToStepMillis = 3;
    required DistanceUnit.Enum distanceUnit = 4;
}

message NavigationTurnEvent
{
    required string street_name = 1;
    required ManeuverDirection.Enum maneuverDirection = 2;
    required ManeuverType.Enum maneuverType = 3;
    required bytes turnImage = 4;
    required uint32 roundaboutExitNumber = 5;
    required uint32 roundaboutExitAngle = 6;
}

message VoiceSessionRequest
{
    required uint32 type = 1; // 1 = start, 2 = stop
}

message AVInputOpenRequest
{
    required bool open = 1;
    optional bool anc = 2;
    optional bool ec = 3;
    optional int32 max_unacked = 4;
}

message AVInputOpenResponse
{
    required int32 session = 1;
    required uint32 value = 2;
}