blob: 49bfdd006a09e1d171df9f53b403e1ef336f0499 [file] [log] [blame]
// Copyright 2022 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.
#ifndef SRC_DA7219_CONTROLLER_I2C_CONTROLLER_H_
#define SRC_DA7219_CONTROLLER_I2C_CONTROLLER_H_
#include <lib/driver/component/cpp/driver_cpp.h>
#include <lib/driver/component/cpp/service_client.h>
#include "i2c_server.h"
namespace test_i2c_controller {
// Sample driver that implements a `fuchsia.hardware.i2c` bus controller and
// emulates the behavior of an audio hardware codec device to interact with the
// da7219 driver.
class TestDa7219I2cController : public fdf::DriverBase {
public:
TestDa7219I2cController(fdf::DriverStartArgs start_args,
fdf::UnownedSynchronizedDispatcher driver_dispatcher)
: fdf::DriverBase("test-da7219-i2c-controller", std::move(start_args),
std::move(driver_dispatcher)) {}
virtual ~TestDa7219I2cController() = default;
zx::result<> Start() override;
private:
zx::result<> AddChild();
fidl::WireSharedClient<fuchsia_driver_framework::Node> node_;
fidl::WireSharedClient<fuchsia_driver_framework::NodeController> controller_;
std::shared_ptr<I2cDeviceServer> i2c_server_;
};
} // namespace test_i2c_controller
#endif // SRC_DA7219_CONTROLLER_I2C_CONTROLLER_H_