Pavel Maltsev | e2603e3 | 2016-10-25 16:03:23 -0700 | [diff] [blame] | 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 | |
| 17 | #ifndef android_hardware_vehicle_V2_0_impl_DefaultVehicleHal_H_ |
| 18 | #define android_hardware_vehicle_V2_0_impl_DefaultVehicleHal_H_ |
| 19 | |
| 20 | #include <VehicleHal.h> |
| 21 | #include <impl/DefaultConfig.h> |
| 22 | #include <utils/SystemClock.h> |
| 23 | |
| 24 | namespace android { |
| 25 | namespace hardware { |
| 26 | namespace vehicle { |
| 27 | namespace V2_0 { |
| 28 | |
| 29 | namespace impl { |
| 30 | |
| 31 | class DefaultVehicleHal : public VehicleHal { |
| 32 | public: |
| 33 | std::vector<VehiclePropConfig> listProperties() override { |
| 34 | return std::vector<VehiclePropConfig>(std::begin(kVehicleProperties), |
| 35 | std::end(kVehicleProperties)); |
| 36 | } |
| 37 | |
Pavel Maltsev | db179c5 | 2016-10-27 15:43:06 -0700 | [diff] [blame] | 38 | VehiclePropValuePtr get(const VehiclePropValue& requestedPropValue, |
| 39 | StatusCode* outStatus) override; |
Pavel Maltsev | e2603e3 | 2016-10-25 16:03:23 -0700 | [diff] [blame] | 40 | |
Pavel Maltsev | db179c5 | 2016-10-27 15:43:06 -0700 | [diff] [blame] | 41 | StatusCode set(const VehiclePropValue& propValue) override; |
Pavel Maltsev | e2603e3 | 2016-10-25 16:03:23 -0700 | [diff] [blame] | 42 | |
Pavel Maltsev | db179c5 | 2016-10-27 15:43:06 -0700 | [diff] [blame] | 43 | StatusCode subscribe(VehicleProperty property, |
Pavel Maltsev | e2603e3 | 2016-10-25 16:03:23 -0700 | [diff] [blame] | 44 | int32_t areas, |
| 45 | float sampleRate) { |
| 46 | // TODO(pavelm): implement |
Pavel Maltsev | db179c5 | 2016-10-27 15:43:06 -0700 | [diff] [blame] | 47 | return StatusCode::OK; |
Pavel Maltsev | e2603e3 | 2016-10-25 16:03:23 -0700 | [diff] [blame] | 48 | } |
| 49 | |
Pavel Maltsev | db179c5 | 2016-10-27 15:43:06 -0700 | [diff] [blame] | 50 | StatusCode unsubscribe(VehicleProperty property) { |
Pavel Maltsev | e2603e3 | 2016-10-25 16:03:23 -0700 | [diff] [blame] | 51 | // TODO(pavelm): implement |
Pavel Maltsev | db179c5 | 2016-10-27 15:43:06 -0700 | [diff] [blame] | 52 | return StatusCode::OK; |
Pavel Maltsev | e2603e3 | 2016-10-25 16:03:23 -0700 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | private: |
Pavel Maltsev | 30c84c3 | 2016-11-14 16:23:36 -0800 | [diff] [blame] | 56 | StatusCode getHvacTemperature(int32_t areaId, float* outValue); |
| 57 | StatusCode setHvacTemperature(int32_t areaId, float value); |
| 58 | StatusCode getHvacDefroster(int32_t areaId, bool* outValue); |
| 59 | StatusCode setHvacDefroster(int32_t areaId, bool value); |
Pavel Maltsev | e2603e3 | 2016-10-25 16:03:23 -0700 | [diff] [blame] | 60 | private: |
Pavel Maltsev | 30c84c3 | 2016-11-14 16:23:36 -0800 | [diff] [blame] | 61 | int32_t mFanSpeed = 3; |
| 62 | int32_t mBrightness = 7; |
| 63 | float mRow1LeftHvacTemperatureSet = 16; |
| 64 | float mRow1RightHvacTemperatureSet = 22; |
| 65 | bool mFrontDefroster = false; |
| 66 | bool mRearDefroster = false; |
| 67 | bool mHvacPowerOn = true; |
| 68 | bool mHvacRecircOn = true; |
| 69 | bool mHvacAcOn = true; |
| 70 | bool mHvacAutoOn = true; |
| 71 | VehicleHvacFanDirection mFanDirection = VehicleHvacFanDirection::FACE; |
Pavel Maltsev | e2603e3 | 2016-10-25 16:03:23 -0700 | [diff] [blame] | 72 | }; |
| 73 | |
| 74 | } // impl |
| 75 | |
| 76 | } // namespace V2_0 |
| 77 | } // namespace vehicle |
| 78 | } // namespace hardware |
| 79 | } // namespace android |
| 80 | |
| 81 | |
| 82 | #endif // android_hardware_vehicle_V2_0_impl_DefaultVehicleHal_H_ |