blob: b0e5e211fe38f1338848c61836a7cc982ce5d219 [file] [log] [blame]
Steve Paik43c04a72016-07-08 19:12:09 -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 */
16package com.android.car.hal;
17
Keun-young Parkaf2cc992016-10-07 11:46:45 -070018import android.car.hardware.cabin.CarCabinManager;
Pavel Maltsev0d07c762016-11-03 16:40:15 -070019import android.hardware.vehicle.V2_0.VehicleProperty;
Steve Paik43c04a72016-07-08 19:12:09 -070020
21public class CabinHalService extends PropertyHalServiceBase {
Vitalii Tomkiv1b1247b2016-09-30 11:27:19 -070022 private static final boolean DBG = false;
Steve Paik43c04a72016-07-08 19:12:09 -070023 private static final String TAG = "CAR.CABIN.HAL";
24
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070025 private final ManagerToHalPropIdMap mMgrHalPropIdMap = ManagerToHalPropIdMap.create(new int[] {
Keun-young Parkaf2cc992016-10-07 11:46:45 -070026 CarCabinManager.ID_DOOR_POS,
Pavel Maltsev0d07c762016-11-03 16:40:15 -070027 VehicleProperty.DOOR_POS,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070028
Keun-young Parkaf2cc992016-10-07 11:46:45 -070029 CarCabinManager.ID_DOOR_MOVE,
Pavel Maltsev0d07c762016-11-03 16:40:15 -070030 VehicleProperty.DOOR_MOVE,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070031
Keun-young Parkaf2cc992016-10-07 11:46:45 -070032 CarCabinManager.ID_DOOR_LOCK,
Pavel Maltsev0d07c762016-11-03 16:40:15 -070033 VehicleProperty.DOOR_LOCK,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070034
Keun-young Parkaf2cc992016-10-07 11:46:45 -070035 CarCabinManager.ID_MIRROR_Z_POS,
Pavel Maltsev0d07c762016-11-03 16:40:15 -070036 VehicleProperty.MIRROR_Z_POS,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070037
Keun-young Parkaf2cc992016-10-07 11:46:45 -070038 CarCabinManager.ID_MIRROR_Z_MOVE,
Pavel Maltsev0d07c762016-11-03 16:40:15 -070039 VehicleProperty.MIRROR_Z_MOVE,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070040
Keun-young Parkaf2cc992016-10-07 11:46:45 -070041 CarCabinManager.ID_MIRROR_Y_POS,
Pavel Maltsev0d07c762016-11-03 16:40:15 -070042 VehicleProperty.MIRROR_Y_POS,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070043
Keun-young Parkaf2cc992016-10-07 11:46:45 -070044 CarCabinManager.ID_MIRROR_Y_MOVE,
Pavel Maltsev0d07c762016-11-03 16:40:15 -070045 VehicleProperty.MIRROR_Y_MOVE,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070046
Keun-young Parkaf2cc992016-10-07 11:46:45 -070047 CarCabinManager.ID_MIRROR_LOCK,
Pavel Maltsev0d07c762016-11-03 16:40:15 -070048 VehicleProperty.MIRROR_LOCK,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070049
Keun-young Parkaf2cc992016-10-07 11:46:45 -070050 CarCabinManager.ID_MIRROR_FOLD,
Pavel Maltsev0d07c762016-11-03 16:40:15 -070051 VehicleProperty.MIRROR_FOLD,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070052
Keun-young Parkaf2cc992016-10-07 11:46:45 -070053 CarCabinManager.ID_SEAT_MEMORY_SELECT,
Pavel Maltsev0d07c762016-11-03 16:40:15 -070054 VehicleProperty.SEAT_MEMORY_SELECT,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070055
Keun-young Parkaf2cc992016-10-07 11:46:45 -070056 CarCabinManager.ID_SEAT_MEMORY_SET,
Pavel Maltsev0d07c762016-11-03 16:40:15 -070057 VehicleProperty.SEAT_MEMORY_SET,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070058
Keun-young Parkaf2cc992016-10-07 11:46:45 -070059 CarCabinManager.ID_SEAT_BELT_BUCKLED,
Pavel Maltsev0d07c762016-11-03 16:40:15 -070060 VehicleProperty.SEAT_BELT_BUCKLED,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070061
Keun-young Parkaf2cc992016-10-07 11:46:45 -070062 CarCabinManager.ID_SEAT_BELT_HEIGHT_POS,
Pavel Maltsev0d07c762016-11-03 16:40:15 -070063 VehicleProperty.SEAT_BELT_HEIGHT_POS,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070064
Keun-young Parkaf2cc992016-10-07 11:46:45 -070065 CarCabinManager.ID_SEAT_BELT_HEIGHT_MOVE,
Pavel Maltsev0d07c762016-11-03 16:40:15 -070066 VehicleProperty.SEAT_BELT_HEIGHT_MOVE,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070067
Keun-young Parkaf2cc992016-10-07 11:46:45 -070068 CarCabinManager.ID_SEAT_FORE_AFT_POS,
Pavel Maltsev0d07c762016-11-03 16:40:15 -070069 VehicleProperty.SEAT_FORE_AFT_POS,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070070
Keun-young Parkaf2cc992016-10-07 11:46:45 -070071 CarCabinManager.ID_SEAT_FORE_AFT_MOVE,
Pavel Maltsev0d07c762016-11-03 16:40:15 -070072 VehicleProperty.SEAT_FORE_AFT_MOVE,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070073
Keun-young Parkaf2cc992016-10-07 11:46:45 -070074 CarCabinManager.ID_SEAT_BACKREST_ANGLE_1_POS,
Pavel Maltsev0d07c762016-11-03 16:40:15 -070075 VehicleProperty.SEAT_BACKREST_ANGLE_1_POS,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070076
Keun-young Parkaf2cc992016-10-07 11:46:45 -070077 CarCabinManager.ID_SEAT_BACKREST_ANGLE_1_MOVE,
Pavel Maltsev0d07c762016-11-03 16:40:15 -070078 VehicleProperty.SEAT_BACKREST_ANGLE_1_MOVE,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070079
Keun-young Parkaf2cc992016-10-07 11:46:45 -070080 CarCabinManager.ID_SEAT_BACKREST_ANGLE_2_POS,
Pavel Maltsev0d07c762016-11-03 16:40:15 -070081 VehicleProperty.SEAT_BACKREST_ANGLE_2_POS,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070082
Keun-young Parkaf2cc992016-10-07 11:46:45 -070083 CarCabinManager.ID_SEAT_BACKREST_ANGLE_2_MOVE,
Pavel Maltsev0d07c762016-11-03 16:40:15 -070084 VehicleProperty.SEAT_BACKREST_ANGLE_2_MOVE,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070085
Keun-young Parkaf2cc992016-10-07 11:46:45 -070086 CarCabinManager.ID_SEAT_HEIGHT_POS,
Pavel Maltsev0d07c762016-11-03 16:40:15 -070087 VehicleProperty.SEAT_HEIGHT_POS,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070088
Keun-young Parkaf2cc992016-10-07 11:46:45 -070089 CarCabinManager.ID_SEAT_HEIGHT_MOVE,
Pavel Maltsev0d07c762016-11-03 16:40:15 -070090 VehicleProperty.SEAT_HEIGHT_MOVE,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070091
Keun-young Parkaf2cc992016-10-07 11:46:45 -070092 CarCabinManager.ID_SEAT_DEPTH_POS,
Pavel Maltsev0d07c762016-11-03 16:40:15 -070093 VehicleProperty.SEAT_DEPTH_POS,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070094
Keun-young Parkaf2cc992016-10-07 11:46:45 -070095 CarCabinManager.ID_SEAT_DEPTH_MOVE,
Pavel Maltsev0d07c762016-11-03 16:40:15 -070096 VehicleProperty.SEAT_DEPTH_MOVE,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -070097
Keun-young Parkaf2cc992016-10-07 11:46:45 -070098 CarCabinManager.ID_SEAT_TILT_POS,
Pavel Maltsev0d07c762016-11-03 16:40:15 -070099 VehicleProperty.SEAT_TILT_POS,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -0700100
Keun-young Parkaf2cc992016-10-07 11:46:45 -0700101 CarCabinManager.ID_SEAT_TILT_MOVE,
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700102 VehicleProperty.SEAT_TILT_MOVE,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -0700103
Keun-young Parkaf2cc992016-10-07 11:46:45 -0700104 CarCabinManager.ID_SEAT_LUMBAR_FORE_AFT_POS,
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700105 VehicleProperty.SEAT_LUMBAR_FORE_AFT_POS,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -0700106
Keun-young Parkaf2cc992016-10-07 11:46:45 -0700107 CarCabinManager.ID_SEAT_LUMBAR_FORE_AFT_MOVE,
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700108 VehicleProperty.SEAT_LUMBAR_FORE_AFT_MOVE,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -0700109
Keun-young Parkaf2cc992016-10-07 11:46:45 -0700110 CarCabinManager.ID_SEAT_LUMBAR_SIDE_SUPPORT_POS,
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700111 VehicleProperty.SEAT_LUMBAR_SIDE_SUPPORT_POS,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -0700112
Keun-young Parkaf2cc992016-10-07 11:46:45 -0700113 CarCabinManager.ID_SEAT_LUMBAR_SIDE_SUPPORT_MOVE,
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700114 VehicleProperty.SEAT_LUMBAR_SIDE_SUPPORT_MOVE,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -0700115
Keun-young Parkaf2cc992016-10-07 11:46:45 -0700116 CarCabinManager.ID_SEAT_HEADREST_HEIGHT_POS,
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700117 VehicleProperty.SEAT_HEADREST_HEIGHT_POS,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -0700118
Keun-young Parkaf2cc992016-10-07 11:46:45 -0700119 CarCabinManager.ID_SEAT_HEADREST_HEIGHT_MOVE,
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700120 VehicleProperty.SEAT_HEADREST_HEIGHT_MOVE,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -0700121
Keun-young Parkaf2cc992016-10-07 11:46:45 -0700122 CarCabinManager.ID_SEAT_HEADREST_ANGLE_POS,
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700123 VehicleProperty.SEAT_HEADREST_ANGLE_POS,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -0700124
Keun-young Parkaf2cc992016-10-07 11:46:45 -0700125 CarCabinManager.ID_SEAT_HEADREST_ANGLE_MOVE,
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700126 VehicleProperty.SEAT_HEADREST_ANGLE_MOVE,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -0700127
Keun-young Parkaf2cc992016-10-07 11:46:45 -0700128 CarCabinManager.ID_SEAT_HEADREST_FORE_AFT_POS,
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700129 VehicleProperty.SEAT_HEADREST_FORE_AFT_POS,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -0700130
Keun-young Parkaf2cc992016-10-07 11:46:45 -0700131 CarCabinManager.ID_SEAT_HEADREST_FORE_AFT_MOVE,
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700132 VehicleProperty.SEAT_HEADREST_FORE_AFT_MOVE,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -0700133
Keun-young Parkaf2cc992016-10-07 11:46:45 -0700134 CarCabinManager.ID_WINDOW_POS,
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700135 VehicleProperty.WINDOW_POS,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -0700136
Keun-young Parkaf2cc992016-10-07 11:46:45 -0700137 CarCabinManager.ID_WINDOW_MOVE,
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700138 VehicleProperty.WINDOW_MOVE,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -0700139
Keun-young Parkaf2cc992016-10-07 11:46:45 -0700140 CarCabinManager.ID_WINDOW_VENT_POS,
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700141 VehicleProperty.WINDOW_VENT_POS,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -0700142
Keun-young Parkaf2cc992016-10-07 11:46:45 -0700143 CarCabinManager.ID_WINDOW_VENT_MOVE,
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700144 VehicleProperty.WINDOW_VENT_MOVE,
Pavel Maltsev634e1ff2016-07-14 15:41:26 -0700145
Keun-young Parkaf2cc992016-10-07 11:46:45 -0700146 CarCabinManager.ID_WINDOW_LOCK,
Pavel Maltsev0d07c762016-11-03 16:40:15 -0700147 VehicleProperty.WINDOW_LOCK
Pavel Maltsev634e1ff2016-07-14 15:41:26 -0700148 });
149
Steve Paik43c04a72016-07-08 19:12:09 -0700150 public CabinHalService(VehicleHal vehicleHal) {
151 super(vehicleHal, TAG, DBG);
152 }
153
154 // Convert the Cabin public API property ID to HAL property ID
155 @Override
156 protected int managerToHalPropId(int propId) {
Pavel Maltsev634e1ff2016-07-14 15:41:26 -0700157 return mMgrHalPropIdMap.getHalPropId(propId);
Steve Paik43c04a72016-07-08 19:12:09 -0700158 }
159
160 // Convert he HAL specific property ID to Cabin public API
161 @Override
162 protected int halToManagerPropId(int halPropId) {
Pavel Maltsev634e1ff2016-07-14 15:41:26 -0700163 return mMgrHalPropIdMap.getManagerPropId(halPropId);
Steve Paik43c04a72016-07-08 19:12:09 -0700164 }
165}