diff --git a/src/sdks/core/src/cpp/templates/Device/src/module_impl.cpp b/src/sdks/core/src/cpp/templates/Device/src/module_impl.cpp index 076f78e8c..6af6bae90 100644 --- a/src/sdks/core/src/cpp/templates/Device/src/module_impl.cpp +++ b/src/sdks/core/src/cpp/templates/Device/src/module_impl.cpp @@ -17,6 +17,7 @@ */ #include "${info.title.lowercase}_impl.h" +#include "Gateway/Gateway.h" ${if.implementations} namespace Firebolt { @@ -30,23 +31,21 @@ namespace ${info.Title} { std::string version; Firebolt::Error status = Firebolt::Error::NotConnected; - FireboltSDK::Transport* transport = FireboltSDK::Accessor::Instance().GetTransport(); - if (transport != nullptr) { - - status = transport->Invoke("${info.title.lowercase}.version", jsonParameters, jsonResult); - if (status == Firebolt::Error::None) { - !jsonResult.IsSet() ? jsonResult.Clear() : (void)0; - !jsonResult.Sdk.IsSet() ? jsonResult.Sdk.Clear() : (void)0; - jsonResult.Sdk.Major = static_cast(${major}); - jsonResult.Sdk.Minor = static_cast(${minor}); - jsonResult.Sdk.Patch = static_cast(${patch}); - jsonResult.Sdk.Readable = "${readable}"; - jsonResult.ToString(version); - } + status = FireboltSDK::Gateway::Instance().Request("${info.title.lowercase}.version", jsonParameters, jsonResult); + if (status == Firebolt::Error::None) { + !jsonResult.IsSet() ? jsonResult.Clear() : (void)0; + !jsonResult.Sdk.IsSet() ? jsonResult.Sdk.Clear() : (void)0; + jsonResult.Sdk.Major = static_cast(${major}); + jsonResult.Sdk.Minor = static_cast(${minor}); + jsonResult.Sdk.Patch = static_cast(${patch}); + jsonResult.Sdk.Readable = "${readable}"; + jsonResult.ToString(version); + } - } else { - FIREBOLT_LOG_ERROR(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Error in getting Transport err = %d", status); + if (err != nullptr) { + *err = status; } + return version; } // Methods diff --git a/src/sdks/core/src/cpp/templates/Lifecycle/src/module_impl.cpp b/src/sdks/core/src/cpp/templates/Lifecycle/src/module_impl.cpp index 233d3f973..d601301ce 100644 --- a/src/sdks/core/src/cpp/templates/Lifecycle/src/module_impl.cpp +++ b/src/sdks/core/src/cpp/templates/Lifecycle/src/module_impl.cpp @@ -17,6 +17,7 @@ #include "${info.title.lowercase}_impl.h" +#include "Gateway/Gateway.h" ${if.implementations} namespace Firebolt { @@ -40,7 +41,7 @@ static void readyDispatcher(const void* result) { } // localCallback to update the state -static void onReadyInnerCallback(void* notification, const void* userData, void* jsonResponse ) +static void onReadyInnerCallback(void* notification, const void* userData, void* jsonResponse) { const LifecycleImpl* selfConst = static_cast(userData); LifecycleImpl* self = const_cast(selfConst); @@ -61,11 +62,9 @@ static void onReadyInnerCallback(void* notification, const void* userData, void* } } - - /* ready - Notify the platform that the app is ready */ -void ${info.Title}Impl::ready(Firebolt::Error *err) { +void ${info.Title}Impl::ready(Firebolt::Error *err) { Firebolt::Error status = Firebolt::Error::NotConnected; JsonObject jsonParameters; @@ -76,31 +75,22 @@ void ${info.Title}Impl::ready(Firebolt::Error *err) { status = FireboltSDK::Event::Instance().Prioritize("lifecycle.onInactive", jsonParameters, onReadyInnerCallback, (void*)nullptr, this); status = FireboltSDK::Event::Instance().Prioritize("lifecycle.onSuspended", jsonParameters, onReadyInnerCallback, (void*)nullptr, this); status = FireboltSDK::Event::Instance().Prioritize("lifecycle.onUnloading", jsonParameters, onReadyInnerCallback, (void*)nullptr, this); - - FireboltSDK::Transport* transport = FireboltSDK::Accessor::Instance().GetTransport(); - if (transport != nullptr) { - WPEFramework::Core::JSON::VariantContainer jsonResult; - status = transport->Invoke("lifecycle.ready", jsonParameters, jsonResult); - if (status == Firebolt::Error::None) { - FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Lifecycle.ready is successfully invoked"); - - WPEFramework::Core::ProxyType job = WPEFramework::Core::ProxyType(WPEFramework::Core::ProxyType::Create(readyDispatcher, nullptr)); - WPEFramework::Core::IWorkerPool::Instance().Submit(job); - } else { - FIREBOLT_LOG_ERROR(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Error in invoking lifecycle.ready: %d", status); - if (err != nullptr) { - *err = status; - } - } + WPEFramework::Core::JSON::VariantContainer jsonResult; + status = FireboltSDK::Gateway::Instance().Request("lifecycle.ready", jsonParameters, jsonResult); + if (status == Firebolt::Error::None) { + FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Lifecycle.ready is successfully invoked"); + + WPEFramework::Core::ProxyType job = WPEFramework::Core::ProxyType(WPEFramework::Core::ProxyType::Create(readyDispatcher, nullptr)); + WPEFramework::Core::IWorkerPool::Instance().Submit(job); } else { - FIREBOLT_LOG_ERROR(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Error in getting Transport err = %d", status); - if (err != nullptr) { - *err = status; - } + FIREBOLT_LOG_ERROR(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Error in invoking lifecycle.ready: %d", status); } -} + if (err != nullptr) { + *err = status; + } +} /* state - return the state of the app */ std::string ${info.Title}Impl::state(Firebolt::Error *err) { @@ -108,31 +98,25 @@ std::string ${info.Title}Impl::state(Firebolt::Error *err) { return currentState; } - - /* finished - Notify the platform that the app is done unloading */ -void ${info.Title}Impl::finished(Firebolt::Error *err) +void ${info.Title}Impl::finished(Firebolt::Error *err) { Firebolt::Error status = Firebolt::Error::NotConnected; - if(currentState == "unloading") - { - FireboltSDK::Transport* transport = FireboltSDK::Accessor::Instance().GetTransport(); - if (transport != nullptr) { - - JsonObject jsonParameters; - - WPEFramework::Core::JSON::VariantContainer jsonResult; - status = transport->Invoke("lifecycle.finished", jsonParameters, jsonResult); - if (status == Firebolt::Error::None) { - FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Lifecycle.finished is successfully invoked"); - - } - - } else { - FIREBOLT_LOG_ERROR(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Error in getting Transport err = %d", status); - } + if(currentState == "unloading") + { + JsonObject jsonParameters; + + WPEFramework::Core::JSON::VariantContainer jsonResult; + status = FireboltSDK::Gateway::Instance().Request("lifecycle.finished", jsonParameters, jsonResult); + if (status == Firebolt::Error::None) { + FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Lifecycle.finished is successfully invoked"); } + if (err != nullptr) { + *err = status; + } + } + return; } diff --git a/src/sdks/core/src/cpp/templates/Metrics/src/module_impl.cpp b/src/sdks/core/src/cpp/templates/Metrics/src/module_impl.cpp index 085c4173a..981402cd6 100644 --- a/src/sdks/core/src/cpp/templates/Metrics/src/module_impl.cpp +++ b/src/sdks/core/src/cpp/templates/Metrics/src/module_impl.cpp @@ -17,7 +17,7 @@ */ #include "${info.title.lowercase}_impl.h" - +#include "Gateway/Gateway.h" ${if.implementations} namespace Firebolt { @@ -25,26 +25,20 @@ namespace ${info.Title} { ${if.providers} /* ${PROVIDERS} */${end.if.providers} -/* ready - Inform the platform that your app is minimally usable. This method is called automatically by `Lifecycle.ready()` */ - bool ${info.Title}Impl::ready( Firebolt::Error *err ) + /* ready - Inform the platform that your app is minimally usable. This method is called automatically by `Lifecycle.ready()` */ + bool ${info.Title}Impl::ready( Firebolt::Error *err ) { Firebolt::Error status = Firebolt::Error::NotConnected; bool success = false; - FireboltSDK::Transport* transport = FireboltSDK::Accessor::Instance().GetTransport(); - if (transport != nullptr) { - - JsonObject jsonParameters; - - WPEFramework::Core::JSON::Boolean jsonResult; - status = transport->Invoke("${info.title.lowercase}.ready", jsonParameters, jsonResult); - if (status == Firebolt::Error::None) { - FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Metrics.ready is successfully invoked"); - success = jsonResult.Value(); - } - - } else { - FIREBOLT_LOG_ERROR(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Error in getting Transport err = %d", status); + + JsonObject jsonParameters; + WPEFramework::Core::JSON::Boolean jsonResult; + status = FireboltSDK::Gateway::Instance().Request("${info.title.lowercase}.ready", jsonParameters, jsonResult); + if (status == Firebolt::Error::None) { + FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Metrics.ready is successfully invoked"); + success = jsonResult.Value(); } + if (err != nullptr) { *err = status; } @@ -52,53 +46,41 @@ namespace ${info.Title} { return success; } - - /* signIn - Log a sign In event, called by Discovery.signIn(). */ - bool ${info.Title}Impl::signIn( Firebolt::Error *err ) + /* signIn - Log a sign In event, called by Discovery.signIn(). */ + bool ${info.Title}Impl::signIn( Firebolt::Error *err ) { Firebolt::Error status = Firebolt::Error::NotConnected; bool success = false; - FireboltSDK::Transport* transport = FireboltSDK::Accessor::Instance().GetTransport(); - if (transport != nullptr) { - - JsonObject jsonParameters; - - WPEFramework::Core::JSON::Boolean jsonResult; - status = transport->Invoke("${info.title.lowercase}.signIn", jsonParameters, jsonResult); - if (status == Firebolt::Error::None) { - FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Metrics.signOut is successfully invoked"); - success = jsonResult.Value(); - } - - } else { - FIREBOLT_LOG_ERROR(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Error in getting Transport err = %d", status); + + JsonObject jsonParameters; + WPEFramework::Core::JSON::Boolean jsonResult; + status = FireboltSDK::Gateway::Instance().Request("${info.title.lowercase}.signIn", jsonParameters, jsonResult); + if (status == Firebolt::Error::None) { + FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Metrics.signOut is successfully invoked"); + success = jsonResult.Value(); } + if (err != nullptr) { *err = status; } return success; - } + } + /* signOut - Log a sign out event, called by Discovery.signOut(). */ - bool ${info.Title}Impl::signOut( Firebolt::Error *err ) + bool ${info.Title}Impl::signOut( Firebolt::Error *err ) { Firebolt::Error status = Firebolt::Error::NotConnected; bool success = false; - FireboltSDK::Transport* transport = FireboltSDK::Accessor::Instance().GetTransport(); - if (transport != nullptr) { - - JsonObject jsonParameters; - - WPEFramework::Core::JSON::Boolean jsonResult; - status = transport->Invoke("${info.title.lowercase}.signOut", jsonParameters, jsonResult); - if (status == Firebolt::Error::None) { - FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Metrics.signOut is successfully invoked"); - success = jsonResult.Value(); - } - - } else { - FIREBOLT_LOG_ERROR(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Error in getting Transport err = %d", status); + + JsonObject jsonParameters; + WPEFramework::Core::JSON::Boolean jsonResult; + status = FireboltSDK::Gateway::Instance().Request("${info.title.lowercase}.signOut", jsonParameters, jsonResult); + if (status == Firebolt::Error::None) { + FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Metrics.signOut is successfully invoked"); + success = jsonResult.Value(); } + if (err != nullptr) { *err = status; } diff --git a/src/sdks/discovery/src/cpp/templates/Content/src/module_impl.cpp b/src/sdks/discovery/src/cpp/templates/Content/src/module_impl.cpp index 1b174038b..3a32ad503 100644 --- a/src/sdks/discovery/src/cpp/templates/Content/src/module_impl.cpp +++ b/src/sdks/discovery/src/cpp/templates/Content/src/module_impl.cpp @@ -17,6 +17,7 @@ */ #include "${info.title.lowercase}_impl.h" +#include "Gateway/Gateway.h" ${if.implementations} namespace Firebolt { @@ -30,162 +31,157 @@ namespace ${info.Title} { { Firebolt::Error status = Firebolt::Error::NotConnected; InterestResult interest; - FireboltSDK::Transport* transport = FireboltSDK::Accessor::Instance().GetTransport(); - if (transport != nullptr) { - JsonObject jsonParameters; - Firebolt::Discovery::JsonData_InterestType jsonType = type; - WPEFramework::Core::JSON::Variant typeVariant(jsonType.Data()); - jsonParameters.Set(_T("type"), typeVariant); - Firebolt::Discovery::JsonData_InterestReason jsonReason = reason; - WPEFramework::Core::JSON::Variant reasonVariant(jsonReason.Data()); - jsonParameters.Set(_T("reason"), reasonVariant); - JsonData_InterestResult jsonResult; - status = transport->Invoke("content.requestUserInterest", jsonParameters, jsonResult); - if (status == Firebolt::Error::None) { - FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Content.requestUserInterest is successfully invoked"); - InterestResult interestResult; - interestResult.appId = jsonResult.AppId.Value(); - { - string identifiersStr; - jsonResult.Entity.Identifiers.ToString(identifiersStr); - interestResult.entity.identifiers = identifiersStr; - if (jsonResult.Entity.Info.IsSet()) { - interestResult.entity.info = std::make_optional(); - if (jsonResult.Entity.Info.Title.IsSet()) { - interestResult.entity.info.value().title = jsonResult.Entity.Info.Title; - } - if (jsonResult.Entity.Info.Synopsis.IsSet()) { - interestResult.entity.info.value().synopsis = jsonResult.Entity.Info.Synopsis; - } - if (jsonResult.Entity.Info.SeasonNumber.IsSet()) { - interestResult.entity.info.value().seasonNumber = jsonResult.Entity.Info.SeasonNumber; - } - if (jsonResult.Entity.Info.SeasonCount.IsSet()) { - interestResult.entity.info.value().seasonCount = jsonResult.Entity.Info.SeasonCount; - } - if (jsonResult.Entity.Info.EpisodeNumber.IsSet()) { - interestResult.entity.info.value().episodeNumber = jsonResult.Entity.Info.EpisodeNumber; - } - if (jsonResult.Entity.Info.EpisodeCount.IsSet()) { - interestResult.entity.info.value().episodeCount = jsonResult.Entity.Info.EpisodeCount; - } - if (jsonResult.Entity.Info.ReleaseDate.IsSet()) { - interestResult.entity.info.value().releaseDate = jsonResult.Entity.Info.ReleaseDate; - } - if (jsonResult.Entity.Info.ContentRatings.IsSet()) { - interestResult.entity.info.value().contentRatings = std::make_optional>(); - auto index(jsonResult.Entity.Info.ContentRatings.Elements()); - while (index.Next() == true) { - Entertainment::ContentRating contentRatingsResult1; - Firebolt::Entertainment::JsonData_ContentRating jsonResult = index.Current(); - { - contentRatingsResult1.scheme = jsonResult.Scheme; - contentRatingsResult1.rating = jsonResult.Rating; - if (jsonResult.Advisories.IsSet()) { - contentRatingsResult1.advisories = std::make_optional>(); - auto index(jsonResult.Advisories.Elements()); - while (index.Next() == true) { - contentRatingsResult1.advisories.value().push_back(index.Current().Value()); - } + JsonObject jsonParameters; + Firebolt::Discovery::JsonData_InterestType jsonType = type; + WPEFramework::Core::JSON::Variant typeVariant(jsonType.Data()); + jsonParameters.Set(_T("type"), typeVariant); + Firebolt::Discovery::JsonData_InterestReason jsonReason = reason; + WPEFramework::Core::JSON::Variant reasonVariant(jsonReason.Data()); + jsonParameters.Set(_T("reason"), reasonVariant); + JsonData_InterestResult jsonResult; + status = FireboltSDK::Gateway::Instance().Request("content.requestUserInterest", jsonParameters, jsonResult); + if (status == Firebolt::Error::None) { + FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Content.requestUserInterest is successfully invoked"); + InterestResult interestResult; + interestResult.appId = jsonResult.AppId.Value(); + { + string identifiersStr; + jsonResult.Entity.Identifiers.ToString(identifiersStr); + interestResult.entity.identifiers = identifiersStr; + if (jsonResult.Entity.Info.IsSet()) { + interestResult.entity.info = std::make_optional(); + if (jsonResult.Entity.Info.Title.IsSet()) { + interestResult.entity.info.value().title = jsonResult.Entity.Info.Title; + } + if (jsonResult.Entity.Info.Synopsis.IsSet()) { + interestResult.entity.info.value().synopsis = jsonResult.Entity.Info.Synopsis; + } + if (jsonResult.Entity.Info.SeasonNumber.IsSet()) { + interestResult.entity.info.value().seasonNumber = jsonResult.Entity.Info.SeasonNumber; + } + if (jsonResult.Entity.Info.SeasonCount.IsSet()) { + interestResult.entity.info.value().seasonCount = jsonResult.Entity.Info.SeasonCount; + } + if (jsonResult.Entity.Info.EpisodeNumber.IsSet()) { + interestResult.entity.info.value().episodeNumber = jsonResult.Entity.Info.EpisodeNumber; + } + if (jsonResult.Entity.Info.EpisodeCount.IsSet()) { + interestResult.entity.info.value().episodeCount = jsonResult.Entity.Info.EpisodeCount; + } + if (jsonResult.Entity.Info.ReleaseDate.IsSet()) { + interestResult.entity.info.value().releaseDate = jsonResult.Entity.Info.ReleaseDate; + } + if (jsonResult.Entity.Info.ContentRatings.IsSet()) { + interestResult.entity.info.value().contentRatings = std::make_optional>(); + auto index(jsonResult.Entity.Info.ContentRatings.Elements()); + while (index.Next() == true) { + Entertainment::ContentRating contentRatingsResult1; + Firebolt::Entertainment::JsonData_ContentRating jsonResult = index.Current(); + { + contentRatingsResult1.scheme = jsonResult.Scheme; + contentRatingsResult1.rating = jsonResult.Rating; + if (jsonResult.Advisories.IsSet()) { + contentRatingsResult1.advisories = std::make_optional>(); + auto index(jsonResult.Advisories.Elements()); + while (index.Next() == true) { + contentRatingsResult1.advisories.value().push_back(index.Current().Value()); } } - interestResult.entity.info.value().contentRatings->push_back(contentRatingsResult1); } + interestResult.entity.info.value().contentRatings->push_back(contentRatingsResult1); } } - if (jsonResult.Entity.WaysToWatch.IsSet()) { - interestResult.entity.waysToWatch = std::make_optional>(); - auto index(jsonResult.Entity.WaysToWatch.Elements()); - while (index.Next() == true) { - Entertainment::WayToWatch waysToWatchResult1; - Firebolt::Entertainment::JsonData_WayToWatch jsonResult = index.Current(); + } + if (jsonResult.Entity.WaysToWatch.IsSet()) { + interestResult.entity.waysToWatch = std::make_optional>(); + auto index(jsonResult.Entity.WaysToWatch.Elements()); + while (index.Next() == true) { + Entertainment::WayToWatch waysToWatchResult1; + Firebolt::Entertainment::JsonData_WayToWatch jsonResult = index.Current(); + { { - { - if (jsonResult.Identifiers.AssetId.IsSet()) { - waysToWatchResult1.identifiers.assetId = jsonResult.Identifiers.AssetId; - } - if (jsonResult.Identifiers.EntityId.IsSet()) { - waysToWatchResult1.identifiers.entityId = jsonResult.Identifiers.EntityId; - } - if (jsonResult.Identifiers.SeasonId.IsSet()) { - waysToWatchResult1.identifiers.seasonId = jsonResult.Identifiers.SeasonId; - } - if (jsonResult.Identifiers.SeriesId.IsSet()) { - waysToWatchResult1.identifiers.seriesId = jsonResult.Identifiers.SeriesId; - } - if (jsonResult.Identifiers.AppContentData.IsSet()) { - waysToWatchResult1.identifiers.appContentData = jsonResult.Identifiers.AppContentData; - } - } - if (jsonResult.Expires.IsSet()) { - waysToWatchResult1.expires = jsonResult.Expires; - } - if (jsonResult.Entitled.IsSet()) { - waysToWatchResult1.entitled = jsonResult.Entitled; + if (jsonResult.Identifiers.AssetId.IsSet()) { + waysToWatchResult1.identifiers.assetId = jsonResult.Identifiers.AssetId; } - if (jsonResult.EntitledExpires.IsSet()) { - waysToWatchResult1.entitledExpires = jsonResult.EntitledExpires; + if (jsonResult.Identifiers.EntityId.IsSet()) { + waysToWatchResult1.identifiers.entityId = jsonResult.Identifiers.EntityId; } - if (jsonResult.OfferingType.IsSet()) { - waysToWatchResult1.offeringType = jsonResult.OfferingType; + if (jsonResult.Identifiers.SeasonId.IsSet()) { + waysToWatchResult1.identifiers.seasonId = jsonResult.Identifiers.SeasonId; } - if (jsonResult.HasAds.IsSet()) { - waysToWatchResult1.hasAds = jsonResult.HasAds; + if (jsonResult.Identifiers.SeriesId.IsSet()) { + waysToWatchResult1.identifiers.seriesId = jsonResult.Identifiers.SeriesId; } - if (jsonResult.Price.IsSet()) { - waysToWatchResult1.price = jsonResult.Price; + if (jsonResult.Identifiers.AppContentData.IsSet()) { + waysToWatchResult1.identifiers.appContentData = jsonResult.Identifiers.AppContentData; } - if (jsonResult.VideoQuality.IsSet()) { - waysToWatchResult1.videoQuality = std::make_optional>(); - auto index(jsonResult.VideoQuality.Elements()); - while (index.Next() == true) { - waysToWatchResult1.videoQuality.value().push_back(index.Current().Value()); - } + } + if (jsonResult.Expires.IsSet()) { + waysToWatchResult1.expires = jsonResult.Expires; + } + if (jsonResult.Entitled.IsSet()) { + waysToWatchResult1.entitled = jsonResult.Entitled; + } + if (jsonResult.EntitledExpires.IsSet()) { + waysToWatchResult1.entitledExpires = jsonResult.EntitledExpires; + } + if (jsonResult.OfferingType.IsSet()) { + waysToWatchResult1.offeringType = jsonResult.OfferingType; + } + if (jsonResult.HasAds.IsSet()) { + waysToWatchResult1.hasAds = jsonResult.HasAds; + } + if (jsonResult.Price.IsSet()) { + waysToWatchResult1.price = jsonResult.Price; + } + if (jsonResult.VideoQuality.IsSet()) { + waysToWatchResult1.videoQuality = std::make_optional>(); + auto index(jsonResult.VideoQuality.Elements()); + while (index.Next() == true) { + waysToWatchResult1.videoQuality.value().push_back(index.Current().Value()); } - auto index(jsonResult.AudioProfile.Elements()); + } + auto index(jsonResult.AudioProfile.Elements()); + while (index.Next() == true) { + waysToWatchResult1.audioProfile.push_back(index.Current().Value()); + } + if (jsonResult.AudioLanguages.IsSet()) { + waysToWatchResult1.audioLanguages = std::make_optional>(); + auto index(jsonResult.AudioLanguages.Elements()); while (index.Next() == true) { - waysToWatchResult1.audioProfile.push_back(index.Current().Value()); - } - if (jsonResult.AudioLanguages.IsSet()) { - waysToWatchResult1.audioLanguages = std::make_optional>(); - auto index(jsonResult.AudioLanguages.Elements()); - while (index.Next() == true) { - waysToWatchResult1.audioLanguages.value().push_back(index.Current().Value()); - } + waysToWatchResult1.audioLanguages.value().push_back(index.Current().Value()); } - if (jsonResult.ClosedCaptions.IsSet()) { - waysToWatchResult1.closedCaptions = std::make_optional>(); - auto index(jsonResult.ClosedCaptions.Elements()); - while (index.Next() == true) { - waysToWatchResult1.closedCaptions.value().push_back(index.Current().Value()); - } + } + if (jsonResult.ClosedCaptions.IsSet()) { + waysToWatchResult1.closedCaptions = std::make_optional>(); + auto index(jsonResult.ClosedCaptions.Elements()); + while (index.Next() == true) { + waysToWatchResult1.closedCaptions.value().push_back(index.Current().Value()); } - if (jsonResult.Subtitles.IsSet()) { - waysToWatchResult1.subtitles = std::make_optional>(); - auto index(jsonResult.Subtitles.Elements()); - while (index.Next() == true) { - waysToWatchResult1.subtitles.value().push_back(index.Current().Value()); - } + } + if (jsonResult.Subtitles.IsSet()) { + waysToWatchResult1.subtitles = std::make_optional>(); + auto index(jsonResult.Subtitles.Elements()); + while (index.Next() == true) { + waysToWatchResult1.subtitles.value().push_back(index.Current().Value()); } - if (jsonResult.AudioDescriptions.IsSet()) { - waysToWatchResult1.audioDescriptions = std::make_optional>(); - auto index(jsonResult.AudioDescriptions.Elements()); - while (index.Next() == true) { - waysToWatchResult1.audioDescriptions.value().push_back(index.Current().Value()); - } + } + if (jsonResult.AudioDescriptions.IsSet()) { + waysToWatchResult1.audioDescriptions = std::make_optional>(); + auto index(jsonResult.AudioDescriptions.Elements()); + while (index.Next() == true) { + waysToWatchResult1.audioDescriptions.value().push_back(index.Current().Value()); } } - interestResult.entity.waysToWatch->push_back(waysToWatchResult1); } + interestResult.entity.waysToWatch->push_back(waysToWatchResult1); } } - interest = interestResult; } - - } else { - FIREBOLT_LOG_ERROR(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Error in getting Transport err = %d", status); + interest = interestResult; } + if (err != nullptr) { *err = status; }