diff --git a/components/control/cpp/include/ftl/master.hpp b/components/control/cpp/include/ftl/master.hpp index 641dfa756d7073fcb580429e8af5d74ed2a37091..c4782d16ea09928df9d8d3ca5273d84f5a86cf1c 100644 --- a/components/control/cpp/include/ftl/master.hpp +++ b/components/control/cpp/include/ftl/master.hpp @@ -58,6 +58,8 @@ class Master { ftl::config::json_t get(const ftl::UUID &peer, const std::string &uri); + ftl::config::json_t getConfigurable(const ftl::UUID &peer, const std::string &uri); + void watch(const std::string &uri, std::function<void()> f); Eigen::Matrix4d getPose(const std::string &uri); diff --git a/components/control/cpp/src/master.cpp b/components/control/cpp/src/master.cpp index 13bf861570cb021fe7eacc2117d4b4409f053a18..059dfe9144a91d0a7d706de811ce353f0050a2ac 100644 --- a/components/control/cpp/src/master.cpp +++ b/components/control/cpp/src/master.cpp @@ -40,6 +40,10 @@ Master::Master(Configurable *root, Universe *net) return ftl::config::resolve(uri, false).dump(); }); + net->bind("get_configurable", [](const std::string &uri) -> std::string { + return ftl::config::find(uri)->getConfig().dump(); + }); + net->bind("list_configurables", []() { return ftl::config::list(); }); @@ -76,7 +80,7 @@ Master::Master(Configurable *root, Universe *net) for (auto c : cs) { //LOG(INFO) << "NET CONFIG: " << c; ftl::config::json_t *configuration = new ftl::config::json_t; - *configuration = get(peer, c); + *configuration = getConfigurable(peer, c); if (!configuration->empty()) { ftl::NetConfigurable *nc = new ftl::NetConfigurable(peer, c, *this, *configuration); peerConfigurables_[peer].push_back(nc); @@ -166,6 +170,10 @@ json_t Master::get(const ftl::UUID &peer, const string &uri) { return json_t::parse(net_->call<string>(peer, "get_cfg", uri)); } +json_t Master::getConfigurable(const ftl::UUID &peer, const string &uri) { + return json_t::parse(net_->call<string>(peer, "get_configurable", uri)); +} + void Master::watch(const string &uri, function<void()> f) { } diff --git a/components/net/cpp/src/net_configurable.cpp b/components/net/cpp/src/net_configurable.cpp index cf597c5c77eec05205b6bf0de3f360c7fac178b2..00852c666b1024b4c61b54b8f937ce88d07039e6 100644 --- a/components/net/cpp/src/net_configurable.cpp +++ b/components/net/cpp/src/net_configurable.cpp @@ -12,5 +12,5 @@ void ftl::NetConfigurable::inject(const std::string &name, nlohmann::json &value } void ftl::NetConfigurable::refresh() { - (*config_) = ctrl.get(peer, suri); + (*config_) = ctrl.getConfigurable(peer, suri); }