IVehicleNetwork.h revision 1ab8e18e01d8063821bee0bf641a365224c7e1ee
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_H
18#define ANDROID_IVEHICLE_NETWORK_H
19
20#include <stdint.h>
21#include <sys/types.h>
22
23#include <hardware/vehicle.h>
24
25#include <utils/RefBase.h>
26#include <utils/Errors.h>
27#include <binder/IInterface.h>
28#include <binder/IMemory.h>
29#include <binder/Parcel.h>
30
31#include <VehicleNetworkDataTypes.h>
32#include <IVehicleNetworkHalMock.h>
33#include <IVehicleNetworkListener.h>
34
35namespace android {
36
37// ----------------------------------------------------------------------------
38
39class IVehicleNetwork : public IInterface {
40public:
41    static const char SERVICE_NAME[];
42    DECLARE_META_INTERFACE(VehicleNetwork);
43
44    /**
45     * Return configuration of single property (when argument property is not 0) or all properties
46     * (when property = 0).
47     */
48    virtual sp<VehiclePropertiesHolder> listProperties(int32_t property = 0) = 0;
49    virtual status_t setProperty(const vehicle_prop_value_t& value)= 0;
50    virtual status_t getProperty(vehicle_prop_value_t* value) = 0;
51    virtual status_t subscribe(const sp<IVehicleNetworkListener> &listener, int32_t property,
52            float sampleRate) = 0;
53    virtual void unsubscribe(const sp<IVehicleNetworkListener> &listener, int32_t property) = 0;
54    virtual status_t injectEvent(const vehicle_prop_value_t& value) = 0;
55    virtual status_t startMocking(const sp<IVehicleNetworkHalMock>& mock) = 0;
56    virtual void stopMocking(const sp<IVehicleNetworkHalMock>& mock) = 0;
57};
58
59// ----------------------------------------------------------------------------
60
61class BnVehicleNetwork : public BnInterface<IVehicleNetwork> {
62    virtual status_t  onTransact(uint32_t code,
63                                 const Parcel& data,
64                                 Parcel* reply,
65                                 uint32_t flags = 0);
66};
67
68// ----------------------------------------------------------------------------
69
70}; // namespace android
71
72#endif /* ANDROID_IVEHICLE_NETWORK_H */
73