tree: f0e01f00b28a577995597c0847b9557ebae6336e [path history] [tgz]
  1. child/
  2. lib/
  3. parent/
  4. README.md
src/bind_library/README.md

Bind library code generation sample

This project is a sample of the bind library code generation feature. It contaains two drivers, a parent and child.

The parent driver creates a child node with some properties from the bind library's generated C++ library to showcase its usage in code.

The child driver will bind to this node by specifying in its bind rules the node properties the parent driver has specified.

Building

To build the driver components, run the following commands:

tools/bazel build --config=fuchsia_x64 //src/bind_library/parent:pkg
tools/bazel build --config=fuchsia_x64 //src/bind_library/child:pkg

Running

Use the following commands to load the driver components on a target device:

  1. Load the parent driver component:

    tools/bazel run --config=fuchsia_x64 //src/bind_library/parent:pkg.component
    
  2. Run the child driver component:

    tools/bazel run --config=fuchsia_x64 //src/bind_library/child:pkg.component
    
  3. Open the device log viewer:

    tools/ffx log --tags driver --filter universe-pkg-drivers
    

You should see the following logs:

[gizmo_server.h:38] Received TestingProtocol.Get request.
[child-driver.cc:29] Succeeded!

Source layout

  • parent/ — Source code of the parent driver component.
  • child/ — Source code of the child driver component.
  • lib/ — FIDL and bind libraries shared between the two components.