Here are examples of how to send, retrieve, and forward metadata between drivers using the //sdk/lib/driver/metadata library.
The fuchsia.examples.metadata FIDL library is an example of how to define metadata.
The sender driver is an example of how a driver can send metadata to its child nodes.
The retriever driver is an example of how a driver can retrieve metadata from parent node.
The forwarder driver is an example of how a driver can forward metadata from its parent node to its child nodes.
Include the tests to your build by appending --with-test //examples/drivers/metadata:tests to your fx set command. For example:
$ fx set core.x64 --with-test //examples/drivers/metadata:tests $ fx build
Run unit tests with the command:
$ fx test metadata_example_test