Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## [0.7.1](https://github.com/rdkcentral/firebolt-cpp-client/compare/v0.7.0...v0.7.1)

### Added
- `Device.name` getter and `onNameChanged` event

### Changed
- **Breaking**: `Actions.start()` now takes the intent as a JSON string (`const std::string&`) instead of `const IntentData&`; malformed JSON returns `Error::InvalidParams` instead of throwing
- **Breaking**: `Firebolt::Actions::IntentData` and `IntentContext` have been removed; `Intent::intent` is now a `std::string` holding a JSON-serialized representation of the payload

### Fixed
- `TextToSpeech` event subscriptions (`onWillSpeak`, `onSpeechStart`, `onSpeechPause`, `onSpeechResume`, `onSpeechComplete`, `onSpeechInterrupted`, `onNetworkError`, etc.) used incorrect lowercase wire method names and never received platform events
Comment thread
swethasukumarr marked this conversation as resolved.

## [0.7.0](https://github.com/rdkcentral/firebolt-cpp-client/compare/v0.6.4...v0.7.0)

### Added
Expand Down
128 changes: 51 additions & 77 deletions docs/openrpc/the-spec/firebolt-open-rpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,25 +75,7 @@
"intentId"
],
"properties": {
"intent": {
"type": "object",
"required": [
"action"
],
"properties": {
"action": {
"type": "string"
},
"context": {
"type": "object",
"properties": {
"source": {
"type": "string"
}
}
}
}
},
"intent": {},
"intentId": {
"type": "integer",
"minimum": 0
Expand All @@ -111,6 +93,10 @@
"action": "pre-load",
"context": {
"source": "system"
},
"data": {
"ids": [1, "two", true, null],
"future": {"enabled": false}
}
},
"intentId": 0
Expand Down Expand Up @@ -153,25 +139,7 @@
"intentId"
],
"properties": {
"intent": {
"type": "object",
"required": [
"action"
],
"properties": {
"action": {
"type": "string"
},
"context": {
"type": "object",
"properties": {
"source": {
"type": "string"
}
}
}
}
},
"intent": {},
"intentId": {
"type": "integer",
"minimum": 0
Expand All @@ -195,6 +163,10 @@
"action": "pre-load",
"context": {
"source": "system"
},
"data": {
"ids": [1, "two", true, null],
"future": {"enabled": false}
}
},
"intentId": 0
Expand All @@ -219,25 +191,7 @@
"name": "intent",
"summary": "The intent to send, as a JSON document.",
"required": true,
"schema": {
"type": "object",
"required": [
"action"
],
"properties": {
"action": {
"type": "string"
},
"context": {
"type": "object",
"properties": {
"source": {
"type": "string"
}
}
}
}
}
"schema": {}
},
{
"name": "handlerAppId",
Expand All @@ -264,6 +218,10 @@
"action": "pre-load",
"context": {
"source": "system"
},
"data": {
"ids": [1, "two", true, null],
"future": {"enabled": false}
}
}
}
Expand Down Expand Up @@ -2685,7 +2643,7 @@
{
"name": "TextToSpeech.speak",
"summary": "Speak the utterance immediately. Any ongoing speech is interrupted.",
"description": "Text argument is either plain text or a well-formed SSML document TTS_status, not success attribute, to be used by caller to indicate success of call 0 OK, 1 Fail, 2 not enabled, 3 invalid configuration Raises onSpeechinterrupted if speaking is interrupted",
"description": "Text argument is either plain text or a well-formed SSML document TTS_status, not success attribute, to be used by caller to indicate success of call 0 OK, 1 Fail, 2 not enabled, 3 invalid configuration Raises onSpeechInterrupted if speaking is interrupted",
"params": [
{
"name": "text",
Expand Down Expand Up @@ -2803,7 +2761,7 @@
{
"name": "TextToSpeech.pause",
"summary": "Pauses the speech for given speech id",
"description": "Pauses the utterance. Raises onSpeechpause if ongoing speech is paused. Does nothing if utterance is already paused",
"description": "Pauses the utterance. Raises onSpeechPause if ongoing speech is paused. Does nothing if utterance is already paused",
"params": [
{
"name": "speechid",
Expand Down Expand Up @@ -2854,7 +2812,7 @@
{
"name": "TextToSpeech.resume",
"summary": "Resumes the speech for given speech id",
"description": "Continue the paused utterance. Raises onSpeechresume if paused speech is resumed. Does nothing if the utterance is not paused",
"description": "Continue the paused utterance. Raises onSpeechResume if paused speech is resumed. Does nothing if the utterance is not paused",
"params": [
{
"name": "speechid",
Expand Down Expand Up @@ -2905,7 +2863,7 @@
{
"name": "TextToSpeech.cancel",
"summary": "Cancels the speech for given speech id",
"description": "Stop speaking if utterance is currently being spoken. Raises onSpeechinterrupted if speaking was interrupted.",
"description": "Stop speaking if utterance is currently being spoken. Raises onSpeechInterrupted if speaking was interrupted.",
"params": [
{
"name": "speechid",
Expand Down Expand Up @@ -3526,14 +3484,16 @@
],
"result": {
"name": "result",
"value": null
"value": {
"speechid": 1
}
}
}
],
"result": {
"name": "result",
"schema": {
"type": "null"
"$ref": "#/components/schemas/SpeechIdEvent"
}
}
},
Expand Down Expand Up @@ -3574,14 +3534,16 @@
],
"result": {
"name": "result",
"value": null
"value": {
"speechid": 1
}
}
}
],
"result": {
"name": "result",
"schema": {
"type": "null"
"$ref": "#/components/schemas/SpeechIdEvent"
}
}
},
Expand Down Expand Up @@ -3622,14 +3584,16 @@
],
"result": {
"name": "result",
"value": null
"value": {
"speechid": 1
}
}
}
],
"result": {
"name": "result",
"schema": {
"type": "null"
"$ref": "#/components/schemas/SpeechIdEvent"
}
}
},
Expand Down Expand Up @@ -3670,14 +3634,16 @@
],
"result": {
"name": "result",
"value": null
"value": {
"speechid": 1
}
}
}
],
"result": {
"name": "result",
"schema": {
"type": "null"
"$ref": "#/components/schemas/SpeechIdEvent"
}
}
},
Expand Down Expand Up @@ -3718,14 +3684,16 @@
],
"result": {
"name": "result",
"value": null
"value": {
"speechid": 1
}
}
}
],
"result": {
"name": "result",
"schema": {
"type": "null"
"$ref": "#/components/schemas/SpeechIdEvent"
}
}
},
Expand Down Expand Up @@ -3766,14 +3734,16 @@
],
"result": {
"name": "result",
"value": null
"value": {
"speechid": 1
}
}
}
],
"result": {
"name": "result",
"schema": {
"type": "null"
"$ref": "#/components/schemas/SpeechIdEvent"
}
}
},
Expand Down Expand Up @@ -3814,14 +3784,16 @@
],
"result": {
"name": "result",
"value": null
"value": {
"speechid": 1
}
}
}
],
"result": {
"name": "result",
"schema": {
"type": "null"
"$ref": "#/components/schemas/SpeechIdEvent"
}
}
},
Expand Down Expand Up @@ -3862,14 +3834,16 @@
],
"result": {
"name": "result",
"value": null
"value": {
"speechid": 1
}
}
}
],
"result": {
"name": "result",
"schema": {
"type": "null"
"$ref": "#/components/schemas/SpeechIdEvent"
}
}
},
Expand Down
21 changes: 4 additions & 17 deletions include/firebolt/actions.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
//
// ============================================================================
// AUTO-GENERATED by fb-gen — DO NOT EDIT
// ============================================================================

