CarInfoManager.java revision 07ddbbd70e518e271f941f92df1b0e5501af0ad1
1e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park/*
2e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park * Copyright (C) 2015 The Android Open Source Project
3e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park *
4e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park * Licensed under the Apache License, Version 2.0 (the "License");
5e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park * you may not use this file except in compliance with the License.
6e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park * You may obtain a copy of the License at
7e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park *
8e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park *      http://www.apache.org/licenses/LICENSE-2.0
9e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park *
10e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park * Unless required by applicable law or agreed to in writing, software
11e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park * distributed under the License is distributed on an "AS IS" BASIS,
12e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park * See the License for the specific language governing permissions and
14e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park * limitations under the License.
15e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park */
16e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park
17e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Parkpackage android.support.car;
18e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park
19e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Parkimport android.os.Bundle;
2007ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Parkimport android.support.annotation.IntDef;
2107ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Parkimport android.support.annotation.Nullable;
2207ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Parkimport android.support.car.CarNotConnectedException;
23e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Parkimport android.support.car.annotation.ValueTypeDef;
24e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park
256745635909d050c57f5a08bfc28580feb0f2cfe0Keun-young Parkimport java.lang.annotation.Retention;
266745635909d050c57f5a08bfc28580feb0f2cfe0Keun-young Parkimport java.lang.annotation.RetentionPolicy;
276745635909d050c57f5a08bfc28580feb0f2cfe0Keun-young Park
28e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park/**
2907ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park * Utility to retrieve various static information from car.
30e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park */
31e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Parkpublic abstract class CarInfoManager implements CarManagerBase {
32e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park
3307ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park    /** Location of the driver is unknown. */
3407ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park    public static final int DRIVER_SIDE_UNKNOWN = 0;
3507ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park    /** Location of the driver: left. */
3607ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park    public static final int DRIVER_SIDE_LEFT   = 1;
3707ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park    /** Location of the driver: right. */
3807ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park    public static final int DRIVER_SIDE_RIGHT  = 2;
3907ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park    /** Location of the driver: center. */
4007ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park    public static final int DRIVER_SIDE_CENTER = 3;
4107ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park
4207ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park    /** @hide */
4307ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park    @IntDef({
4407ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park        DRIVER_SIDE_UNKNOWN,
4507ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park        DRIVER_SIDE_LEFT,
4607ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park        DRIVER_SIDE_RIGHT,
4707ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park        DRIVER_SIDE_CENTER
4807ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park    })
4907ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park    @Retention(RetentionPolicy.SOURCE)
5007ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park    public @interface DriverSide {}
5107ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park
52e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park    /**
5307ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park     * Return manufacturer of the car.
5407ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park     * @return null if information is not available.
55e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park     */
5607ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park    public abstract @Nullable String getManufacturer() throws CarNotConnectedException;
5707ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park
58e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park    /**
5907ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park     * Return model name of the car. This information may not necessarily allow distinguishing
606745635909d050c57f5a08bfc28580feb0f2cfe0Keun-young Park     * different car models as the same name may be used for different cars depending on
6107ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park     * manufacturers.
6207ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park     * @return null if information is not available.
6307ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park     */
6407ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park    public abstract @Nullable String getModel() throws CarNotConnectedException;
6507ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park
6607ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park    /**
6707ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park     * Return model year of the car in AC.
6807ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park     * @return null if information is not available.
69e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park     */
7007ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park    public abstract @Nullable String getModelYear() throws CarNotConnectedException;
7107ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park
72e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park    /**
7307ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park     * Return unique identifier for the car. This is not VIN, and id is persistent until user
7407ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park     * resets it.
7507ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park     * @return null if information is not available.
76e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park     */
7707ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park    public abstract @Nullable String getVehicleId() throws CarNotConnectedException;
7807ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park
79e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park    /**
8007ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park     * Return manufacturer of the head unit.
8107ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park     * @return null if information is not available.
82e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park     */
8307ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park    public abstract @Nullable String getHeadunitManufacturer() throws CarNotConnectedException;
84e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park
8507ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park    /**
8607ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park     * Return model of the headunit.
8707ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park     * @return null if information is not available.
8807ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park     */
8907ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park    public abstract @Nullable String getHeadunitModel() throws CarNotConnectedException;
906745635909d050c57f5a08bfc28580feb0f2cfe0Keun-young Park
9107ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park    /**
9207ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park     * Return S/W build of the headunit.
9307ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park     * @return null if information is not available.
9407ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park     */
9507ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park    public abstract @Nullable String getHeadunitSoftwareBuild() throws CarNotConnectedException;
96b13dbe470108846d1c04494c5c0d2bf3cd9b8054Jason Tholstrup
9707ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park    /**
9807ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park     * Return S/W version of the headunit.
9907ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park     * @return null if information is not available.
10007ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park     */
10107ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park    public abstract @Nullable String getHeadunitSoftwareVersion() throws CarNotConnectedException;
102e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park
103e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park    /**
10407ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park     * Return driver side of the car.
10507ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park     * @return {@link #DRIVER_SIDE_UNKNOWN} if information is not available.
106e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park     */
10707ddbbd70e518e271f941f92df1b0e5501af0ad1Keun-young Park    public abstract @DriverSide int getDriverPosition() throws CarNotConnectedException;
108e54ac276796c6535558f8444d882adecd19ce2bdKeun-young Park}
109