1# Car rotary service
2
3## Building
4```
5make CarRotaryController -j64
6```
7
8## Enable/disable RotaryService
9To enable, run:
10```
11adb shell settings put secure enabled_accessibility_services com.android.car.rotary/com.android.car.rotary.RotaryService
12```
13To disable, run:
14```
15adb shell settings delete secure enabled_accessibility_services
16```
17
18## Inject events
19
20### Inject RotaryEvent
21To rotate the controller counter-clockwise, run:
22```
23adb shell cmd car_service inject-rotary
24```
25For clockwise, run:
26```
27adb shell cmd car_service inject-rotary -c true
28```
29To rotate the controller multiple times (100 ms ago and 50 ms ago), run:
30```
31adb shell cmd car_service inject-rotary -dt 100 50
32```
33
34### Inject KeyEvent
35To nudge the controller up, run:
36```
37adb shell cmd car_service inject-key 280
38```
39Use KeyCode ```280``` for nudge up, ```281``` for nudge down,```282``` for nudge left,```283``` for
40nudge right.
41
42To click the controller center button, run:
43```
44adb shell cmd car_service inject-key 23
45```
46
47To long click the controller center button, send down and up action seperately. For example:
48```
49adb shell cmd car_service inject-key 23 -a down && sleep 2 && adb shell cmd car_service inject-key 23 -a up
50```
51
52