public interface

CarClimate

 androidx.car.app.hardware.climate.CarClimate

Subclasses:

AutomotiveCarClimate

Gradle dependencies

compile group: 'androidx.car.app', name: 'app', version: '1.7.0-beta01'

  • groupId: androidx.car.app
  • artifactId: app
  • version: 1.7.0-beta01

Artifact androidx.car.app:app:1.7.0-beta01 it located at Google repository (https://maven.google.com/)

Overview

Manages access to car climate system such as cabin temperatures, fan speeds and fan directions.

Summary

Methods
public voidfetchClimateProfile(java.util.concurrent.Executor executor, ClimateProfileRequest request, CarClimateProfileCallback callback)

Fetches the climate profile information of the associated features specified in the request, for example, HVAC features like Fan Speed, Cabin Temperature, etc.

public voidregisterClimateStateCallback(java.util.concurrent.Executor executor, RegisterClimateStateRequest request, CarClimateStateCallback callback)

Registers an ongoing listener to receive car climate state events from the car hardware such as when the driver side temperature is increased/decreased.

public voidsetClimateState(java.util.concurrent.Executor executor, ClimateStateRequest<java.lang.Object> request, CarSetOperationStatusCallback callback)

Sets values for the car climate system.

public voidunregisterClimateStateCallback(CarClimateStateCallback callback)

Unregisters the ongoing listener for receiving car climate state events.

Methods

public void registerClimateStateCallback(java.util.concurrent.Executor executor, RegisterClimateStateRequest request, CarClimateStateCallback callback)

Registers an ongoing listener to receive car climate state events from the car hardware such as when the driver side temperature is increased/decreased.

If the callback was registered previously then it won't be registered again.

Parameters:

executor: the executor which will be used for invoking the listener
request: the RegisterClimateStateRequest indicates climate features which the caller is interested in
callback: the CarClimateStateCallback that will be invoked when the car climate is changed

public void unregisterClimateStateCallback(CarClimateStateCallback callback)

Unregisters the ongoing listener for receiving car climate state events.

If the callback is not currently registered, then this method call has no impact.

Parameters:

callback: the callback to unregister

public void fetchClimateProfile(java.util.concurrent.Executor executor, ClimateProfileRequest request, CarClimateProfileCallback callback)

Fetches the climate profile information of the associated features specified in the request, for example, HVAC features like Fan Speed, Cabin Temperature, etc.

Parameters:

executor: the executor which will be used for invoking the listener
request: the ClimateProfileRequest indicates profile features which the caller is interested in
callback: the CarClimateProfileCallback that will be invoked when the data is available

public void setClimateState(java.util.concurrent.Executor executor, ClimateStateRequest<java.lang.Object> request, CarSetOperationStatusCallback callback)

Sets values for the car climate system.

Parameters:

executor: the executor which will be used for invoking the listener
request: the ClimateStateRequest indicates climate features which the caller is setting value for
callback: the CarSetOperationStatusCallback that will be invoked when the set operation succeeded or failed

Source

/*
 * Copyright 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.car.app.hardware.climate;

import androidx.annotation.MainThread;
import androidx.annotation.NonNull;
import androidx.car.app.annotations.ExperimentalCarApi;
import androidx.car.app.annotations.RequiresCarApi;
import androidx.car.app.hardware.common.CarSetOperationStatusCallback;

import java.util.concurrent.Executor;

/**
 * Manages access to car climate system such as cabin temperatures, fan speeds and fan directions.
 */
@RequiresCarApi(5)
@MainThread
@ExperimentalCarApi
public interface CarClimate {
    /**
     * Registers an ongoing listener to receive car climate state events from the car hardware
     * such as when the driver side temperature is increased/decreased.
     *
     * <p> If the callback was registered previously then it won't be registered again.
     *
     * @param executor  the executor which will be used for invoking the listener
     * @param request   the RegisterClimateStateRequest indicates climate features
     *                  which the caller is interested in
     * @param callback  the CarClimateStateCallback that will be invoked when the
     *                  car climate is changed
     */
    void registerClimateStateCallback(@NonNull Executor executor,
            @NonNull RegisterClimateStateRequest request,
            @NonNull CarClimateStateCallback callback);

    /**
     * Unregisters the ongoing listener for receiving car climate state events.
     *
     * <p>If the callback is not currently registered, then this method call has no impact.
     *
     * @param callback the callback to unregister
     */
    void unregisterClimateStateCallback(@NonNull CarClimateStateCallback callback);

    /**
     * Fetches the climate profile information of the associated features specified in the
     * request, for example, HVAC features like Fan Speed, Cabin Temperature, etc.
     *
     * @param executor  the executor which will be used for invoking the listener
     * @param request   the ClimateProfileRequest indicates profile features which the
     *                  caller is interested in
     * @param callback  the CarClimateProfileCallback that will be
     *                  invoked when the data is available
     */
    void fetchClimateProfile(@NonNull Executor executor,
            @NonNull ClimateProfileRequest request,
            @NonNull CarClimateProfileCallback callback);

    /**
     * Sets values for the car climate system.
     *
     * @param executor  the executor which will be used for invoking the listener
     * @param request   the ClimateStateRequest indicates climate features which the
     *                  caller is setting value for
     * @param callback  the CarSetOperationStatusCallback that will be invoked when the
     *                  set operation succeeded or failed
     * @param <E>       the data type for ClimateStateRequest
     */
    <E> void setClimateState(@NonNull Executor executor,
            @NonNull ClimateStateRequest<E> request,
            @NonNull CarSetOperationStatusCallback callback);
}