Skip to content

Commit

Permalink
RDK-45352 RDK-45346: Upgrade SkyXione-LLAMA & Xumo devices to use Thu…
Browse files Browse the repository at this point in the history
…nder R4.4.1 (rdkcentral#5116)

* RDK-45352 RDK-45346: Upgrade SkyXione-LLAMA & Xumo devices to use Thunder R4.4.1

Reason for change: Compilation Error Fixed of rdkservices plugins against Thunder R4.4.1
Test Procedure: Verify in Jenkin Build
Risks: High
Signed-off-by: Thamim Razith [email protected]

  Updated:   DeviceInfo/DeviceInfo.cpp
  Updated:   DeviceInfo/Module.h
  Updated:   Messenger/Module.h
  Updated:   Monitor/Monitor.h
  Updated:   OpenCDMi/FrameworkRPC.cpp
  Updated:   PersistentStore/Module.h
  Updated:   RDKShell/RDKShell.cpp
  Updated:   ResourceManager/ResourceManager.cpp
  Updated:   RustAdapter/LocalPlugin.cpp
  Updated:   RustAdapter/LocalPlugin.h
  Updated:   RustAdapter/RemotePlugin.cpp
  Updated:   RustAdapter/RemotePlugin.h
  Updated:   RustAdapter/RustAdapter.cpp
  Updated:   RustAdapter/RustAdapter.h
  Updated:   SecurityAgent/SecurityAgent.cpp
  Updated:   SecurityAgent/SecurityAgent.h
  Updated:   SystemServices/SystemServices.cpp
  Updated:   SystemServices/platformcaps/platformcapsdata.h
  Updated:   helpers/UtilsJsonRpc.h
  • Loading branch information
tabbas651 authored Apr 4, 2024
1 parent 9a2caf5 commit e3bf082
Show file tree
Hide file tree
Showing 18 changed files with 176 additions and 40 deletions.
2 changes: 1 addition & 1 deletion DeviceInfo/DeviceInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ namespace Plugin {
Core::SystemInfo& singleton(Core::SystemInfo::Instance());

systemInfo.Time = Core::Time::Now().ToRFC1123(true);
#if ((THUNDER_VERSION_MAJOR >= 4) && (THUNDER_VERSION_MINOR >= 4))
#if ((THUNDER_VERSION >= 4) && (THUNDER_VERSION_MINOR >= 4))
systemInfo.Version = _subSystem->Version() + _T("#") + _subSystem->BuildTreeHash();
#else
systemInfo.Version = _service->Version() + _T("#") + _subSystem->BuildTreeHash();
Expand Down
2 changes: 1 addition & 1 deletion DeviceInfo/Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#endif

#include <plugins/plugins.h>
#if ((THUNDER_VERSION_MAJOR >= 4) && (THUNDER_VERSION_MINOR == 4))
#if ((THUNDER_VERSION >= 4) && (THUNDER_VERSION_MINOR == 4))
#include <definitions/definitions.h>
#else
#include <interfaces/definitions.h>
Expand Down
2 changes: 1 addition & 1 deletion Messenger/Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#endif

#include <plugins/plugins.h>
#if ((THUNDER_VERSION_MAJOR >= 4) && (THUNDER_VERSION_MINOR == 4))
#if ((THUNDER_VERSION >= 4) && (THUNDER_VERSION_MINOR == 4))
#include <definitions/definitions.h>
#else
#include <interfaces/definitions.h>
Expand Down
2 changes: 1 addition & 1 deletion Monitor/Monitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ namespace Plugin {
_service = nullptr;
}

#if (THUNDER_VERSION_MAJOR >= 4)
#if (THUNDER_VERSION >= 4)
#if (THUNDER_VERSION_MINOR == 2)
void Activation(const string& name, PluginHost::IShell* service) override
{
Expand Down
2 changes: 1 addition & 1 deletion OpenCDMi/FrameworkRPC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ namespace Plugin {
: RPC::Communicator(source, _T(""), Core::ProxyType<Core::IIPCServer>(engine))
, _parentInterface(parentInterface)
{
#if ((THUNDER_VERSION_MAJOR == 2) || ((THUNDER_VERSION_MAJOR == 4) && (THUNDER_VERSION_MINOR == 2)))
#if ((THUNDER_VERSION == 2) || ((THUNDER_VERSION == 4) && (THUNDER_VERSION_MINOR == 2)))
engine->Announcements(Announcement());
#endif
Open(Core::infinite);
Expand Down
49 changes: 47 additions & 2 deletions RDKShell/RDKShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,11 @@ namespace WPEFramework {
private:
uint32_t mId { 0 };
std::string mCallSign { };
#if ((THUNDER_VERSION >= 4) && (THUNDER_VERSION_MINOR == 4))
PluginHost::ILocalDispatcher * dispatcher_ {nullptr};
#else
PluginHost::IDispatcher * dispatcher_ {nullptr};
#endif

Core::ProxyType<Core::JSONRPC::Message> Message() const
{
Expand Down Expand Up @@ -620,7 +624,11 @@ namespace WPEFramework {
: mCallSign(callsign)
{
if (service)
#if ((THUNDER_VERSION >= 4) && (THUNDER_VERSION_MINOR == 4))
dispatcher_ = service->QueryInterfaceByCallsign<PluginHost::ILocalDispatcher>(mCallSign);
#else
dispatcher_ = service->QueryInterfaceByCallsign<PluginHost::IDispatcher>(mCallSign);
#endif
}

JSONRPCDirectLink(PluginHost::IShell* service)
Expand Down Expand Up @@ -664,12 +672,49 @@ namespace WPEFramework {
ToMessage(parameters, message);

const uint32_t channelId = ~0;
#ifndef USE_THUNDER_R4
#if ((THUNDER_VERSION >= 4) && (THUNDER_VERSION_MINOR == 4))
uint32_t result = Core::ERROR_BAD_REQUEST;
string output;
Core::ProxyType<Core::JSONRPC::Message> resp;

if (dispatcher_ != nullptr)
{
PluginHost::ILocalDispatcher* localDispatcher = dispatcher_->Local();

ASSERT(localDispatcher != nullptr);

if (localDispatcher != nullptr)
result = dispatcher_->Invoke(channelId, message->Id.Value(), sThunderSecurityToken, message->Designator.Value(), message->Parameters.Value(),output);
dispatcher_->Release();
}

if ( (result != static_cast<uint32_t>(~0)) && ( (message->Id.IsSet()) || (result != Core::ERROR_NONE) ) )
{
resp = PluginHost::IFactories::Instance().JSONRPC();

if (message->Id.IsSet())
resp->Id = message->Id.Value();

if (result == Core::ERROR_NONE)
{
if (output.empty() == true)
resp->Result.Null(true);
else
resp->Result = output;
}
else
{
resp->Error.SetError(result);
if (output.empty() == false)
resp->Error.Text = output;
}
}
#elif (THUNDER_VERSION == 2)
auto resp = dispatcher_->Invoke(sThunderSecurityToken, channelId, *message);
#else
Core::JSONRPC::Context context(channelId, message->Id.Value(), sThunderSecurityToken) ;
auto resp = dispatcher_->Invoke(context, *message);
#endif /* USE_THUNDER_R4 */
#endif
if (resp->Error.IsSet()) {
std::cout << "Call failed: " << message->Designator.Value() << " error: " << resp->Error.Text.Value() << "\n";
return resp->Error.Code;
Expand Down
49 changes: 47 additions & 2 deletions ResourceManager/ResourceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,11 @@ namespace WPEFramework {
private:
uint32_t mId { 0 };
std::string mCallSign { };
#if ((THUNDER_VERSION >= 4) && (THUNDER_VERSION_MINOR == 4))
PluginHost::ILocalDispatcher * dispatcher_ {nullptr};
#else
PluginHost::IDispatcher * dispatcher_ {nullptr};
#endif

Core::ProxyType<Core::JSONRPC::Message> Message() const
{
Expand Down Expand Up @@ -312,7 +316,11 @@ namespace WPEFramework {
: mCallSign(callsign)
{
if (service)
#if ((THUNDER_VERSION >= 4) && (THUNDER_VERSION_MINOR == 4))
dispatcher_ = service->QueryInterfaceByCallsign<PluginHost::ILocalDispatcher>(mCallSign);
#else
dispatcher_ = service->QueryInterfaceByCallsign<PluginHost::IDispatcher>(mCallSign);
#endif
}

JSONRPCDirectLink(PluginHost::IShell* service)
Expand Down Expand Up @@ -356,12 +364,49 @@ namespace WPEFramework {
ToMessage(parameters, message);

const uint32_t channelId = ~0;
#ifndef USE_THUNDER_R4
#if ((THUNDER_VERSION >= 4) && (THUNDER_VERSION_MINOR == 4))
uint32_t result = Core::ERROR_BAD_REQUEST;
string output;
Core::ProxyType<Core::JSONRPC::Message> resp;

if (dispatcher_ != nullptr)
{
PluginHost::ILocalDispatcher* localDispatcher = dispatcher_->Local();

ASSERT(localDispatcher != nullptr);

if (localDispatcher != nullptr)
result = dispatcher_->Invoke(channelId, message->Id.Value(), sThunderSecurityToken, message->Designator.Value(), message->Parameters.Value(),output);
dispatcher_->Release();
}

if ( (result != static_cast<uint32_t>(~0)) && ( (message->Id.IsSet()) || (result != Core::ERROR_NONE) ) )
{
resp = PluginHost::IFactories::Instance().JSONRPC();

if (message->Id.IsSet())
resp->Id = message->Id.Value();

if (result == Core::ERROR_NONE)
{
if (output.empty() == true)
resp->Result.Null(true);
else
resp->Result = output;
}
else
{
resp->Error.SetError(result);
if (output.empty() == false)
resp->Error.Text = output;
}
}
#elif (THUNDER_VERSION == 2)
auto resp = dispatcher_->Invoke(sThunderSecurityToken, channelId, *message);
#else
Core::JSONRPC::Context context(channelId, message->Id.Value(), sThunderSecurityToken) ;
auto resp = dispatcher_->Invoke(context, *message);
#endif /* USE_THUNDER_R4 */
#endif
if (resp->Error.IsSet()) {
std::cout << "Call failed: " << message->Designator.Value() << " error: " << resp->Error.Text.Value() << "\n";
return resp->Error.Code;
Expand Down
8 changes: 4 additions & 4 deletions RustAdapter/LocalPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ WPEFramework::Plugin::Rust::LocalPlugin::SendTo(uint32_t channel_id, const char

#if JSON_RPC_CONTEXT

#if ((THUNDER_VERSION_MAJOR >= 4) && (THUNDER_VERSION_MINOR == 4))
#if ((THUNDER_VERSION >= 4) && (THUNDER_VERSION_MINOR == 4))
WPEFramework::Core::hresult
WPEFramework::Plugin::Rust::LocalPlugin::Invoke(ICallback* callback, const uint32_t channelId, const uint32_t id, const string& token, const string& method, const string& parameters, string& response)
{
Expand Down Expand Up @@ -240,7 +240,7 @@ WPEFramework::Core::ProxyType<WPEFramework::Core::JSONRPC::Message>
}
#endif

#if ((THUNDER_VERSION_MAJOR == 4) && (THUNDER_VERSION_MINOR == 4))
#if ((THUNDER_VERSION == 4) && (THUNDER_VERSION_MINOR == 4))
WPEFramework::Core::hresult WPEFramework::Plugin::Rust::LocalPlugin::Revoke(ICallback* callback)
{
return {};
Expand All @@ -253,7 +253,7 @@ WPEFramework::Core::hresult WPEFramework::Plugin::Rust::LocalPlugin::Validate(co
#endif


#if ((THUNDER_VERSION_MAJOR == 2) || ((THUNDER_VERSION_MAJOR == 4) && (THUNDER_VERSION_MINOR == 2)))
#if ((THUNDER_VERSION == 2) || ((THUNDER_VERSION == 4) && (THUNDER_VERSION_MINOR == 2)))
void
WPEFramework::Plugin::Rust::LocalPlugin::Activate(
WPEFramework::PluginHost::IShell *shell)
Expand Down Expand Up @@ -321,7 +321,7 @@ WPEFramework::Plugin::Rust::LocalPlugin::Information() const
return { };
}

#if ((THUNDER_VERSION_MAJOR >= 4) && (THUNDER_VERSION_MINOR == 2))
#if ((THUNDER_VERSION >= 4) && (THUNDER_VERSION_MINOR == 2))
void WPEFramework::Plugin::Rust::LocalPlugin::Close(const uint32_t channelId) /* override */
{
return;
Expand Down
10 changes: 5 additions & 5 deletions RustAdapter/LocalPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class LocalPlugin : public Rust::IPlugin
/**
* IDispatcher::Activate
*/
#if ((THUNDER_VERSION_MAJOR == 2) || ((THUNDER_VERSION_MAJOR == 4) && (THUNDER_VERSION_MINOR == 2)))
#if ((THUNDER_VERSION == 2) || ((THUNDER_VERSION == 4) && (THUNDER_VERSION_MINOR == 2)))
void Activate(PluginHost::IShell *shell) override;
/**
*
Expand All @@ -89,15 +89,15 @@ class LocalPlugin : public Rust::IPlugin
/**
* IDispatcher::Close
*/
#if ((THUNDER_VERSION_MAJOR >= 4) && (THUNDER_VERSION_MINOR == 2))
#if ((THUNDER_VERSION >= 4) && (THUNDER_VERSION_MINOR == 2))
void Close(const uint32_t channelId) override;
#endif /* THUNDER_VERSION */
/**
* WPEFramework::PluginHost::IDispatcher::Invoke
*/
#if JSON_RPC_CONTEXT

#if ((THUNDER_VERSION_MAJOR >= 4) && (THUNDER_VERSION_MINOR == 4))
#if ((THUNDER_VERSION >= 4) && (THUNDER_VERSION_MINOR == 4))
Core::hresult Invoke(ICallback* callback, const uint32_t channelId, const uint32_t id, const string& token, const string& method, const string& parameters, string& response ) override;
#else
Core::ProxyType<Core::JSONRPC::Message> Invoke(
Expand All @@ -110,7 +110,7 @@ class LocalPlugin : public Rust::IPlugin
const string& token, const uint32_t channelId, const Core::JSONRPC::Message& req) override;
#endif

#if ((THUNDER_VERSION_MAJOR >= 4) && (THUNDER_VERSION_MINOR == 4))
#if ((THUNDER_VERSION >= 4) && (THUNDER_VERSION_MINOR == 4))
Core::hresult Revoke(ICallback* callback) override;
Core::hresult Validate(const string& token, const string& method, const string& paramaters /* @restrict:(4M-1) */) const override;
#endif
Expand All @@ -121,7 +121,7 @@ class LocalPlugin : public Rust::IPlugin
Core::ProxyType<Core::JSON::IElement> Inbound(const uint32_t id,
const Core::ProxyType<Core::JSON::IElement> &element) override;

#if ((THUNDER_VERSION_MAJOR >= 4) && (THUNDER_VERSION_MINOR == 4))
#if ((THUNDER_VERSION >= 4) && (THUNDER_VERSION_MINOR == 4))
public:
WPEFramework::PluginHost::ILocalDispatcher* Local() override {
return nullptr; // Replace nullptr with your actual implementation.
Expand Down
6 changes: 3 additions & 3 deletions RustAdapter/RemotePlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ RemotePlugin::SendTo(uint32_t channel_id, const char *json)
}
#if JSON_RPC_CONTEXT

#if ((THUNDER_VERSION_MAJOR >= 4) && (THUNDER_VERSION_MINOR == 4))
#if ((THUNDER_VERSION >= 4) && (THUNDER_VERSION_MINOR == 4))
WPEFramework::Core::hresult RemotePlugin::Invoke(ICallback* callback, const uint32_t channelId, const uint32_t id, const string& token, const string& method, const string& parameters, string& response)
{
m_stream.SendInvoke(channelId, token, response);
Expand Down Expand Up @@ -127,7 +127,7 @@ RemotePlugin::Invoke(
}
#endif

#if ((THUNDER_VERSION_MAJOR == 2) || ((THUNDER_VERSION_MAJOR == 4) && (THUNDER_VERSION_MINOR == 2)))
#if ((THUNDER_VERSION == 2) || ((THUNDER_VERSION == 4) && (THUNDER_VERSION_MINOR == 2)))
void
RemotePlugin::Activate(
WPEFramework::PluginHost::IShell *shell)
Expand Down Expand Up @@ -189,7 +189,7 @@ RemotePlugin::Information() const
return { };
}

#if (THUNDER_VERSION_MAJOR >= 4)
#if (THUNDER_VERSION >= 4)
#if (THUNDER_VERSION_MINOR == 2)
void RemotePlugin::Close(const uint32_t channelId) /* override */
{
Expand Down
10 changes: 5 additions & 5 deletions RustAdapter/RemotePlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class RemotePlugin : public Rust::IPlugin
/**
* IDispatcher::Activate
*/
#if ((THUNDER_VERSION_MAJOR == 2) || ((THUNDER_VERSION_MAJOR == 4) && (THUNDER_VERSION_MINOR == 2)))
#if ((THUNDER_VERSION == 2) || ((THUNDER_VERSION == 4) && (THUNDER_VERSION_MINOR == 2)))
void Activate(PluginHost::IShell *shell) override;
/**
*
Expand All @@ -90,14 +90,14 @@ class RemotePlugin : public Rust::IPlugin
/**
* IDispatcher::Close
*/
#if ((THUNDER_VERSION_MAJOR >= 4) && (THUNDER_VERSION_MINOR == 2))
#if ((THUNDER_VERSION >= 4) && (THUNDER_VERSION_MINOR == 2))
void Close(const uint32_t channelId) override;
#endif

/**
* IDispatcher::Close
*/
#if ((THUNDER_VERSION_MAJOR >= 4 && THUNDER_VERSION_MINOR == 4))
#if ((THUNDER_VERSION >= 4 && THUNDER_VERSION_MINOR == 4))
Core::hresult Revoke(ICallback* callback) override;
Core::hresult Validate(const string& token, const string& method, const string& paramaters /* @restrict:(4M-1) */) const override;
#endif /* THUNDER_VERSION */
Expand All @@ -107,7 +107,7 @@ class RemotePlugin : public Rust::IPlugin
*/
#if JSON_RPC_CONTEXT

#if ((THUNDER_VERSION_MAJOR >= 4) && (THUNDER_VERSION_MINOR == 4))
#if ((THUNDER_VERSION >= 4) && (THUNDER_VERSION_MINOR == 4))
Core::hresult Invoke(ICallback* callback, const uint32_t channelId, const uint32_t id, const string& token, const string& method, const string& parameters, string& response ) override;
#else
Core::ProxyType<Core::JSONRPC::Message> Invoke(
Expand All @@ -126,7 +126,7 @@ class RemotePlugin : public Rust::IPlugin
const Core::ProxyType<Core::JSON::IElement> &element) override;

void onRead(const Response& rsp);
#if ((THUNDER_VERSION_MAJOR == 4) && (THUNDER_VERSION_MINOR == 4))
#if ((THUNDER_VERSION == 4) && (THUNDER_VERSION_MINOR == 4))
public:
WPEFramework::PluginHost::ILocalDispatcher* Local() override {
return nullptr; // Replace nullptr with your actual implementation.
Expand Down
8 changes: 4 additions & 4 deletions RustAdapter/RustAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ WPEFramework::Plugin::RustAdapter::Release() const

#if JSON_RPC_CONTEXT

#if ((THUNDER_VERSION_MAJOR == 4) && (THUNDER_VERSION_MINOR == 4))
#if ((THUNDER_VERSION == 4) && (THUNDER_VERSION_MINOR == 4))
WPEFramework::Core::hresult
WPEFramework::Plugin::RustAdapter::Invoke(ICallback* callback, const uint32_t channelId, const uint32_t id, const string& token, const string& method, const string& parameters, string& response )
{
Expand All @@ -126,7 +126,7 @@ WPEFramework::Core::ProxyType<WPEFramework::Core::JSONRPC::Message>
}
#endif

#if ((THUNDER_VERSION_MAJOR == 2) || ((THUNDER_VERSION_MAJOR == 4) && (THUNDER_VERSION_MINOR == 2)))
#if ((THUNDER_VERSION == 2) || ((THUNDER_VERSION == 4) && (THUNDER_VERSION_MINOR == 2)))
void
WPEFramework::Plugin::RustAdapter::Activate(
WPEFramework::PluginHost::IShell *shell)
Expand All @@ -153,15 +153,15 @@ WPEFramework::Plugin::RustAdapter::Detach(PluginHost::Channel &channel)
m_impl->Detach(channel);
}

#if ((THUNDER_VERSION_MAJOR == 4) && (THUNDER_VERSION_MINOR == 2))
#if ((THUNDER_VERSION == 4) && (THUNDER_VERSION_MINOR == 2))
void
WPEFramework::Plugin::RustAdapter::Close(const uint32_t channelId)
{
m_impl->Close(channelId);
}
#endif /* THUNDER_VERSION */

#if ((THUNDER_VERSION_MAJOR == 4) && (THUNDER_VERSION_MINOR == 4))
#if ((THUNDER_VERSION == 4) && (THUNDER_VERSION_MINOR == 4))
WPEFramework::Core::hresult WPEFramework::Plugin::RustAdapter::Revoke(ICallback* callback)
{
return {};
Expand Down
Loading

0 comments on commit e3bf082

Please sign in to comment.