Steve Paik | 43c04a7 | 2016-07-08 19:12:09 -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 | package com.android.car.hal; |
| 17 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 18 | import android.car.hardware.cabin.CarCabinManager; |
Steve Paik | 43c04a7 | 2016-07-08 19:12:09 -0700 | [diff] [blame] | 19 | |
| 20 | import com.android.car.vehiclenetwork.VehicleNetworkConsts; |
| 21 | |
| 22 | public class CabinHalService extends PropertyHalServiceBase { |
Vitalii Tomkiv | 1b1247b | 2016-09-30 11:27:19 -0700 | [diff] [blame] | 23 | private static final boolean DBG = false; |
Steve Paik | 43c04a7 | 2016-07-08 19:12:09 -0700 | [diff] [blame] | 24 | private static final String TAG = "CAR.CABIN.HAL"; |
| 25 | |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 26 | private final ManagerToHalPropIdMap mMgrHalPropIdMap = ManagerToHalPropIdMap.create(new int[] { |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 27 | CarCabinManager.ID_DOOR_POS, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 28 | VehicleNetworkConsts.VEHICLE_PROPERTY_DOOR_POS, |
| 29 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 30 | CarCabinManager.ID_DOOR_MOVE, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 31 | VehicleNetworkConsts.VEHICLE_PROPERTY_DOOR_MOVE, |
| 32 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 33 | CarCabinManager.ID_DOOR_LOCK, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 34 | VehicleNetworkConsts.VEHICLE_PROPERTY_DOOR_LOCK, |
| 35 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 36 | CarCabinManager.ID_MIRROR_Z_POS, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 37 | VehicleNetworkConsts.VEHICLE_PROPERTY_MIRROR_Z_POS, |
| 38 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 39 | CarCabinManager.ID_MIRROR_Z_MOVE, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 40 | VehicleNetworkConsts.VEHICLE_PROPERTY_MIRROR_Z_MOVE, |
| 41 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 42 | CarCabinManager.ID_MIRROR_Y_POS, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 43 | VehicleNetworkConsts.VEHICLE_PROPERTY_MIRROR_Y_POS, |
| 44 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 45 | CarCabinManager.ID_MIRROR_Y_MOVE, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 46 | VehicleNetworkConsts.VEHICLE_PROPERTY_MIRROR_Y_MOVE, |
| 47 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 48 | CarCabinManager.ID_MIRROR_LOCK, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 49 | VehicleNetworkConsts.VEHICLE_PROPERTY_MIRROR_LOCK, |
| 50 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 51 | CarCabinManager.ID_MIRROR_FOLD, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 52 | VehicleNetworkConsts.VEHICLE_PROPERTY_MIRROR_FOLD, |
| 53 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 54 | CarCabinManager.ID_SEAT_MEMORY_SELECT, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 55 | VehicleNetworkConsts.VEHICLE_PROPERTY_SEAT_MEMORY_SELECT, |
| 56 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 57 | CarCabinManager.ID_SEAT_MEMORY_SET, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 58 | VehicleNetworkConsts.VEHICLE_PROPERTY_SEAT_MEMORY_SET, |
| 59 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 60 | CarCabinManager.ID_SEAT_BELT_BUCKLED, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 61 | VehicleNetworkConsts.VEHICLE_PROPERTY_SEAT_BELT_BUCKLED, |
| 62 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 63 | CarCabinManager.ID_SEAT_BELT_HEIGHT_POS, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 64 | VehicleNetworkConsts.VEHICLE_PROPERTY_SEAT_BELT_HEIGHT_POS, |
| 65 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 66 | CarCabinManager.ID_SEAT_BELT_HEIGHT_MOVE, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 67 | VehicleNetworkConsts.VEHICLE_PROPERTY_SEAT_BELT_HEIGHT_MOVE, |
| 68 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 69 | CarCabinManager.ID_SEAT_FORE_AFT_POS, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 70 | VehicleNetworkConsts.VEHICLE_PROPERTY_SEAT_FORE_AFT_POS, |
| 71 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 72 | CarCabinManager.ID_SEAT_FORE_AFT_MOVE, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 73 | VehicleNetworkConsts.VEHICLE_PROPERTY_SEAT_FORE_AFT_MOVE, |
| 74 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 75 | CarCabinManager.ID_SEAT_BACKREST_ANGLE_1_POS, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 76 | VehicleNetworkConsts.VEHICLE_PROPERTY_SEAT_BACKREST_ANGLE_1_POS, |
| 77 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 78 | CarCabinManager.ID_SEAT_BACKREST_ANGLE_1_MOVE, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 79 | VehicleNetworkConsts.VEHICLE_PROPERTY_SEAT_BACKREST_ANGLE_1_MOVE, |
| 80 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 81 | CarCabinManager.ID_SEAT_BACKREST_ANGLE_2_POS, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 82 | VehicleNetworkConsts.VEHICLE_PROPERTY_SEAT_BACKREST_ANGLE_2_POS, |
| 83 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 84 | CarCabinManager.ID_SEAT_BACKREST_ANGLE_2_MOVE, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 85 | VehicleNetworkConsts.VEHICLE_PROPERTY_SEAT_BACKREST_ANGLE_2_MOVE, |
| 86 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 87 | CarCabinManager.ID_SEAT_HEIGHT_POS, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 88 | VehicleNetworkConsts.VEHICLE_PROPERTY_SEAT_HEIGHT_POS, |
| 89 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 90 | CarCabinManager.ID_SEAT_HEIGHT_MOVE, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 91 | VehicleNetworkConsts.VEHICLE_PROPERTY_SEAT_HEIGHT_MOVE, |
| 92 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 93 | CarCabinManager.ID_SEAT_DEPTH_POS, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 94 | VehicleNetworkConsts.VEHICLE_PROPERTY_SEAT_DEPTH_POS, |
| 95 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 96 | CarCabinManager.ID_SEAT_DEPTH_MOVE, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 97 | VehicleNetworkConsts.VEHICLE_PROPERTY_SEAT_DEPTH_MOVE, |
| 98 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 99 | CarCabinManager.ID_SEAT_TILT_POS, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 100 | VehicleNetworkConsts.VEHICLE_PROPERTY_SEAT_TILT_POS, |
| 101 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 102 | CarCabinManager.ID_SEAT_TILT_MOVE, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 103 | VehicleNetworkConsts.VEHICLE_PROPERTY_SEAT_TILT_MOVE, |
| 104 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 105 | CarCabinManager.ID_SEAT_LUMBAR_FORE_AFT_POS, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 106 | VehicleNetworkConsts.VEHICLE_PROPERTY_SEAT_LUMBAR_FORE_AFT_POS, |
| 107 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 108 | CarCabinManager.ID_SEAT_LUMBAR_FORE_AFT_MOVE, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 109 | VehicleNetworkConsts.VEHICLE_PROPERTY_SEAT_LUMBAR_FORE_AFT_MOVE, |
| 110 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 111 | CarCabinManager.ID_SEAT_LUMBAR_SIDE_SUPPORT_POS, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 112 | VehicleNetworkConsts.VEHICLE_PROPERTY_SEAT_LUMBAR_SIDE_SUPPORT_POS, |
| 113 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 114 | CarCabinManager.ID_SEAT_LUMBAR_SIDE_SUPPORT_MOVE, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 115 | VehicleNetworkConsts.VEHICLE_PROPERTY_SEAT_LUMBAR_SIDE_SUPPORT_MOVE, |
| 116 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 117 | CarCabinManager.ID_SEAT_HEADREST_HEIGHT_POS, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 118 | VehicleNetworkConsts.VEHICLE_PROPERTY_SEAT_HEADREST_HEIGHT_POS, |
| 119 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 120 | CarCabinManager.ID_SEAT_HEADREST_HEIGHT_MOVE, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 121 | VehicleNetworkConsts.VEHICLE_PROPERTY_SEAT_HEADREST_HEIGHT_MOVE, |
| 122 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 123 | CarCabinManager.ID_SEAT_HEADREST_ANGLE_POS, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 124 | VehicleNetworkConsts.VEHICLE_PROPERTY_SEAT_HEADREST_ANGLE_POS, |
| 125 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 126 | CarCabinManager.ID_SEAT_HEADREST_ANGLE_MOVE, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 127 | VehicleNetworkConsts.VEHICLE_PROPERTY_SEAT_HEADREST_ANGLE_MOVE, |
| 128 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 129 | CarCabinManager.ID_SEAT_HEADREST_FORE_AFT_POS, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 130 | VehicleNetworkConsts.VEHICLE_PROPERTY_SEAT_HEADREST_FORE_AFT_POS, |
| 131 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 132 | CarCabinManager.ID_SEAT_HEADREST_FORE_AFT_MOVE, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 133 | VehicleNetworkConsts.VEHICLE_PROPERTY_SEAT_HEADREST_FORE_AFT_MOVE, |
| 134 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 135 | CarCabinManager.ID_WINDOW_POS, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 136 | VehicleNetworkConsts.VEHICLE_PROPERTY_WINDOW_POS, |
| 137 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 138 | CarCabinManager.ID_WINDOW_MOVE, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 139 | VehicleNetworkConsts.VEHICLE_PROPERTY_WINDOW_MOVE, |
| 140 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 141 | CarCabinManager.ID_WINDOW_VENT_POS, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 142 | VehicleNetworkConsts.VEHICLE_PROPERTY_WINDOW_VENT_POS, |
| 143 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 144 | CarCabinManager.ID_WINDOW_VENT_MOVE, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 145 | VehicleNetworkConsts.VEHICLE_PROPERTY_WINDOW_VENT_MOVE, |
| 146 | |
Keun-young Park | af2cc99 | 2016-10-07 11:46:45 -0700 | [diff] [blame] | 147 | CarCabinManager.ID_WINDOW_LOCK, |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 148 | VehicleNetworkConsts.VEHICLE_PROPERTY_WINDOW_LOCK |
| 149 | }); |
| 150 | |
Steve Paik | 43c04a7 | 2016-07-08 19:12:09 -0700 | [diff] [blame] | 151 | public CabinHalService(VehicleHal vehicleHal) { |
| 152 | super(vehicleHal, TAG, DBG); |
| 153 | } |
| 154 | |
| 155 | // Convert the Cabin public API property ID to HAL property ID |
| 156 | @Override |
| 157 | protected int managerToHalPropId(int propId) { |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 158 | return mMgrHalPropIdMap.getHalPropId(propId); |
Steve Paik | 43c04a7 | 2016-07-08 19:12:09 -0700 | [diff] [blame] | 159 | } |
| 160 | |
| 161 | // Convert he HAL specific property ID to Cabin public API |
| 162 | @Override |
| 163 | protected int halToManagerPropId(int halPropId) { |
Pavel Maltsev | 634e1ff | 2016-07-14 15:41:26 -0700 | [diff] [blame] | 164 | return mMgrHalPropIdMap.getManagerPropId(halPropId); |
Steve Paik | 43c04a7 | 2016-07-08 19:12:09 -0700 | [diff] [blame] | 165 | } |
| 166 | } |