-
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.
* fix: Added app-passthrough functionality for cpp sdk * cPP: Updates based on provider schema changes * CPP: Updates based on provider schema changes * fix: Make small adjustment to interface template and engine logic * fix: Revert changes that were being tested * feat: Pass config flag to types.mjs to modify schema title * fix: Update cpp templates for discoverySDK WIP * fix: Added support for players and fixed few provider issues * fix: Commented file permission code for debug * fix: Update templates to be more verbose * fix: Added version opt in include.sh * fix: Added set -e in build.sh * fix: Make focuable interface separate * fix: Comment out side-effect ridden code * fix: Added IModule.h in firebolt.cpp --------- Co-authored-by: HaseenaSainul <[email protected]> Co-authored-by: Shah, Kevin <[email protected]> Co-authored-by: kschrief <[email protected]>
- Loading branch information
1 parent
c5c049e
commit eeabccb
Showing
23 changed files
with
173 additions
and
77 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
${if.namespace.notsame}${parent.Title}::${end.if.namespace.notsame}${title} ${property}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,5 @@ | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
virtual void ${method.name}( ${method.signature.params}, IProviderSession& session ) = 0; | ||
virtual void ${method.name}( ${method.signature.params}, std::unique_ptr<IProviderSession> session ) = 0; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
${if.optional}if (${property}.has_value()) { | ||
${if.namespace.notsame}Firebolt::${info.Title}::${end.if.namespace.notsame}JsonData_${title} jsonValue = ${property}.value(); | ||
WPEFramework::Core::JSON::Variant ${property}Variant(jsonValue.Data()); | ||
${if.namespace.notsame}Firebolt::${info.Title}::${end.if.namespace.notsame}JsonData_${title} json${Property} = ${property}.value(); | ||
WPEFramework::Core::JSON::Variant ${property}Variant(json${Property}.Data()); | ||
jsonParameters.Set(_T("${property}"), ${property}Variant); | ||
}${end.if.optional}${if.non.optional}${if.namespace.notsame}Firebolt::${info.Title}::${end.if.namespace.notsame}JsonData_${title} jsonValue = ${property}; | ||
WPEFramework::Core::JSON::Variant ${property}Variant(jsonValue.Data()); | ||
}${end.if.optional}${if.non.optional}${if.namespace.notsame}Firebolt::${info.Title}::${end.if.namespace.notsame}JsonData_${title} json${Property} = ${property}; | ||
WPEFramework::Core::JSON::Variant ${property}Variant(json${Property}.Data()); | ||
jsonParameters.Set(_T("${property}"), ${property}Variant);${end.if.non.optional} |
16 changes: 8 additions & 8 deletions
16
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}.IsSet()) { | ||
${base.title}Result${level}.${property} = std::make_optional<${type}>(); | ||
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}.value().push_back(index.Current().Value());${end.if.non.object} | ||
${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 ${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} | ||
} | ||
${property}Result.${property}${if.impl.array.optional}.value()${end.if.impl.array.optional}.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
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
Oops, something went wrong.