blob: f843064d4278ac63bf3dfa445a9186510e98b2f4 [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/driver2/driver2_cpp.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 driver::DriverBase {
public:
TestDa7219I2cController(driver::DriverStartArgs start_args,
fdf::UnownedDispatcher driver_dispatcher)
: driver::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_