diff --git a/applications/vision/src/main.cpp b/applications/vision/src/main.cpp index ddaa3a28568cd349522d62a32b60dff4791f80c5..f26e43d59ebfd3283e629e2c690ed03360451508 100644 --- a/applications/vision/src/main.cpp +++ b/applications/vision/src/main.cpp @@ -294,6 +294,11 @@ int main(int argc, char **argv) { std::cout << "FTL Vision Node " << FTL_VERSION_LONG << std::endl; auto root = ftl::configure(argc, argv, "vision_default"); + root->restore("root", { + "uri", + "fps" + }); + // Use other GPU if available. //ftl::cuda::setDevice(ftl::cuda::deviceCount()-1); diff --git a/components/common/cpp/src/configuration.cpp b/components/common/cpp/src/configuration.cpp index a455a5c840733bf56da6078bd4b69380d76274e9..45428962b6cdfaf7a7ebc1e9d3c45d1ddee4ae30 100644 --- a/components/common/cpp/src/configuration.cpp +++ b/components/common/cpp/src/configuration.cpp @@ -657,14 +657,18 @@ Configurable *ftl::config::configure(ftl::config::json_t &cfg) { // Remove all $ keys from json static void stripJSON(nlohmann::json &j) { - for(auto &el : j.items()) { + auto items = j.items(); + for(auto i=items.begin(); i != items.end(); ) { + auto &el = *i; if (el.key()[0] == '$') { + ++i; j.erase(el.key()); continue; } if (el.value().is_structured()) { stripJSON(el.value()); } + ++i; } } diff --git a/components/common/cpp/src/uri.cpp b/components/common/cpp/src/uri.cpp index 14270640c62bf164febf691c2be21ca53733b9d6..768e6a6126bf9a23b45ef84ca6183d6f81e42ce5 100644 --- a/components/common/cpp/src/uri.cpp +++ b/components/common/cpp/src/uri.cpp @@ -200,7 +200,7 @@ void URI::setAttribute(const string &key, int value) { } void URI::to_json(nlohmann::json &json) { - std::string uri = getBaseURI(); + std::string uri = to_string(); if (m_frag.size() > 0) uri += std::string("#") + getFragment(); json["uri"] = uri; diff --git a/components/rgbd-sources/src/source.cpp b/components/rgbd-sources/src/source.cpp index 64d882a533598b65efccd16ad31974e6d156a2fa..cb2b04eec44ae860e9eb795c81cbc970fe349883 100644 --- a/components/rgbd-sources/src/source.cpp +++ b/components/rgbd-sources/src/source.cpp @@ -149,7 +149,9 @@ void Source::reset() { auto uristr = get<string>("uri"); if (!uristr) return; - restore(*uristr, { + ftl::URI uri(*uristr); + + restore(uri.getBaseURI(), { "min_depth", "max_depth", "name", @@ -161,6 +163,9 @@ void Source::reset() { "feed", "pipeline" }); + + uri.to_json(getConfig()); + impl_ = createImplementation(*uristr, this); }