forked from rdkcentral/firebolt-apis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CPPSDK: templates added for metrics calls-metrics methods
- Loading branch information
1 parent
f98e970
commit 4fa5cb7
Showing
2 changed files
with
150 additions
and
0 deletions.
There are no files selected for viewing
98 changes: 98 additions & 0 deletions
98
src/sdks/core/src/cpp/templates/Metrics/src/module_impl.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/* | ||
* Copyright 2023 Comcast Cable Communications Management, LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include "${info.title.lowercase}_impl.h" | ||
|
||
${if.implementations} | ||
namespace Firebolt { | ||
namespace ${info.Title} { | ||
${if.providers} | ||
/* ${PROVIDERS} */${end.if.providers} | ||
void ${info.Title}Impl::signIn() | ||
{ | ||
Firebolt::Error status = Firebolt::Error::NotConnected; | ||
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); | ||
if (status == Firebolt::Error::None) { | ||
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); | ||
} | ||
} | ||
|
||
void ${info.Title}Impl::signOut() | ||
{ | ||
Firebolt::Error status = Firebolt::Error::NotConnected; | ||
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); | ||
if (status == Firebolt::Error::None) { | ||
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); | ||
} | ||
} | ||
|
||
void ${info.Title}Impl::ready() | ||
{ | ||
Firebolt::Error status = Firebolt::Error::NotConnected; | ||
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); | ||
if (status == Firebolt::Error::None) { | ||
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); | ||
} | ||
} | ||
|
||
// Methods | ||
/* ${METHODS} */ | ||
|
||
// Events | ||
/* ${EVENTS} */ | ||
|
||
}//namespace ${info.Title} | ||
}${end.if.implementations} | ||
${if.enums} | ||
|
||
namespace WPEFramework { | ||
|
||
|
||
/* ${ENUMS} */ | ||
|
||
}${end.if.enums} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright 2023 Comcast Cable Communications Management, LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "FireboltSDK.h" | ||
#include "IModule.h" | ||
/* ${IMPORTS} */ | ||
#include "${info.title.lowercase}.h" | ||
|
||
${if.implementations} | ||
namespace Firebolt { | ||
namespace ${info.Title} { | ||
${if.enums} | ||
|
||
/* ${ENUMS:json-types} */${end.if.enums} | ||
${if.types} | ||
// Types | ||
/* ${TYPES:json-types} */${end.if.types} | ||
${if.methods}class ${info.Title}Impl : public I${info.Title}, public IModule { | ||
|
||
public: | ||
${info.Title}Impl() = default; | ||
${info.Title}Impl(const ${info.Title}Impl&) = delete; | ||
${info.Title}Impl& operator=(const ${info.Title}Impl&) = delete; | ||
|
||
~${info.Title}Impl() override = default; | ||
|
||
static void signIn(); | ||
static void signOut(); | ||
static void ready(); | ||
// Methods & Events | ||
/* ${METHODS:declarations-override} */ | ||
};${end.if.methods} | ||
|
||
}//namespace ${info.Title} | ||
}${end.if.implementations} |