blob: 567ddf1bb3b61fa8b0ad586ea86058c8edd7e29b [file] [log] [blame]
Pavel Maltseve2603e32016-10-25 16:03:23 -07001/*
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
17#ifndef android_hardware_vehicle_V2_0_impl_DefaultVehicleHal_H_
18#define android_hardware_vehicle_V2_0_impl_DefaultVehicleHal_H_
19
Enrico Granataadcb7c72017-01-25 12:07:15 -080020#include <memory>
21
Pavel Maltseve2603e32016-10-25 16:03:23 -070022#include <VehicleHal.h>
23#include <impl/DefaultConfig.h>
Enrico Granataadcb7c72017-01-25 12:07:15 -080024#include <vehicle_hal_manager/Obd2SensorStore.h>
Pavel Maltseve2603e32016-10-25 16:03:23 -070025#include <utils/SystemClock.h>
26
27namespace android {
28namespace hardware {
29namespace vehicle {
30namespace V2_0 {
31
32namespace impl {
33
34class DefaultVehicleHal : public VehicleHal {
35public:
36 std::vector<VehiclePropConfig> listProperties() override {
37 return std::vector<VehiclePropConfig>(std::begin(kVehicleProperties),
38 std::end(kVehicleProperties));
39 }
40
Pavel Maltsevdb179c52016-10-27 15:43:06 -070041 VehiclePropValuePtr get(const VehiclePropValue& requestedPropValue,
42 StatusCode* outStatus) override;
Pavel Maltseve2603e32016-10-25 16:03:23 -070043
Enrico Granataadcb7c72017-01-25 12:07:15 -080044 void onCreate() override;
45
Pavel Maltsevdb179c52016-10-27 15:43:06 -070046 StatusCode set(const VehiclePropValue& propValue) override;
Pavel Maltseve2603e32016-10-25 16:03:23 -070047
Pavel Maltsev8e624b32017-02-01 16:30:25 -080048 StatusCode subscribe(int32_t /*property*/,
49 int32_t /*areas*/,
50 float /*sampleRate*/) override {
Pavel Maltseve2603e32016-10-25 16:03:23 -070051 // TODO(pavelm): implement
Pavel Maltsevdb179c52016-10-27 15:43:06 -070052 return StatusCode::OK;
Pavel Maltseve2603e32016-10-25 16:03:23 -070053 }
54
Pavel Maltsev8e624b32017-02-01 16:30:25 -080055 StatusCode unsubscribe(int32_t /*property*/) override {
Pavel Maltseve2603e32016-10-25 16:03:23 -070056 // TODO(pavelm): implement
Pavel Maltsevdb179c52016-10-27 15:43:06 -070057 return StatusCode::OK;
Pavel Maltseve2603e32016-10-25 16:03:23 -070058 }
59
60private:
Pavel Maltsev30c84c32016-11-14 16:23:36 -080061 StatusCode getHvacTemperature(int32_t areaId, float* outValue);
62 StatusCode setHvacTemperature(int32_t areaId, float value);
63 StatusCode getHvacDefroster(int32_t areaId, bool* outValue);
64 StatusCode setHvacDefroster(int32_t areaId, bool value);
Enrico Granataadcb7c72017-01-25 12:07:15 -080065 StatusCode fillObd2LiveFrame(VehiclePropValuePtr* v);
66 StatusCode fillObd2FreezeFrame(VehiclePropValuePtr* v);
Pavel Maltseve2603e32016-10-25 16:03:23 -070067private:
Pavel Maltsev30c84c32016-11-14 16:23:36 -080068 int32_t mFanSpeed = 3;
69 int32_t mBrightness = 7;
70 float mRow1LeftHvacTemperatureSet = 16;
71 float mRow1RightHvacTemperatureSet = 22;
72 bool mFrontDefroster = false;
73 bool mRearDefroster = false;
74 bool mHvacPowerOn = true;
75 bool mHvacRecircOn = true;
76 bool mHvacAcOn = true;
77 bool mHvacAutoOn = true;
78 VehicleHvacFanDirection mFanDirection = VehicleHvacFanDirection::FACE;
Enrico Granataadcb7c72017-01-25 12:07:15 -080079 std::unique_ptr<Obd2SensorStore> mObd2SensorStore{nullptr};
Pavel Maltseve2603e32016-10-25 16:03:23 -070080};
81
82} // impl
83
84} // namespace V2_0
85} // namespace vehicle
86} // namespace hardware
87} // namespace android
88
89
90#endif // android_hardware_vehicle_V2_0_impl_DefaultVehicleHal_H_