From bb569ae9c6dfe881e0190ba2e67c828b52dbc299 Mon Sep 17 00:00:00 2001 From: Keaton Sentak Date: Wed, 21 Aug 2024 20:35:00 -0400 Subject: [PATCH] revert metrics chnages --- package-lock.json | 2 +- package.json | 2 +- .../cpp/templates/Metrics/include/module.h | 36 ----------- .../cpp/templates/Metrics/src/module_impl.cpp | 59 +++++-------------- .../cpp/templates/Metrics/src/module_impl.h | 11 +--- 5 files changed, 21 insertions(+), 89 deletions(-) delete mode 100644 src/sdks/core/src/cpp/templates/Metrics/include/module.h diff --git a/package-lock.json b/package-lock.json index f4475cd8e..7e3f68944 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,7 @@ "devDependencies": { "@commitlint/cli": "^17.0.3", "@commitlint/config-conventional": "^17.0.3", - "@firebolt-js/openrpc": "rdkcentral/firebolt-openrpc#native-sdk-debug2", + "@firebolt-js/openrpc": "rdkcentral/firebolt-openrpc#native-sdk-debug-2", "@firebolt-js/schemas": "2.0.0", "@saithodev/semantic-release-backmerge": "^3.2.0", "@semantic-release/changelog": "^6.0.1", diff --git a/package.json b/package.json index db375e1fb..a474ecab1 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "devDependencies": { "@commitlint/cli": "^17.0.3", "@commitlint/config-conventional": "^17.0.3", - "@firebolt-js/openrpc": "rdkcentral/firebolt-openrpc#native-sdk-debug2", + "@firebolt-js/openrpc": "rdkcentral/firebolt-openrpc#native-sdk-debug-2", "@firebolt-js/schemas": "2.0.0", "@saithodev/semantic-release-backmerge": "^3.2.0", "@semantic-release/changelog": "^6.0.1", diff --git a/src/sdks/core/src/cpp/templates/Metrics/include/module.h b/src/sdks/core/src/cpp/templates/Metrics/include/module.h deleted file mode 100644 index ccca61a6a..000000000 --- a/src/sdks/core/src/cpp/templates/Metrics/include/module.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#include "error.h" -/* ${IMPORTS} */ - -${if.declarations}namespace Firebolt { -namespace ${info.Title} { -${if.enums} - -// Enums -/* ${ENUMS} */${end.if.enums} -${if.types} -// Types -/* ${TYPES} */${end.if.types} -${if.providers}/* ${PROVIDERS} */${end.if.providers}${if.xuses}/* ${XUSES} */${end.if.xuses} -${if.methods}struct I${info.Title} { - - virtual ~I${info.Title}() = default; - virtual bool ready( Firebolt::Error *err = nullptr ) = 0 ; - virtual bool signIn( Firebolt::Error *err = nullptr ) = 0 ; - virtual bool signOut( Firebolt::Error *err = nullptr ) = 0 ; - - // Methods & Events - /* ${METHODS:declarations} */ -};${end.if.methods} - -} //namespace ${info.Title} -}${end.if.declarations} - - - - - - - - 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..82e1638e7 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 @@ -18,95 +18,68 @@ #include "${info.title.lowercase}_impl.h" - ${if.implementations} namespace Firebolt { 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 ) + void ${info.Title}Impl::signIn() { 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); + 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.ready is successfully invoked"); - success = jsonResult.Value(); + FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "${info.Title.signIn is successfully invoked, status : %s", (jsonResult.Value() ? "true" : "false")); } } else { FIREBOLT_LOG_ERROR(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Error in getting Transport err = %d", status); } - if (err != nullptr) { - *err = status; - } - - return success; } - - /* signIn - Log a sign In event, called by Discovery.signIn(). */ - bool ${info.Title}Impl::signIn( Firebolt::Error *err ) + void ${info.Title}Impl::signOut() { 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); + 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(); + FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "${info.Title}.signOut is successfully invoked, status : %s", (jsonResult.Value() ? "true" : "false")); } } else { FIREBOLT_LOG_ERROR(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Error in getting Transport err = %d", status); } - 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 ) + void ${info.Title}Impl::ready() { 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); + 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.signOut is successfully invoked"); - success = jsonResult.Value(); + FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "${info.Title}.ready is successfully invoked, status : %s", (jsonResult.Value() ? "true" : "false")); } } else { FIREBOLT_LOG_ERROR(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Error in getting Transport err = %d", status); } - if (err != nullptr) { - *err = status; - } - - return success; } - // Methods /* ${METHODS} */ diff --git a/src/sdks/core/src/cpp/templates/Metrics/src/module_impl.h b/src/sdks/core/src/cpp/templates/Metrics/src/module_impl.h index 219803938..d22d80d90 100644 --- a/src/sdks/core/src/cpp/templates/Metrics/src/module_impl.h +++ b/src/sdks/core/src/cpp/templates/Metrics/src/module_impl.h @@ -20,7 +20,6 @@ #include "FireboltSDK.h" #include "IModule.h" - /* ${IMPORTS} */ #include "${info.title.lowercase}.h" @@ -42,13 +41,9 @@ namespace ${info.Title} { ~${info.Title}Impl() override = default; - - bool ready( Firebolt::Error *err = nullptr ) ; - bool signIn( Firebolt::Error *err = nullptr ) ; - bool signOut( Firebolt::Error *err = nullptr ) ; - - - + static void signIn(); + static void signOut(); + static void ready(); // Methods & Events /* ${METHODS:declarations-override} */ };${end.if.methods}