blob: 5f6e85d0bb15463448d8ade6c71be6c55355565b [file] [log] [blame]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.hardware.backlight;
using zx;
type State = struct {
backlight_on bool;
/// `brightness` can either be:
/// 1. The unitless brightness value on a linear scale where 0.0 is the minimum
/// brightness and 1.0 is the maximum brightness - represents the current /
/// desired brightness as a percentage within the supported range. Used
/// by the `GetStateNormalized` / `SetStateNormalized` calls. The maximum
/// brightness that can be set using `SetStateNormalized` is
/// GetBrightnessScale() * GetMaxAbsoluteBrightness().
/// 2. Absolute brightness in nits. Used by the `GetStateAbsolute` /
/// `SetStateAbsolute` calls.
brightness float64;
};
closed protocol Device {
/// Gets the current backlight brightness as a percentage value between 0.0
/// and 1.0
strict GetStateNormalized() -> (struct {
state State;
}) error zx.Status;
/// Sets the current backlight brightness as a percentage value between 0.0
/// and 1.0
strict SetStateNormalized(struct {
state State;
}) -> () error zx.Status;
/// Gets the current backlight brightness in nits
strict GetStateAbsolute() -> (struct {
state State;
}) error zx.Status;
/// Sets the current backlight brightness in nits. Not affected by the scale
/// set by SetNormalizedBrightnessScale.
strict SetStateAbsolute(struct {
state State;
}) -> () error zx.Status;
/// Gets the maximum supported backlight brightness in nits, if known.
/// Otherwise returns error ZX_ERR_NOT_SUPPORTED.
strict GetMaxAbsoluteBrightness() -> (struct {
max_brightness float64;
}) error zx.Status;
/// Scales the maximum normalized brightness by a percentage value in
/// [0.0, 1.0], if supported. Otherwise returns error ZX_ERR_NOT_SUPPORTED.
/// Values passed to SetStateNormalized will correspond to a maximum
/// brightness of scale * GetMaxAbsoluteBrightness(). Calling this may
/// change the current absolute brightness.
strict SetNormalizedBrightnessScale(struct {
scale float64;
}) -> () error zx.Status;
/// Gets the current normalized brightness scale as a percentage value in
/// [0.0, 1.0].
strict GetNormalizedBrightnessScale() -> (struct {
scale float64;
}) error zx.Status;
};