blob: ccedeeb3a545d104ef04ad9b6f20aa71a1d14a13 [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
Pavel Maltsev2579fb72017-02-02 12:39:36 -080017#ifndef android_hardware_automotive_vehicle_V2_0_impl_DefaultVehicleHal_H_
18#define android_hardware_automotive_vehicle_V2_0_impl_DefaultVehicleHal_H_
Pavel Maltseve2603e32016-10-25 16:03:23 -070019
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 {
Pavel Maltsev2579fb72017-02-02 12:39:36 -080029namespace automotive {
Pavel Maltseve2603e32016-10-25 16:03:23 -070030namespace vehicle {
31namespace V2_0 {
32
33namespace impl {
34
35class DefaultVehicleHal : public VehicleHal {
36public:
37 std::vector<VehiclePropConfig> listProperties() override {
38 return std::vector<VehiclePropConfig>(std::begin(kVehicleProperties),
39 std::end(kVehicleProperties));
40 }
41
Pavel Maltsevdb179c52016-10-27 15:43:06 -070042 VehiclePropValuePtr get(const VehiclePropValue& requestedPropValue,
43 StatusCode* outStatus) override;
Pavel Maltseve2603e32016-10-25 16:03:23 -070044
Enrico Granataadcb7c72017-01-25 12:07:15 -080045 void onCreate() override;
46
Pavel Maltsevdb179c52016-10-27 15:43:06 -070047 StatusCode set(const VehiclePropValue& propValue) override;
Pavel Maltseve2603e32016-10-25 16:03:23 -070048
Pavel Maltsev8e624b32017-02-01 16:30:25 -080049 StatusCode subscribe(int32_t /*property*/,
50 int32_t /*areas*/,
51 float /*sampleRate*/) override {
Pavel Maltseve2603e32016-10-25 16:03:23 -070052 // TODO(pavelm): implement
Pavel Maltsevdb179c52016-10-27 15:43:06 -070053 return StatusCode::OK;
Pavel Maltseve2603e32016-10-25 16:03:23 -070054 }
55
Pavel Maltsev8e624b32017-02-01 16:30:25 -080056 StatusCode unsubscribe(int32_t /*property*/) override {
Pavel Maltseve2603e32016-10-25 16:03:23 -070057 // TODO(pavelm): implement
Pavel Maltsevdb179c52016-10-27 15:43:06 -070058 return StatusCode::OK;
Pavel Maltseve2603e32016-10-25 16:03:23 -070059 }
60
61private:
Pavel Maltsev30c84c32016-11-14 16:23:36 -080062 StatusCode getHvacTemperature(int32_t areaId, float* outValue);
63 StatusCode setHvacTemperature(int32_t areaId, float value);
64 StatusCode getHvacDefroster(int32_t areaId, bool* outValue);
65 StatusCode setHvacDefroster(int32_t areaId, bool value);
Enrico Granataadcb7c72017-01-25 12:07:15 -080066 StatusCode fillObd2LiveFrame(VehiclePropValuePtr* v);
67 StatusCode fillObd2FreezeFrame(VehiclePropValuePtr* v);
Pavel Maltseve2603e32016-10-25 16:03:23 -070068private:
Pavel Maltsev30c84c32016-11-14 16:23:36 -080069 int32_t mFanSpeed = 3;
70 int32_t mBrightness = 7;
71 float mRow1LeftHvacTemperatureSet = 16;
72 float mRow1RightHvacTemperatureSet = 22;
73 bool mFrontDefroster = false;
74 bool mRearDefroster = false;
75 bool mHvacPowerOn = true;
76 bool mHvacRecircOn = true;
77 bool mHvacAcOn = true;
78 bool mHvacAutoOn = true;
79 VehicleHvacFanDirection mFanDirection = VehicleHvacFanDirection::FACE;
Enrico Granataadcb7c72017-01-25 12:07:15 -080080 std::unique_ptr<Obd2SensorStore> mObd2SensorStore{nullptr};
Pavel Maltseve2603e32016-10-25 16:03:23 -070081};
82
83} // impl
84
85} // namespace V2_0
86} // namespace vehicle
Pavel Maltsev2579fb72017-02-02 12:39:36 -080087} // namespace automotive
Pavel Maltseve2603e32016-10-25 16:03:23 -070088} // namespace hardware
89} // namespace android
90
91
Pavel Maltsev2579fb72017-02-02 12:39:36 -080092#endif // android_hardware_automotive_vehicle_V2_0_impl_DefaultVehicleHal_H_