1/* 2 * Copyright (C) 2022 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.hardware.automotive.remoteaccess; 20 21enum ErrorCode { 22 OK = 0; 23 UNSPECIFIED = 1; 24 INVALID_ARG = 2; 25} 26 27/** 28 * Service provided by a wakeup client running on TCU. 29 */ 30service WakeupClient { 31 /** 32 * Establish a long-live connection to receive remote tasks. 33 * 34 * <p>For the server, whenever a remote task arrives, if the connection is 35 * alive, it will use the return stream to return a task's information. 36 * 37 * <p>If the connection is not alive, the server must stores the remote task 38 * until a new connection is established (which means AP is ready to 39 * receive remote task again) and send the stored tasks. 40 * 41 * <p>If the server closes the connection, the client will try to 42 * reestablish the connection. 43 */ 44 rpc GetRemoteTasks(GetRemoteTasksRequest) returns (stream GetRemoteTasksResponse) {} 45 46 /** 47 * Notifies whether AP is required to be waken up when remote task arrives. 48 * 49 * <p>Wakeup client should store and use this state until a new call with a 50 * different state arrives. 51 * 52 * <p>If {@code isWakeupRequired} in the request is true, it must wake up AP 53 * when a remote task arrives. 54 * 55 * <p>If {@code isWakeupRequired} in the request is false, it must not try 56 * to wake up AP. 57 */ 58 rpc NotifyWakeupRequired(NotifyWakeupRequiredRequest) returns (NotifyWakeupRequiredResponse) {} 59 60 /** 61 * Schedules a task to be executed later even when the vehicle is off. 62 * 63 * <p>This sends a scheduled task message to a device external to Android so that the device 64 * can wake up Android and deliver the task through {@link IRemoteTaskCallback}. 65 * 66 * <p>Note that the scheduled task execution is on a best-effort basis. Multiple situations 67 * might cause the task not to execute successfully: 68 * 69 * <ul> 70 * <li>The vehicle is low on battery and the other device decides not to wake up Android. 71 * <li>User turns off vehicle while the task is executing. 72 * <li>The task logic itself fails. 73 * 74 * <p>Must return a response with error code: {@code INVALID_ARG} if a pending schedule with the 75 * same {@code scheduleId} for this client exists. 76 */ 77 rpc ScheduleTask(ScheduleTaskRequest) returns (ScheduleTaskResponse) {} 78 79 /** 80 * Unschedules a scheduled task. 81 * 82 * <p>Does nothing if a pending schedule with {@code clientId} and {@code scheduleId} does not 83 * exist. 84 */ 85 rpc UnscheduleTask(UnscheduleTaskRequest) returns (UnscheduleTaskResponse) {} 86 87 /** 88 * Unschedules all scheduled tasks for the client. 89 */ 90 rpc UnscheduleAllTasks(UnscheduleAllTasksRequest) returns (UnscheduleAllTasksResponse) {} 91 92 /** 93 * Returns whether the specified task is scheduled. 94 */ 95 rpc IsTaskScheduled(IsTaskScheduledRequest) returns (IsTaskScheduledResponse) {} 96 97 /** 98 * Gets all pending scheduled tasks for the client. 99 * 100 * <p>The finished scheduled tasks will not be included. 101 */ 102 rpc GetAllPendingScheduledTasks(GetAllPendingScheduledTasksRequest) 103 returns (GetAllPendingScheduledTasksResponse) {} 104} 105 106message GetRemoteTasksRequest {} 107 108message GetRemoteTasksResponse { 109 string clientId = 1; 110 bytes data = 2; 111} 112 113message NotifyWakeupRequiredRequest { 114 bool isWakeupRequired = 1; 115} 116 117message NotifyWakeupRequiredResponse {} 118 119message ScheduleTaskRequest { 120 GrpcScheduleInfo scheduleInfo = 1; 121} 122 123message ScheduleTaskResponse { 124 ErrorCode errorCode = 1; 125} 126 127enum ScheduleTaskType { 128 CUSTOM = 0; 129 ENTER_GARAGE_MODE = 1; 130} 131 132message GrpcScheduleInfo { 133 string clientId = 1; 134 string scheduleId = 2; 135 bytes data = 3; 136 int32 count = 4; 137 int64 startTimeInEpochSeconds = 5; 138 int64 periodicInSeconds = 6; 139 ScheduleTaskType taskType = 7; 140} 141 142message UnscheduleTaskRequest { 143 string clientId = 1; 144 string scheduleId = 2; 145} 146 147message UnscheduleTaskResponse {} 148 149message UnscheduleAllTasksRequest { 150 string clientId = 1; 151} 152 153message UnscheduleAllTasksResponse {} 154 155message IsTaskScheduledRequest { 156 string clientId = 1; 157 string scheduleId = 2; 158} 159 160message IsTaskScheduledResponse { 161 bool isTaskScheduled = 1; 162} 163 164message GetAllPendingScheduledTasksRequest { 165 string clientId = 1; 166} 167 168message GetAllPendingScheduledTasksResponse { 169 repeated GrpcScheduleInfo allScheduledTasks = 1; 170} 171 172/** 173 * Service provided by a power controller unit. 174 */ 175service PowerController { 176 rpc IsVehicleInUse(IsVehicleInUseRequest) returns (IsVehicleInUseResponse) {} 177 178 rpc GetApPowerBootupReason(GetApPowerBootupReasonRequest) 179 returns (GetApPowerBootupReasonResponse) {} 180} 181 182message IsVehicleInUseRequest {} 183 184message IsVehicleInUseResponse { 185 bool isVehicleInUse = 1; 186} 187 188message GetApPowerBootupReasonRequest {} 189 190message GetApPowerBootupReasonResponse { 191 int32 bootupReason = 1; 192} 193