class DriverContext

Defined at line 35 of file ../../sdk/lib/driver/component/cpp/driver_base2.h

Public Methods

void DriverContext (fuchsia_driver_framework::DriverStartArgs start_args)

Defined at line 12 of file ../../sdk/lib/driver/component/cpp/driver_base2.cc

const std::vector<fuchsia_driver_framework::Offer> & node_offers ()

Defined at line 39 of file ../../sdk/lib/driver/component/cpp/driver_base2.h

template <typename StructuredConfig>
StructuredConfig take_config ()

Defined at line 47 of file ../../sdk/lib/driver/component/cpp/driver_base2.h

cpp20::span<const fuchsia_driver_framework::NodeProperty2> node_properties (const std::string & parent_node_name)

Returns the node properties of the node the driver is bound to or its parents.

Returns the node's own node properties if `parent_node_name` is "default" and the node is a

non-composite.

Returns the node's primary parent's node properties if `parent_node_name` is "default" and the

node is a composite.

Returns an empty vector if the parent does not exist.

Defined at line 47 of file ../../sdk/lib/driver/component/cpp/driver_base2.cc

zx::unowned_vmar vmar ()

Defined at line 54 of file ../../sdk/lib/driver/component/cpp/driver_base2.h

zx::event take_node_token ()

Takes the node token for this driver. This should only be called once.

Defined at line 60 of file ../../sdk/lib/driver/component/cpp/driver_base2.cc

const Namespace & incoming ()

Used to access the incoming namespace of the driver. This allows connecting to both zircon and

driver transport incoming services.

Defined at line 64 of file ../../sdk/lib/driver/component/cpp/driver_base2.h

std::optional<fidl::ServerEnd<fuchsia_power_broker::ElementRunner>> take_power_element_runner ()

Takes the `fuchsia.power.broker/ElementRunner` channel for this driver's power element. The

caller is expected to run the power element.

Returns std::nullopt if the driver did not specify `suspend_enabled` in its manifest's program

section, this is not a suspend enabled platform, or the channel was not provided to the driver

host.

Defined at line 66 of file ../../sdk/lib/driver/component/cpp/driver_base2.cc

Namespace & incoming ()

Defined at line 69 of file ../../sdk/lib/driver/component/cpp/driver_base2.h

std::unique_ptr<Namespace> take_incoming ()

Used to access the incoming namespace of the driver. This allows connecting to both zircon and

driver transport incoming services.

Defined at line 76 of file ../../sdk/lib/driver/component/cpp/driver_base2.h

std::optional<fidl::ClientEnd<fuchsia_power_broker::Lessor>> take_power_element_lessor ()

Takes the `fuchsia.power.broker/Lessor` channel. This allows the caller to lease the power

element.

Returns std::nullopt if the driver did not specify `suspend_enabled` in its manifest's program

section, this is not a suspend enabled platform, or the channel was not provided to the driver

host.

Defined at line 76 of file ../../sdk/lib/driver/component/cpp/driver_base2.cc

fidl::UnownedClientEnd<fuchsia_io::Directory> svc ()

The `/svc` directory in the incoming namespace.

Defined at line 82 of file ../../sdk/lib/driver/component/cpp/driver_base2.h

std::optional<fuchsia_power_broker::DependencyToken> power_element_token ()

Returns a copy of the power element token for the driver's power element. This can be called

repeatedly.

Returns std::nullopt if the driver did not specify `suspend_enabled` in its manifest's program

section, this is not a suspend enabled platform, or the token was not provided by the driver

host.

Defined at line 86 of file ../../sdk/lib/driver/component/cpp/driver_base2.cc

const std::optional<fuchsia_data::Dictionary> & program ()

The program dictionary in the start args.

This is the `program` entry in the cml of the driver.

Defined at line 89 of file ../../sdk/lib/driver/component/cpp/driver_base2.h

const std::optional<std::string> & url ()

The url field in the start args.

This is the URL of the package containing the driver. This is purely informational,

used only to provide data for inspect.

Defined at line 94 of file ../../sdk/lib/driver/component/cpp/driver_base2.h

bool has_power_args ()

Whether the power handles were provided in the start args. If the handles are absent it means

either the driver's manifest did not request them or the driver did, but this is not a power-

enabled product.

TODO(https://fxbug.dev/495557052): Remove this API once this bug is closed.

Defined at line 98 of file ../../sdk/lib/driver/component/cpp/driver_base2.cc

inspect::ComponentInspector CreateInspector (DriverBase2 * driver, inspect::Inspector inspector)

Creates a component-wide Inspector for the driver.

Defined at line 36 of file ../../sdk/lib/driver/component/cpp/driver_base2.cc

const std::optional<std::string> & node_name ()

The node_name field in the start args.

This is the name of the node that the driver is bound to.

Defined at line 98 of file ../../sdk/lib/driver/component/cpp/driver_base2.h

const std::optional<std::vector<fuchsia_driver_framework::NodeSymbol>> & symbols ()

The symbols field in the start args.

These come from the driver that added |node|, and are filtered to the symbols requested in the

bind program.

Defined at line 115 of file ../../sdk/lib/driver/component/cpp/driver_base2.h

Friends

class DriverBase2