1<!-- 2 Copyright (C) 2021 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 17# CarTelemetryService 18 19Source code for AAOS OEM Telemetry solution. 20 21 22## Enabling CarTelemetryService 23 24CarTelemetryService can be enabled with 25 26``` 27adb shell cmd car_service enable-feature car_telemetry_service 28``` 29 30## Car Shell Command 31 32Run the commands from `$ANDROID_BUILD_TOP`. 33 341. Create a MetricsConfig text proto - `sample_wifi_netstats.textproto` 35 36``` 37name: "sample_wifi_netstats" 38version: 1 39subscribers { 40 handler: "onWifiStats" 41 publisher: { 42 connectivity: { 43 transport: TRANSPORT_WIFI 44 oem_type: OEM_NONE 45 } 46 } 47 priority: 0 48} 49script: 50 'function onWifiStats(data, state)\n' 51 ' on_script_finished(data)\n' 52 'end\n' 53``` 54 552. Generate MetricsConfig binary proto 56 57``` 58./out/host/linux-x86/bin/aprotoc \ 59 --encode=android.car.telemetry.MetricsConfig \ 60 packages/services/Car/car-lib/src/android/car/telemetry/telemetry.proto \ 61 < sample_wifi_netstats.textproto > sample_wifi_netstats.binproto 62``` 63 643. Add the config to CarTelemetryService 65 66``` 67adb shell cmd car_service telemetry add sample_wifi_netstats < sample_wifi_netstats.binproto 68``` 69 704. Get results 71 72``` 73adb shell cmd car_service telemetry get-result sample_wifi_netstats --result_count 10000 --timeout 20 --print-results 74``` 75where result_count is the number of reports we expect to receive in this call, 76timeout is how many seconds should we wait for the results to be returned, 77and --print-results is an optional flag whether we want every result to be printed 78on the screen. 79