1/*
2 * Copyright (C) 2016 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
17package android.hardware.automotive.vehicle@2.0;
18
19interface IVehicleCallback {
20
21    /**
22     * Event callback happens whenever a variable that the API user has
23     * subscribed to needs to be reported. This may be based purely on
24     * threshold and frequency (a regular subscription, see subscribe call's
25     * arguments) or when the IVehicle#set method was called and the actual
26     * change needs to be reported.
27     *
28     * These callbacks are chunked.
29     *
30     * @param values that has been updated.
31     */
32    oneway onPropertyEvent(vec<VehiclePropValue> propValues);
33
34    /**
35     * This method gets called if the client was subscribed to a property using
36     * SubscribeFlags::EVENTS_FROM_ANDROID flag and IVehicle#set(...) method was called.
37     *
38     * These events must be delivered to subscriber immediately without any
39     * batching.
40     *
41     * @param value Value that was set by a client.
42     */
43    oneway onPropertySet(VehiclePropValue propValue);
44
45    /**
46     * Set property value is usually asynchronous operation. Thus even if
47     * client received StatusCode::OK from the IVehicle::set(...) this
48     * doesn't guarantee that the value was successfully propagated to the
49     * vehicle network. If such rare event occurs this method must be called.
50     *
51     * @param errorCode - any value from StatusCode enum.
52     * @param property - a property where error has happened.
53     * @param areaId - bitmask that specifies in which areas the problem has
54     *                 occurred, must be 0 for global properties
55     */
56    oneway onPropertySetError(StatusCode errorCode,
57                              int32_t propId,
58                              int32_t areaId);
59};
60