blob: 77b53642d7b88d499886ab8087fa3b716fe538a2 [file] [log] [blame]
Steve Paik66481982015-10-27 15:22:38 -07001/*
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 */
16package com.android.car.hal;
17
Keun-young Parkaf2cc992016-10-07 11:46:45 -070018import android.car.hardware.hvac.CarHvacManager;
Pavel Maltsev0d07c762016-11-03 16:40:15 -070019import android.hardware.vehicle.V2_0.VehicleProperty;
Steve Paik66481982015-10-27 15:22:38 -070020
Steve Paik461ecc62016-06-08 15:28:32 -070021public class HvacHalService extends PropertyHalServiceBase {
Vitalii Tomkiv1b1247b2016-09-30 11:27:19 -070022 private static final boolean DBG = false;
Steve Paik461ecc62016-06-08 15:28:32 -070023 private static final String TAG = "HvacHalService";
Steve Paik66481982015-10-27 15:22:38 -070024
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070025 private final ManagerToHalPropIdMap mMgrHalPropIdMap = ManagerToHalPropIdMap.create(new int[] {
Pavel Maltsev0d07c762016-11-03 16:40:15 -070026 CarHvacManager.ID_MIRROR_DEFROSTER_ON, VehicleProperty.HVAC_SIDE_MIRROR_HEAT,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070027
Pavel Maltsev0d07c762016-11-03 16:40:15 -070028 CarHvacManager.ID_STEERING_WHEEL_TEMP, VehicleProperty.HVAC_STEERING_WHEEL_TEMP,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070029
Pavel Maltsev0d07c762016-11-03 16:40:15 -070030 CarHvacManager.ID_OUTSIDE_AIR_TEMP, VehicleProperty.ENV_OUTSIDE_TEMPERATURE,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070031
Pavel Maltsev0d07c762016-11-03 16:40:15 -070032 CarHvacManager.ID_TEMPERATURE_UNITS, VehicleProperty.HVAC_TEMPERATURE_UNITS,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070033
Pavel Maltsev0d07c762016-11-03 16:40:15 -070034 CarHvacManager.ID_ZONED_TEMP_SETPOINT, VehicleProperty.HVAC_TEMPERATURE_SET,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070035
Pavel Maltsev0d07c762016-11-03 16:40:15 -070036 CarHvacManager.ID_ZONED_TEMP_ACTUAL, VehicleProperty.HVAC_TEMPERATURE_CURRENT,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070037
Pavel Maltsev0d07c762016-11-03 16:40:15 -070038 CarHvacManager.ID_ZONED_FAN_SPEED_SETPOINT, VehicleProperty.HVAC_FAN_SPEED,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070039
Pavel Maltsev0d07c762016-11-03 16:40:15 -070040 CarHvacManager.ID_ZONED_FAN_SPEED_RPM, VehicleProperty.HVAC_ACTUAL_FAN_SPEED_RPM,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070041
Keun-young Parkaf2cc992016-10-07 11:46:45 -070042 CarHvacManager.ID_ZONED_FAN_POSITION_AVAILABLE,
Pavel Maltsev0d07c762016-11-03 16:40:15 -070043 VehicleProperty.HVAC_FAN_DIRECTION_AVAILABLE,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070044
Pavel Maltsev0d07c762016-11-03 16:40:15 -070045 CarHvacManager.ID_ZONED_FAN_POSITION, VehicleProperty.HVAC_FAN_DIRECTION,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070046
Pavel Maltsev0d07c762016-11-03 16:40:15 -070047 CarHvacManager.ID_ZONED_SEAT_TEMP, VehicleProperty.HVAC_SEAT_TEMPERATURE,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070048
Pavel Maltsev0d07c762016-11-03 16:40:15 -070049 CarHvacManager.ID_ZONED_AC_ON, VehicleProperty.HVAC_AC_ON,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070050
Pavel Maltsev0d07c762016-11-03 16:40:15 -070051 CarHvacManager.ID_ZONED_AUTOMATIC_MODE_ON, VehicleProperty.HVAC_AUTO_ON,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070052
Pavel Maltsev0d07c762016-11-03 16:40:15 -070053 CarHvacManager.ID_ZONED_AIR_RECIRCULATION_ON,VehicleProperty.HVAC_RECIRC_ON,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070054
Pavel Maltsev0d07c762016-11-03 16:40:15 -070055 CarHvacManager.ID_ZONED_MAX_AC_ON, VehicleProperty.HVAC_MAX_AC_ON,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070056
Pavel Maltsev0d07c762016-11-03 16:40:15 -070057 CarHvacManager.ID_ZONED_DUAL_ZONE_ON, VehicleProperty.HVAC_DUAL_ON,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070058
Pavel Maltsev0d07c762016-11-03 16:40:15 -070059 CarHvacManager.ID_ZONED_MAX_DEFROST_ON, VehicleProperty.HVAC_MAX_DEFROST_ON,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070060
Pavel Maltsev0d07c762016-11-03 16:40:15 -070061 CarHvacManager.ID_ZONED_HVAC_POWER_ON, VehicleProperty.HVAC_POWER_ON,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070062
Pavel Maltsev0d07c762016-11-03 16:40:15 -070063 CarHvacManager.ID_WINDOW_DEFROSTER_ON, VehicleProperty.HVAC_DEFROSTER
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070064 });
65
Steve Paik66481982015-10-27 15:22:38 -070066 public HvacHalService(VehicleHal vehicleHal) {
Steve Paik461ecc62016-06-08 15:28:32 -070067 super(vehicleHal, TAG, DBG);
Steve Paik66481982015-10-27 15:22:38 -070068 }
69
70 // Convert the HVAC public API property ID to HAL property ID
Steve Paik461ecc62016-06-08 15:28:32 -070071 @Override
72 protected int managerToHalPropId(int hvacPropId) {
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070073 return mMgrHalPropIdMap.getHalPropId(hvacPropId);
Steve Paik66481982015-10-27 15:22:38 -070074 }
75
76 // Convert he HAL specific property ID to HVAC public API
Steve Paik461ecc62016-06-08 15:28:32 -070077 @Override
78 protected int halToManagerPropId(int halPropId) {
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070079 return mMgrHalPropIdMap.getManagerPropId(halPropId);
Steve Paik66481982015-10-27 15:22:38 -070080 }
81}