Comment thread
swethasukumarr marked this conversation as resolved.
#ifndef FIREBOLT_ACTIONS_H
#define FIREBOLT_ACTIONS_H

Expand All @@ -31,20 +28,10 @@
namespace Firebolt::Actions
{

struct IntentContext
{
std::optional<std::string> source;
};

struct IntentData
{
std::string action;
std::optional<IntentContext> context;
};

// intent holds a JSON-serialized representation of the payload received from or sent to the platform.
struct Intent
{
IntentData intent;
std::string intent;
Comment thread
swethasukumarr marked this conversation as resolved.
uint32_t intentId{0};
};

Expand All @@ -64,7 +51,7 @@ class IActions
virtual Result<void> unsubscribe(SubscriptionId id) = 0;
virtual void unsubscribeAll() = 0;

[[nodiscard]] virtual Result<void> start(const IntentData& intent,
[[nodiscard]] virtual Result<void> start(const std::string& intent,
std::optional<std::string> handlerAppId = std::nullopt) const = 0;

}; // class IActions
Expand Down
21 changes: 12 additions & 9 deletions src/actions_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
//
// ============================================================================
// AUTO-GENERATED by fb-gen — DO NOT EDIT
// ============================================================================

Comment thread
swethasukumarr marked this conversation as resolved.
#include "actions_impl.h"
#include "json_types/actions.h"
#include <firebolt/json_types.h>
Expand All @@ -42,14 +39,20 @@ Result<SubscriptionId> ActionsImpl::subscribeOnIntent(std::function<void(const I
return subscriptionManager_.subscribe<JsonData::JsonValue>("Actions.onIntent", std::move(notification));
}

Result<void> ActionsImpl::start(const IntentData& intent, std::optional<std::string> handlerAppId) const
Result<void> ActionsImpl::start(const std::string& intent, std::optional<std::string> handlerAppId) const
{
nlohmann::json params;
params["intent"]["action"] = intent.action;
if (intent.context && intent.context->source)
nlohmann::json intentJson;
try
{
intentJson = nlohmann::json::parse(intent);
}
Comment thread
swethasukumarr marked this conversation as resolved.
catch (const nlohmann::json::parse_error&)
{
params["intent"]["context"]["source"] = *intent.context->source;
return Result<void>{Error::InvalidParams};
}

nlohmann::json params;
params["intent"] = std::move(intentJson);
if (handlerAppId)
{
params["handlerAppId"] = *handlerAppId;
Expand Down
Loading
Loading