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 package android.support.car; 18 19 import android.os.Bundle; 20 import android.os.RemoteException; 21 import android.support.car.annotation.ValueTypeDef; 22 23 import java.lang.reflect.Field; 24 import java.util.HashMap; 25 26 /** @hide */ 27 public class CarInfoManagerEmbedded extends CarInfoManager { 28 29 private final android.car.CarInfoManager mManager; 30 31 32 /** @hide */ CarInfoManagerEmbedded(Object manager)33 CarInfoManagerEmbedded(Object manager) { 34 mManager = (android.car.CarInfoManager) manager; 35 } 36 37 @Override getFloat(String key)38 public Float getFloat(String key) throws CarNotConnectedException, IllegalArgumentException { 39 try { 40 return mManager.getFloat(key); 41 } catch (android.car.CarNotConnectedException e) { 42 throw new CarNotConnectedException(e); 43 } 44 } 45 46 @Override getInt(String key)47 public Integer getInt(String key) throws CarNotConnectedException, IllegalArgumentException { 48 try { 49 return mManager.getInt(key); 50 } catch (android.car.CarNotConnectedException e) { 51 throw new CarNotConnectedException(e); 52 } 53 } 54 55 @Override getLong(String key)56 public Long getLong(String key) throws CarNotConnectedException, IllegalArgumentException { 57 try { 58 return mManager.getLong(key); 59 } catch (android.car.CarNotConnectedException e) { 60 throw new CarNotConnectedException(e); 61 } 62 } 63 64 @Override getString(String key)65 public String getString(String key) throws CarNotConnectedException, IllegalArgumentException { 66 try { 67 return mManager.getString(key); 68 } catch (android.car.CarNotConnectedException e) { 69 throw new CarNotConnectedException(e); 70 } 71 } 72 73 /** 74 * get Bundle for the given key. This is intended for passing vendor specific data for key 75 * defined only for the car vendor. Vendor extension can be used for other APIs like 76 * getInt / getString, but this is for passing more complex data. 77 * @param key 78 * @return 79 * @throws CarNotConnectedException 80 * @throws IllegalArgumentException 81 * @hide 82 */ 83 @Override getBundle(String key)84 public Bundle getBundle(String key) throws CarNotConnectedException, IllegalArgumentException { 85 try { 86 return mManager.getBundle(key); 87 } catch (android.car.CarNotConnectedException e) { 88 throw new CarNotConnectedException(e); 89 } 90 } 91 92 /** @hide */ 93 @Override onCarDisconnected()94 public void onCarDisconnected() { 95 //nothing to do 96 } 97 } 98