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 package com.android.car.hal; 17 18 import android.car.hardware.cabin.CarCabinManager; 19 import android.hardware.automotive.vehicle.V2_0.VehicleProperty; 20 21 public class CabinHalService extends PropertyHalServiceBase { 22 private static final boolean DBG = false; 23 private static final String TAG = "CAR.CABIN.HAL"; 24 25 private final ManagerToHalPropIdMap mMgrHalPropIdMap = ManagerToHalPropIdMap.create( 26 CarCabinManager.ID_DOOR_POS, 27 VehicleProperty.DOOR_POS, 28 29 CarCabinManager.ID_DOOR_MOVE, 30 VehicleProperty.DOOR_MOVE, 31 32 CarCabinManager.ID_DOOR_LOCK, 33 VehicleProperty.DOOR_LOCK, 34 35 CarCabinManager.ID_MIRROR_Z_POS, 36 VehicleProperty.MIRROR_Z_POS, 37 38 CarCabinManager.ID_MIRROR_Z_MOVE, 39 VehicleProperty.MIRROR_Z_MOVE, 40 41 CarCabinManager.ID_MIRROR_Y_POS, 42 VehicleProperty.MIRROR_Y_POS, 43 44 CarCabinManager.ID_MIRROR_Y_MOVE, 45 VehicleProperty.MIRROR_Y_MOVE, 46 47 CarCabinManager.ID_MIRROR_LOCK, 48 VehicleProperty.MIRROR_LOCK, 49 50 CarCabinManager.ID_MIRROR_FOLD, 51 VehicleProperty.MIRROR_FOLD, 52 53 CarCabinManager.ID_SEAT_MEMORY_SELECT, 54 VehicleProperty.SEAT_MEMORY_SELECT, 55 56 CarCabinManager.ID_SEAT_MEMORY_SET, 57 VehicleProperty.SEAT_MEMORY_SET, 58 59 CarCabinManager.ID_SEAT_BELT_BUCKLED, 60 VehicleProperty.SEAT_BELT_BUCKLED, 61 62 CarCabinManager.ID_SEAT_BELT_HEIGHT_POS, 63 VehicleProperty.SEAT_BELT_HEIGHT_POS, 64 65 CarCabinManager.ID_SEAT_BELT_HEIGHT_MOVE, 66 VehicleProperty.SEAT_BELT_HEIGHT_MOVE, 67 68 CarCabinManager.ID_SEAT_FORE_AFT_POS, 69 VehicleProperty.SEAT_FORE_AFT_POS, 70 71 CarCabinManager.ID_SEAT_FORE_AFT_MOVE, 72 VehicleProperty.SEAT_FORE_AFT_MOVE, 73 74 CarCabinManager.ID_SEAT_BACKREST_ANGLE_1_POS, 75 VehicleProperty.SEAT_BACKREST_ANGLE_1_POS, 76 77 CarCabinManager.ID_SEAT_BACKREST_ANGLE_1_MOVE, 78 VehicleProperty.SEAT_BACKREST_ANGLE_1_MOVE, 79 80 CarCabinManager.ID_SEAT_BACKREST_ANGLE_2_POS, 81 VehicleProperty.SEAT_BACKREST_ANGLE_2_POS, 82 83 CarCabinManager.ID_SEAT_BACKREST_ANGLE_2_MOVE, 84 VehicleProperty.SEAT_BACKREST_ANGLE_2_MOVE, 85 86 CarCabinManager.ID_SEAT_HEIGHT_POS, 87 VehicleProperty.SEAT_HEIGHT_POS, 88 89 CarCabinManager.ID_SEAT_HEIGHT_MOVE, 90 VehicleProperty.SEAT_HEIGHT_MOVE, 91 92 CarCabinManager.ID_SEAT_DEPTH_POS, 93 VehicleProperty.SEAT_DEPTH_POS, 94 95 CarCabinManager.ID_SEAT_DEPTH_MOVE, 96 VehicleProperty.SEAT_DEPTH_MOVE, 97 98 CarCabinManager.ID_SEAT_TILT_POS, 99 VehicleProperty.SEAT_TILT_POS, 100 101 CarCabinManager.ID_SEAT_TILT_MOVE, 102 VehicleProperty.SEAT_TILT_MOVE, 103 104 CarCabinManager.ID_SEAT_LUMBAR_FORE_AFT_POS, 105 VehicleProperty.SEAT_LUMBAR_FORE_AFT_POS, 106 107 CarCabinManager.ID_SEAT_LUMBAR_FORE_AFT_MOVE, 108 VehicleProperty.SEAT_LUMBAR_FORE_AFT_MOVE, 109 110 CarCabinManager.ID_SEAT_LUMBAR_SIDE_SUPPORT_POS, 111 VehicleProperty.SEAT_LUMBAR_SIDE_SUPPORT_POS, 112 113 CarCabinManager.ID_SEAT_LUMBAR_SIDE_SUPPORT_MOVE, 114 VehicleProperty.SEAT_LUMBAR_SIDE_SUPPORT_MOVE, 115 116 CarCabinManager.ID_SEAT_HEADREST_HEIGHT_POS, 117 VehicleProperty.SEAT_HEADREST_HEIGHT_POS, 118 119 CarCabinManager.ID_SEAT_HEADREST_HEIGHT_MOVE, 120 VehicleProperty.SEAT_HEADREST_HEIGHT_MOVE, 121 122 CarCabinManager.ID_SEAT_HEADREST_ANGLE_POS, 123 VehicleProperty.SEAT_HEADREST_ANGLE_POS, 124 125 CarCabinManager.ID_SEAT_HEADREST_ANGLE_MOVE, 126 VehicleProperty.SEAT_HEADREST_ANGLE_MOVE, 127 128 CarCabinManager.ID_SEAT_HEADREST_FORE_AFT_POS, 129 VehicleProperty.SEAT_HEADREST_FORE_AFT_POS, 130 131 CarCabinManager.ID_SEAT_HEADREST_FORE_AFT_MOVE, 132 VehicleProperty.SEAT_HEADREST_FORE_AFT_MOVE, 133 134 CarCabinManager.ID_WINDOW_POS, 135 VehicleProperty.WINDOW_POS, 136 137 CarCabinManager.ID_WINDOW_MOVE, 138 VehicleProperty.WINDOW_MOVE, 139 140 CarCabinManager.ID_WINDOW_VENT_POS, 141 VehicleProperty.WINDOW_VENT_POS, 142 143 CarCabinManager.ID_WINDOW_VENT_MOVE, 144 VehicleProperty.WINDOW_VENT_MOVE, 145 146 CarCabinManager.ID_WINDOW_LOCK, 147 VehicleProperty.WINDOW_LOCK 148 ); 149 150 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) { 157 return mMgrHalPropIdMap.getHalPropId(propId); 158 } 159 160 // Convert he HAL specific property ID to Cabin public API 161 @Override 162 protected int halToManagerPropId(int halPropId) { 163 return mMgrHalPropIdMap.getManagerPropId(halPropId); 164 } 165 } 166