-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/cpp-app-passthrough' of https://github.com/rdkc…
…entral/firebolt-openrpc into feature/cpp-app-passthrough
- Loading branch information
Showing
16 changed files
with
119 additions
and
63 deletions.
There are no files selected for viewing
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
47 changes: 47 additions & 0 deletions
47
languages/cpp/templates/codeblocks/interface-focusable.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,47 @@ | ||
static void ProviderInvokeSession(std::string& methodName, JsonObject& jsonParameters, Firebolt::Error *err = nullptr) | ||
{ | ||
Firebolt::Error status = Firebolt::Error::NotConnected; | ||
FireboltSDK::Transport<WPEFramework::Core::JSON::IElement>* transport = FireboltSDK::Accessor::Instance().GetTransport(); | ||
if (transport != nullptr) { | ||
|
||
JsonObject jsonResult; | ||
status = transport->Invoke(methodName, jsonParameters, jsonResult); | ||
if (status == Firebolt::Error::None) { | ||
FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module<FireboltSDK::Accessor>(), "%s is successfully invoked", methodName.c_str()); | ||
} | ||
|
||
} 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; | ||
} | ||
} | ||
static void ProviderFocusSession(std::string methodName, std::string& correlationId, Firebolt::Error *err = nullptr) | ||
{ | ||
JsonObject jsonParameters; | ||
WPEFramework::Core::JSON::Variant CorrelationId(correlationId); | ||
jsonParameters.Set(_T("correlationId"), CorrelationId); | ||
|
||
ProviderInvokeSession(methodName, jsonParameters, err); | ||
} | ||
static void ProviderResultSession(std::string methodName, std::string& correlationId, ${provider.xresponse.name} result, Firebolt::Error *err = nullptr) | ||
{ | ||
JsonObject jsonParameters; | ||
WPEFramework::Core::JSON::Variant CorrelationId(correlationId); | ||
jsonParameters.Set(_T("correlationId"), CorrelationId); | ||
|
||
${provider.xresponse.serialization} | ||
ProviderInvokeSession(methodName, jsonParameters, err); | ||
} | ||
static void ProviderErrorSession(std::string methodName, std::string& correlationId, ${provider.xerror.name} result, Firebolt::Error *err = nullptr) | ||
{ | ||
JsonObject jsonParameters; | ||
WPEFramework::Core::JSON::Variant CorrelationId(correlationId); | ||
jsonParameters.Set(_T("correlationId"), CorrelationId); | ||
|
||
${provider.xerror.serialization} | ||
ProviderInvokeSession(methodName, jsonParameters, err); | ||
} | ||
|
||
${methods} |
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,12 @@ | ||
struct I${info.Title}Session : virtual public IFocussableProviderSession { | ||
virtual ~I${info.Title}Session() override = default; | ||
|
||
virtual void error( ${provider.xerror.name} error, Firebolt::Error *err = nullptr ) = 0; | ||
virtual void result( ${provider.xresponse.name} result, Firebolt::Error *err = nullptr ) = 0; | ||
}; | ||
|
||
struct I${info.Title}Provider { | ||
virtual ~I${info.Title}Provider() = default; | ||
|
||
${methods} | ||
}; |
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
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
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
12 changes: 6 additions & 6 deletions
12
languages/cpp/templates/result-instantiation/sub-property/array.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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
${if.optional}if (jsonResult${Property.dependency}.${Property}.IsSet()) { | ||
${base.title}Result${level}${property.dependency}${if.impl.optional}.value()${end.if.impl.optional}.${property} = std::make_optional<${type}>(); | ||
auto index(jsonResult${Property.dependency}.${Property}.Elements()); | ||
while (index.Next() == true) { | ||
${if.object}${items.with.indent}${end.if.object}${if.non.object} ${base.title}Result${level}.${property}.value().push_back(index.Current().Value());${end.if.non.object} | ||
auto ${property}Index(jsonResult${Property.dependency}.${Property}.Elements()); | ||
while (${property}Index.Next() == true) { | ||
${if.object}${items.with.indent}${end.if.object}${if.non.object} ${base.title}Result${level}.${property}.value().push_back(${property}Index.Current().Value());${end.if.non.object} | ||
} | ||
}${end.if.optional}${if.non.optional}auto index(jsonResult.${Property}.Elements()); | ||
while (index.Next() == true) { | ||
${if.object}${items.with.indent}${end.if.object}${if.non.object} ${base.title}Result${level}.${property}.push_back(index.Current().Value());${end.if.non.object} | ||
}${end.if.optional}${if.non.optional}auto ${property}Index(jsonResult.${Property}.Elements()); | ||
while (${property}Index.Next() == true) { | ||
${if.object}${items.with.indent}${end.if.object}${if.non.object} ${base.title}Result${level}.${property}.push_back(${property}Index.Current().Value());${end.if.non.object} | ||
}${end.if.non.optional} |
4 changes: 2 additions & 2 deletions
4
languages/cpp/templates/result-instantiation/sub-property/object-array.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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
${type} ${property}Result${level}; | ||
${if.namespace.notsame}Firebolt::${info.Title}::${end.if.namespace.notsame}JsonData_${title} jsonResult = index.Current(); | ||
${if.namespace.notsame}Firebolt::${info.Title}::${end.if.namespace.notsame}JsonData_${title} jsonResult = ${property}Index.Current(); | ||
{ | ||
${properties} | ||
} | ||
${base.title}Result${property.dependency}${if.impl.optional}.value()${end.if.impl.optional}.${property}->push_back(${property}Result${level}); | ||
${base.title}Result${property.dependency}${if.impl.optional}.value()${end.if.impl.optional}.${property}.push_back(${property}Result${level}); |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#!/bin/bash | ||
set -e | ||
usage() | ||
{ | ||
echo "options:" | ||
|
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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