• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2015 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 #ifndef ANDROID_IVEHICLE_NETWORK_LISTENER_H
18 #define ANDROID_IVEHICLE_NETWORK_LISTENER_H
19 
20 #include <stdint.h>
21 #include <sys/types.h>
22 
23 #include <utils/RefBase.h>
24 #include <utils/Errors.h>
25 #include <binder/IInterface.h>
26 #include <binder/IMemory.h>
27 #include <binder/Parcel.h>
28 
29 #include <VehicleNetworkDataTypes.h>
30 
31 namespace android {
32 
33 // ----------------------------------------------------------------------------
34 
35 class IVehicleNetworkListener : public IInterface
36 {
37 public:
38     DECLARE_META_INTERFACE(VehicleNetworkListener);
39 
40     /**
41      * Pass events contained in VehiclePropValueListHolder. Client (Bn implementor) should
42      * hold sp to keep the data received outside this call.
43      */
44     virtual void onEvents(sp<VehiclePropValueListHolder>& events) = 0;
45     /**
46      * Notify error in HAL. For this to be called, either the target property is subscribed
47      * or client should explicitly call registerErrorListener.
48      * @param errorCode
49      * @param property Specific property where the error happened. 0 is for global error.
50      * @param operation
51      */
52     virtual void onHalError(int32_t errorCode, int32_t property, int32_t operation) = 0;
53     /**
54      * HAL is restarting. All subscription becomes invalid after this.
55      * @param inMocking Whether it is in mocking mode or not.
56      */
57     virtual void onHalRestart(bool inMocking) = 0;
58 };
59 
60 // ----------------------------------------------------------------------------
61 
62 class BnVehicleNetworkListener : public BnInterface<IVehicleNetworkListener>
63 {
64     virtual status_t  onTransact(uint32_t code,
65                                  const Parcel& data,
66                                  Parcel* reply,
67                                  uint32_t flags = 0);
68 };
69 
70 // ----------------------------------------------------------------------------
71 
72 }; // namespace android
73 
74 #endif /* ANDROID_IVEHICLE_NETWORK_LISTENER_H */
75