/*
 * Copyright 2025 Free Software Foundation, Inc.
 *
 * This file is part of GNU Radio
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 *
 */

/***********************************************************************************/
/* This file is automatically generated using bindtool and can be manually edited  */
/* The following lines can be configured to regenerate this file during cmake      */
/* If manual edits are made, the following tags should be modified accordingly.    */
/* BINDTOOL_GEN_AUTOMATIC(0)                                                       */
/* BINDTOOL_USE_PYGCCXML(0)                                                        */
/* BINDTOOL_HEADER_FILE(rfnoc_mb_controller.h)                                     */
/* BINDTOOL_HEADER_FILE_HASH(88fe1cc893a3f179ee557b989f246846)                     */
/***********************************************************************************/

#include <pybind11/complex.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>

namespace py = pybind11;

#include <gnuradio/uhd/rfnoc_mb_controller.h>
// pydoc.h is automatically generated in the build directory
#include <rfnoc_mb_controller_pydoc.h>

void bind_rfnoc_mb_controller(py::module& m)
{

    using rfnoc_mb_controller = ::gr::uhd::rfnoc_mb_controller;


    py::class_<rfnoc_mb_controller,
               gr::block,
               gr::basic_block,
               std::shared_ptr<rfnoc_mb_controller>>(
        m, "rfnoc_mb_controller", D(rfnoc_mb_controller))

        .def(py::init(&rfnoc_mb_controller::make),
             py::arg("graph") = nullptr,
             py::arg("mb_index") = rfnoc_mb_controller::ALL_MBOARDS,
             D(rfnoc_mb_controller, make))

        // Constants
        .def_readonly_static("DEFAULT_MB_INDEX", &rfnoc_mb_controller::DEFAULT_MB_INDEX)
        .def_readonly_static("ALL_MBOARDS", &rfnoc_mb_controller::ALL_MBOARDS)

        // Graph and motherboard management
        .def("set_rfnoc_graph",
             &rfnoc_mb_controller::set_rfnoc_graph,
             py::arg("graph"),
             D(rfnoc_mb_controller, set_rfnoc_graph))

        .def("set_mb_index",
             &rfnoc_mb_controller::set_mb_index,
             py::arg("mb_index"),
             D(rfnoc_mb_controller, set_mb_index))

        .def("get_mb_index",
             &rfnoc_mb_controller::get_mb_index,
             D(rfnoc_mb_controller, get_mb_index))

        // Time source control
        .def("set_time_source",
             &rfnoc_mb_controller::set_time_source,
             py::arg("source"),
             D(rfnoc_mb_controller, set_time_source))

        .def("get_time_source",
             &rfnoc_mb_controller::get_time_source,
             D(rfnoc_mb_controller, get_time_source))

        .def("get_time_sources",
             &rfnoc_mb_controller::get_time_sources,
             D(rfnoc_mb_controller, get_time_sources))

        // Clock source control
        .def("set_clock_source",
             &rfnoc_mb_controller::set_clock_source,
             py::arg("source"),
             D(rfnoc_mb_controller, set_clock_source))

        .def("get_clock_source",
             &rfnoc_mb_controller::get_clock_source,
             D(rfnoc_mb_controller, get_clock_source))

        .def("get_clock_sources",
             &rfnoc_mb_controller::get_clock_sources,
             D(rfnoc_mb_controller, get_clock_sources))

        // Time synchronization
        .def("set_time_now",
             &rfnoc_mb_controller::set_time_now,
             py::arg("time"),
             py::arg("tk_idx") = 0,
             D(rfnoc_mb_controller, set_time_now))

        .def("set_time_next_pps",
             &rfnoc_mb_controller::set_time_next_pps,
             py::arg("time"),
             py::arg("tk_idx") = 0,
             D(rfnoc_mb_controller, set_time_next_pps))

        .def("get_time_now",
             &rfnoc_mb_controller::get_time_now,
             py::arg("tk_idx") = 0,
             D(rfnoc_mb_controller, get_time_now))

        .def("get_time_last_pps",
             &rfnoc_mb_controller::get_time_last_pps,
             py::arg("tk_idx") = 0,
             D(rfnoc_mb_controller, get_time_last_pps))

        // Synchronization
        .def("synchronize",
             &rfnoc_mb_controller::synchronize,
             py::arg("time"),
             D(rfnoc_mb_controller, synchronize))

        ;
}
