Skip to content

Commit

Permalink
revert metrics chnages
Browse files Browse the repository at this point in the history
  • Loading branch information
ksentak committed Aug 22, 2024
1 parent 6612580 commit bb569ae
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 89 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
36 changes: 0 additions & 36 deletions src/sdks/core/src/cpp/templates/Metrics/include/module.h

This file was deleted.

59 changes: 16 additions & 43 deletions src/sdks/core/src/cpp/templates/Metrics/src/module_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<WPEFramework::Core::JSON::IElement>* 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<FireboltSDK::Accessor>(), "Metrics.ready is successfully invoked");
success = jsonResult.Value();
FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module<FireboltSDK::Accessor>(), "${info.Title.signIn is successfully invoked, status : %s", (jsonResult.Value() ? "true" : "false"));
}

} else {
FIREBOLT_LOG_ERROR(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module<FireboltSDK::Accessor>(), "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<WPEFramework::Core::JSON::IElement>* 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<FireboltSDK::Accessor>(), "Metrics.signOut is successfully invoked");
success = jsonResult.Value();
FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module<FireboltSDK::Accessor>(), "${info.Title}.signOut is successfully invoked, status : %s", (jsonResult.Value() ? "true" : "false"));
}

} else {
FIREBOLT_LOG_ERROR(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module<FireboltSDK::Accessor>(), "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<WPEFramework::Core::JSON::IElement>* 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<FireboltSDK::Accessor>(), "Metrics.signOut is successfully invoked");
success = jsonResult.Value();
FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module<FireboltSDK::Accessor>(), "${info.Title}.ready is successfully invoked, status : %s", (jsonResult.Value() ? "true" : "false"));
}

} else {
FIREBOLT_LOG_ERROR(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module<FireboltSDK::Accessor>(), "Error in getting Transport err = %d", status);
}
if (err != nullptr) {
*err = status;
}

return success;
}


// Methods
/* ${METHODS} */

Expand Down
11 changes: 3 additions & 8 deletions src/sdks/core/src/cpp/templates/Metrics/src/module_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include "FireboltSDK.h"
#include "IModule.h"

/* ${IMPORTS} */
#include "${info.title.lowercase}.h"

Expand All @@ -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}
Expand Down

0 comments on commit bb569ae

Please sign in to comment.