class BacklightState

Defined at line 23 of file ../../src/graphics/display/lib/api-types/cpp/backlight-state.h

Equivalent to the FIDL type [`fuchsia.hardware.backlight/State`].

See `::fuchsia_hardware_backlight::wire::State` for references.

Instances are guaranteed to represent valid backlight states.

This is a value type. Instances can be stored in containers. Copying, moving

and destruction are trivial.

Public Methods

void BacklightState (const BacklightState & )

Defined at line 57 of file ../../src/graphics/display/lib/api-types/cpp/backlight-state.h

void BacklightState (BacklightState && )

Defined at line 58 of file ../../src/graphics/display/lib/api-types/cpp/backlight-state.h

BacklightState & operator= (const BacklightState & )

Defined at line 59 of file ../../src/graphics/display/lib/api-types/cpp/backlight-state.h

BacklightState & operator= (BacklightState && )

Defined at line 60 of file ../../src/graphics/display/lib/api-types/cpp/backlight-state.h

void ~BacklightState ()

Defined at line 61 of file ../../src/graphics/display/lib/api-types/cpp/backlight-state.h

bool on ()

True iff the backlight is turned on.

When the backlight is turned off, it emits 0 nits (no light).

Defined at line 80 of file ../../src/graphics/display/lib/api-types/cpp/backlight-state.h

double brightness_fraction ()

The amount of light emitted by the device, relatively to its maximum power.

Guaranteed to be in [0.0, 1.0]. Guaranteed to be 0.0 if `on` is false.

1.0 maps to the maximum brightness level supported by the hardware.

0.0 maps to the minimum configurable brightness level supported by the

hardware.

TODO(https://fxbug.dev/419035481): Specify the meaning of having `on` set

to true and `brightness_fraction()` / `brightness_nits()` set to 0.0.

Defined at line 92 of file ../../src/graphics/display/lib/api-types/cpp/backlight-state.h

std::optional<double> brightness_nits ()

The amount of light emitted by the device, in nits.

Guaranteed to be non-negative. Guaranteed to be 0.0 if `on` is false.

Set to nullopt if the driver does not provide guarantees around the amount

of light emitted.

Defined at line 100 of file ../../src/graphics/display/lib/api-types/cpp/backlight-state.h

bool IsValid (const fuchsia_hardware_backlight::wire::State & fidl_state, bool use_absolute_brightness)

True iff `fidl_state` is convertible to a valid BacklightState.

If `use_absolute_brightness` is true, the brightness value in `fidl_state`

maps to `brightness_nits()` and must meet the constraints documented there.

If `use_absolute_brightness` is false, the brightness value in `fidl_state`

maps to `brightness_fraction()`, and must meet the constraints documented

there.

Defined at line 122 of file ../../src/graphics/display/lib/api-types/cpp/backlight-state.h

BacklightState From (const fuchsia_hardware_backlight::wire::State & fidl_state, bool use_absolute_brightness)

`fidl_state` must be convertible to a valid BacklightState.

This is not a constructor to allow designated initializer syntax. Making

this a constructor would introduce ambiguity when designated initializer

syntax is used, because `fuchsia.hardware.brightness/State` will eventually

be migrated to have the same field names as our supported designated

initializer syntax.

TODO(https://fxbug.dev/419035481): Remove `use_absolute_brightness` when

the FIDL State structure becomes unambiguous.

Defined at line 145 of file ../../src/graphics/display/lib/api-types/cpp/backlight-state.h

void BacklightState (const BacklightState::ConstructorArgs & args)

Constructor that enables the designated initializer syntax with containers.

NOLINTNEXTLINE(google-explicit-constructor)

Defined at line 137 of file ../../src/graphics/display/lib/api-types/cpp/backlight-state.h

fuchsia_hardware_backlight::wire::State ToFidl (bool use_absolute_brightness)

`use_absolute_brightness` must only be true if the absolute brightness

information is not nullopt.

Absolute brightness information is dropped if `use_absolute_brightness` is

false. Fractional brightness information is dropped if

`use_absolute_brightness` is true.

TODO(https://fxbug.dev/419035481): Remove `use_absolute_brightness` when

the FIDL State structure becomes unambiguous.

Defined at line 168 of file ../../src/graphics/display/lib/api-types/cpp/backlight-state.h

Friends

bool BacklightState (const BacklightState & lhs, const BacklightState & rhs)
bool BacklightState (const BacklightState & lhsconst BacklightState & rhs)