diff --git a/CHANGELOG.md b/CHANGELOG.md index 479e710c1..1bbcfd0b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,71 @@ +## [1.3.1-next.1](https://github.com/rdkcentral/firebolt-apis/compare/v1.3.0...v1.3.1-next.1) (2024-08-19) + + +### Bug Fixes + +* Spec and Doc fixes ([#302](https://github.com/rdkcentral/firebolt-apis/issues/302)) ([6010a85](https://github.com/rdkcentral/firebolt-apis/commit/6010a85e9883480aba71378391f5b6223645fb28)) + +# [1.3.0](https://github.com/rdkcentral/firebolt-apis/compare/v1.2.0...v1.3.0) (2024-08-12) + + +### Bug Fixes + +* Added Lifecycle template in cpp ([#292](https://github.com/rdkcentral/firebolt-apis/issues/292)) ([046adc1](https://github.com/rdkcentral/firebolt-apis/commit/046adc18ca7f2d35d02b9ce597be6f330c3b1972)) +* Added Static Metrics template in CPP ([#293](https://github.com/rdkcentral/firebolt-apis/issues/293)) ([a1f75cb](https://github.com/rdkcentral/firebolt-apis/commit/a1f75cb22577c3eded0968ca51ca656336a88506)) +* **core, manage:** update C++ tests to run simultaneously for core and manage SDKs ([ef7bc4c](https://github.com/rdkcentral/firebolt-apis/commit/ef7bc4ce117cbce799ddab8c9b44522730374514)) +* Pointed to latest OpenRPC release ([#298](https://github.com/rdkcentral/firebolt-apis/issues/298)) ([16b3305](https://github.com/rdkcentral/firebolt-apis/commit/16b3305201624acf904c98d8c414b9756d42aaa7)) +* Small update to Manage SDK test ([#297](https://github.com/rdkcentral/firebolt-apis/issues/297)) ([95e3b0f](https://github.com/rdkcentral/firebolt-apis/commit/95e3b0f211f4a80d4573adc9c1b35d2e74a78777)) +* Sort capabilities in Firebolt Specification JSON ([46dd188](https://github.com/rdkcentral/firebolt-apis/commit/46dd1887e09cc3c75ebb7b41028b10b3a8d3596e)) +* Update to CHANGELOG.md for Release 1.3.0 ([9454527](https://github.com/rdkcentral/firebolt-apis/commit/9454527c684e6cfee3d9f99ad4c1c0fa8a6e4167)) + + +### Features + +* Add Metrics.appInfo API ([#294](https://github.com/rdkcentral/firebolt-apis/issues/294)) ([47264b5](https://github.com/rdkcentral/firebolt-apis/commit/47264b5c5c71fd117a52ca50f2e57315932905ad)) +* CPP App-Passthrough Logic ([#286](https://github.com/rdkcentral/firebolt-apis/issues/286)) ([4eb84ee](https://github.com/rdkcentral/firebolt-apis/commit/4eb84ee08c463915e3b13afec6603541ea0b1ae4)) + +# [1.3.0-next.4](https://github.com/rdkcentral/firebolt-apis/compare/v1.3.0-next.3...v1.3.0-next.4) (2024-08-09) + + +### Bug Fixes + +* Pointed to latest OpenRPC release ([#298](https://github.com/rdkcentral/firebolt-apis/issues/298)) ([16b3305](https://github.com/rdkcentral/firebolt-apis/commit/16b3305201624acf904c98d8c414b9756d42aaa7)) + +# [1.3.0-next.3](https://github.com/rdkcentral/firebolt-apis/compare/v1.3.0-next.2...v1.3.0-next.3) (2024-08-08) + + +### Bug Fixes + +* Small update to Manage SDK test ([#297](https://github.com/rdkcentral/firebolt-apis/issues/297)) ([95e3b0f](https://github.com/rdkcentral/firebolt-apis/commit/95e3b0f211f4a80d4573adc9c1b35d2e74a78777)) + +# [1.3.0-next.2](https://github.com/rdkcentral/firebolt-apis/compare/v1.3.0-next.1...v1.3.0-next.2) (2024-08-02) + + +### Features + +* Add Metrics.appInfo API ([#294](https://github.com/rdkcentral/firebolt-apis/issues/294)) ([47264b5](https://github.com/rdkcentral/firebolt-apis/commit/47264b5c5c71fd117a52ca50f2e57315932905ad)) + +# [1.3.0-next.1](https://github.com/rdkcentral/firebolt-apis/compare/v1.2.1-next.4...v1.3.0-next.1) (2024-07-29) + + +### Features + +* CPP App-Passthrough Logic ([#286](https://github.com/rdkcentral/firebolt-apis/issues/286)) ([4eb84ee](https://github.com/rdkcentral/firebolt-apis/commit/4eb84ee08c463915e3b13afec6603541ea0b1ae4)) + +## [1.2.1-next.4](https://github.com/rdkcentral/firebolt-apis/compare/v1.2.1-next.3...v1.2.1-next.4) (2024-07-29) + + +### Bug Fixes + +* Added Static Metrics template in CPP ([#293](https://github.com/rdkcentral/firebolt-apis/issues/293)) ([a1f75cb](https://github.com/rdkcentral/firebolt-apis/commit/a1f75cb22577c3eded0968ca51ca656336a88506)) + +## [1.2.1-next.3](https://github.com/rdkcentral/firebolt-apis/compare/v1.2.1-next.2...v1.2.1-next.3) (2024-07-29) + + +### Bug Fixes + +* Added Lifecycle template in cpp ([#292](https://github.com/rdkcentral/firebolt-apis/issues/292)) ([046adc1](https://github.com/rdkcentral/firebolt-apis/commit/046adc18ca7f2d35d02b9ce597be6f330c3b1972)) + ## [1.2.1-next.2](https://github.com/rdkcentral/firebolt-apis/compare/v1.2.1-next.1...v1.2.1-next.2) (2024-07-01) diff --git a/package-lock.json b/package-lock.json index 41a261d7f..8af224f25 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@firebolt-js/sdks", - "version": "1.2.1-next.2", + "version": "1.3.1-next.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@firebolt-js/sdks", - "version": "1.2.1-next.2", + "version": "1.3.1-next.1", "license": "Apache-2.0", "workspaces": [ "src/sdks/core", @@ -19,7 +19,7 @@ "devDependencies": { "@commitlint/cli": "^17.0.3", "@commitlint/config-conventional": "^17.0.3", - "@firebolt-js/openrpc": "3.0.0", + "@firebolt-js/openrpc": "3.1.0", "@firebolt-js/schemas": "2.0.0", "@saithodev/semantic-release-backmerge": "^3.2.0", "@semantic-release/changelog": "^6.0.1", @@ -1075,9 +1075,9 @@ "link": true }, "node_modules/@firebolt-js/openrpc": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@firebolt-js/openrpc/-/openrpc-3.0.0.tgz", - "integrity": "sha512-oHRHsIGoVFYYwGJwlY5BMaI8pEi2cd96JHcPX3SaB7ehbyI//v3QwJTcNKmvuUzTnqJzP0pEbHjgCnG+AZIvbg==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@firebolt-js/openrpc/-/openrpc-3.1.0.tgz", + "integrity": "sha512-OUbEInML9oF8d3P5brYN8iHUdfYxO5xBvnKm52ckyy6nJ7jYL2RJDobpeZa7flfeauuFXzkSK/ZMDtiOFxqQRg==", "dev": true, "dependencies": { "ajv": "^8.12.0", @@ -1103,15 +1103,15 @@ "dev": true }, "node_modules/@firebolt-js/openrpc/node_modules/ajv": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.16.0.tgz", - "integrity": "sha512-F0twR8U1ZU67JIEtekUcLkXkoO5mMMmgGD8sK/xUFzJ805jxHQl92hImFAqqXMyMYjSPOyUPAwHYhB72g5sTXw==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dev": true, "dependencies": { "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2", - "uri-js": "^4.4.1" + "require-from-string": "^2.0.2" }, "funding": { "type": "github", @@ -4797,6 +4797,12 @@ "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "dev": true }, + "node_modules/fast-uri": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.0.1.tgz", + "integrity": "sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw==", + "dev": true + }, "node_modules/fastq": { "version": "1.15.0", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", @@ -16956,7 +16962,7 @@ }, "src/sdks/core": { "name": "@firebolt-js/sdk", - "version": "1.2.0-next.5", + "version": "1.3.0", "license": "Apache-2.0", "devDependencies": { "jest": "^28.1.0", @@ -16967,7 +16973,7 @@ }, "src/sdks/discovery": { "name": "@firebolt-js/discovery-sdk", - "version": "1.2.0-next.2", + "version": "1.3.0", "license": "Apache-2.0", "devDependencies": { "jest": "^28.1.0", @@ -16978,7 +16984,7 @@ }, "src/sdks/manage": { "name": "@firebolt-js/manage-sdk", - "version": "1.2.0-next.5", + "version": "1.3.0", "license": "Apache-2.0", "devDependencies": { "jest": "^28.1.0", diff --git a/package.json b/package.json index 3c8b0f036..dc82211d3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@firebolt-js/sdks", - "version": "1.2.1-next.2", + "version": "1.3.1-next.1", "description": "The Firebolt JS SDK", "type": "module", "bin": { @@ -45,7 +45,7 @@ "devDependencies": { "@commitlint/cli": "^17.0.3", "@commitlint/config-conventional": "^17.0.3", - "@firebolt-js/openrpc": "3.0.0", + "@firebolt-js/openrpc": "3.1.0", "@firebolt-js/schemas": "2.0.0", "@saithodev/semantic-release-backmerge": "^3.2.0", "@semantic-release/changelog": "^6.0.1", diff --git a/src/json/firebolt-specification.json b/src/json/firebolt-specification.json index 13f662b93..568f4b9e4 100644 --- a/src/json/firebolt-specification.json +++ b/src/json/firebolt-specification.json @@ -147,9 +147,6 @@ "negotiable": false } }, - "xrn:firebolt:capability:privacy:advertising": { - "level": "could" - }, "xrn:firebolt:capability:metrics:distributor": { "level": "could" }, diff --git a/src/openrpc/_internal.json b/src/openrpc/_internal.json index 7f04a6dc1..a04b45e79 100644 --- a/src/openrpc/_internal.json +++ b/src/openrpc/_internal.json @@ -35,15 +35,7 @@ "name": "session", "summary": "Info about the SDK/FEE session", "schema": { - "type": "object", - "required": ["version"], - "properties": { - "version": { - "$ref": "https://meta.comcast.com/firebolt/types#/definitions/SemanticVersion", - "description": "The semantic version of the FEE." - } - }, - "additionalProperties": false + "$ref": "#/components/schemas/InitializeResult" } }, "examples": [ @@ -76,7 +68,19 @@ } ], "components": { - "schemas": { + "schemas": { + "InitializeResult": { + "title": "InitializeResult", + "type": "object", + "required": ["version"], + "properties": { + "version": { + "$ref": "https://meta.comcast.com/firebolt/types#/definitions/SemanticVersion", + "description": "The semantic version of the FEE." + } + }, + "additionalProperties": false + } } } } \ No newline at end of file diff --git a/src/openrpc/advertising.json b/src/openrpc/advertising.json index 22a86b312..20235446e 100644 --- a/src/openrpc/advertising.json +++ b/src/openrpc/advertising.json @@ -81,8 +81,7 @@ { "name": "capabilities", "x-uses": [ - "xrn:firebolt:capability:privacy:advertising", - "xrn:firebolt:capability:advertising:configuration" + "xrn:firebolt:capability:advertising:policy" ] } ], @@ -157,7 +156,7 @@ ] } ], - "summary": "Get the advertising ID", + "summary": "Get the IAB compliant identifier for advertising (IFA). It is recommended to use the IFA to manage advertising related activities while respecting the user's privacy settings.", "params": [ { "name": "options", @@ -172,21 +171,7 @@ "name": "advertisingId", "summary": "the advertising ID", "schema": { - "type": "object", - "properties": { - "ifa": { - "type": "string" - }, - "ifa_type": { - "type": "string" - }, - "lmt": { - "type": "string" - } - }, - "required": [ - "ifa" - ] + "$ref": "#/components/schemas/AdvertisingIdResult" } }, "examples": [ @@ -197,7 +182,7 @@ "name": "Default Result", "value": { "ifa": "01234567-89AB-CDEF-GH01-23456789ABCD", - "ifa_type": "idfa", + "ifa_type": "sspid", "lmt": "0" } } @@ -219,7 +204,7 @@ "name": "Default Result", "value": { "ifa": "01234567-89AB-CDEF-GH01-23456789ABCD", - "ifa_type": "idfa", + "ifa_type": "sspid", "lmt": "0" } } @@ -303,7 +288,7 @@ "params": [], "result": { "name": "Default Result", - "value": "operator.app" + "value": "app.operator" } } ] @@ -404,6 +389,33 @@ } } } + }, + "AdvertisingIdResult": { + "title": "AdvertisingIdResult", + "type": "object", + "properties": { + "ifa": { + "type": "string", + "description": "UUID conforming to IAB standard" + }, + "ifa_type": { + "type": "string", + "description": "source of the IFA as defined by IAB" + }, + "lmt": { + "type": "string", + "enum": [ + "0", + "1" + ], + "description": "boolean that if set to 1, user has requested ad tracking and measurement is disabled" + } + }, + "required": [ + "ifa", + "ifa_type", + "lmt" + ] } } } diff --git a/src/openrpc/authentication.json b/src/openrpc/authentication.json index 18a633183..977846b46 100644 --- a/src/openrpc/authentication.json +++ b/src/openrpc/authentication.json @@ -44,22 +44,7 @@ "name": "token", "summary": "the token value, type, and expiration", "schema": { - "type": "object", - "properties": { - "value": { - "type": "string" - }, - "expires": { - "type": "string", - "format": "date-time" - }, - "type": { - "type": "string" - } - }, - "required": [ - "value" - ] + "$ref": "#/components/schemas/AuthenticationTokenResult" } }, "examples": [ @@ -233,6 +218,25 @@ "device", "distributor" ] + }, + "AuthenticationTokenResult": { + "title": "AuthenticationTokenResult", + "type": "object", + "properties": { + "value": { + "type": "string" + }, + "expires": { + "type": "string", + "format": "date-time" + }, + "type": { + "type": "string" + } + }, + "required": [ + "value" + ] } } } diff --git a/src/openrpc/device.json b/src/openrpc/device.json index 04cdced4d..0dd8e11b4 100644 --- a/src/openrpc/device.json +++ b/src/openrpc/device.json @@ -292,34 +292,7 @@ "name": "versions", "summary": "the versions", "schema": { - "type": "object", - "properties": { - "sdk": { - "$ref": "https://meta.comcast.com/firebolt/types#/definitions/SemanticVersion", - "description": "The Firebolt SDK version" - }, - "api": { - "$ref": "https://meta.comcast.com/firebolt/types#/definitions/SemanticVersion", - "description": "The lateset Firebolt API version supported by the curent device." - }, - "firmware": { - "$ref": "https://meta.comcast.com/firebolt/types#/definitions/SemanticVersion", - "description": "The device firmware version." - }, - "os": { - "$ref": "https://meta.comcast.com/firebolt/types#/definitions/SemanticVersion", - "description": "**Deprecated** Use `firmware`, instead." - }, - "debug": { - "type": "string", - "description": "Detail version as a string, for debugging purposes" - } - }, - "required": [ - "api", - "firmware", - "os" - ] + "$ref": "#/components/schemas/DeviceVersion" } }, "examples": [ @@ -361,7 +334,7 @@ }, { "name": "hdcp", - "summary": "Get the supported HDCP profiles", + "summary": "Get the negotiated HDCP profiles for a connected device. \n\n For devices that do not require additional connections (e.g. panels), `true` will be returned for all profiles.", "params": [], "tags": [ { @@ -375,15 +348,15 @@ } ], "result": { - "name": "supportedHdcpProfiles", - "summary": "the supported HDCP profiles", + "name": "supportedHdcpVersions", + "summary": "the supported HDCP versions", "schema": { - "$ref": "https://meta.comcast.com/firebolt/types#/definitions/BooleanMap" + "$ref": "#/components/schemas/HDCPVersionMap" } }, "examples": [ { - "name": "Getting the supported HDCP profiles", + "name": "Getting the supported HDCP versions", "params": [], "result": { "name": "Default Result", @@ -397,7 +370,7 @@ }, { "name": "hdr", - "summary": "Get the supported HDR profiles", + "summary": "Get the negotiated HDR formats for the connected display and device", "params": [], "tags": [ { @@ -411,15 +384,15 @@ } ], "result": { - "name": "supportedHdrProfiles", - "summary": "the supported HDR profiles", + "name": "supportedHdrFormats", + "summary": "the supported HDR formats", "schema": { - "$ref": "https://meta.comcast.com/firebolt/types#/definitions/BooleanMap" + "$ref": "#/components/schemas/HDRFormatMap" } }, "examples": [ { - "name": "Getting the supported HDR profiles", + "name": "Getting the supported HDR formats", "params": [], "result": { "name": "Default Result", @@ -435,7 +408,7 @@ }, { "name": "audio", - "summary": "Get the supported audio profiles", + "summary": "Get the supported audio profiles for the connected devices. \n\n It is not recommended to use this API for visual badging on content within your app since this does not reflect the settings of the user.", "params": [], "tags": [ { @@ -473,7 +446,7 @@ }, { "name": "screenResolution", - "summary": "Get the current screen resolution", + "summary": "Get the resolution for the graphical surface of the app. \n\nThe pairs returned will be of a [width, height] format and will correspond to the following values: \n\nNTSC Standard Definition (SD): [720, 480] \n\nPAL Standard Definition (SD): [720, 576] \n\nHigh Definition (HD): [1280, 720] \n\nFull HD (FHD): [1920, 1080]\n\n4K Ultra High Definition (UHD): [3840, 2160]", "params": [], "tags": [ { @@ -509,7 +482,7 @@ }, { "name": "videoResolution", - "summary": "Get the current video resolution", + "summary": "Get the maximum supported video resolution of the currently connected device and display. \n\nThe pairs returned will be of a [width, height] format and will correspond to the following values: \n\nNTSC Standard Definition (SD): [720, 480] \n\nPAL Standard Definition (SD): [720, 576] \n\nHigh Definition (HD): [1280, 720] \n\nFull HD (FHD): [1920, 1080]\n\n4K Ultra High Definition (UHD): [3840, 2160]", "params": [], "tags": [ { @@ -641,19 +614,7 @@ "name": "networkInfo", "summary": "the status and type", "schema": { - "type": "object", - "properties": { - "state": { - "$ref": "#/components/schemas/NetworkState" - }, - "type": { - "$ref": "#/components/schemas/NetworkType" - } - }, - "required": [ - "state", - "type" - ] + "$ref": "#/components/schemas/NetworkInfoResult" } }, "examples": [ @@ -759,18 +720,98 @@ "components": { "schemas": { "Resolution": { - "type": "array", - "items": [ + "oneOf": [ + { + "type": "array", + "items": [ + { + "type": "integer", + "const": 720, + "description": "Width in pixels" + }, + { + "type": "integer", + "const": 480, + "description": "Height in pixels" + } + ], + "additionalItems": false, + "minItems": 2, + "maxItems": 2 + }, { - "type": "integer" + "type": "array", + "items": [ + { + "type": "integer", + "const": 720, + "description": "Width in pixels" + }, + { + "type": "integer", + "const": 576, + "description": "Height in pixels" + } + ], + "additionalItems": false, + "minItems": 2, + "maxItems": 2 + }, + { + "type": "array", + "items": [ + { + "type": "integer", + "const": 1280, + "description": "Width in pixels" + }, + { + "type": "integer", + "const": 720, + "description": "Height in pixels" + } + ], + "additionalItems": false, + "minItems": 2, + "maxItems": 2 + }, + { + "type": "array", + "items": [ + { + "type": "integer", + "const": 1920, + "description": "Width in pixels" + }, + { + "type": "integer", + "const": 1080, + "description": "Height in pixels" + } + ], + "additionalItems": false, + "minItems": 2, + "maxItems": 2 }, { - "type": "integer" + "type": "array", + "items": [ + { + "type": "integer", + "const": 3840, + "description": "Width in pixels" + }, + { + "type": "integer", + "const": 2160, + "description": "Height in pixels" + } + ], + "additionalItems": false, + "minItems": 2, + "maxItems": 2 } - ], - "additionalItems": false, - "minItems": 2, - "maxItems": 2 + ] }, "NetworkType": { "title": "NetworkType", @@ -793,16 +834,115 @@ }, "AudioProfiles": { "title": "AudioProfiles", - "allOf": [ - { - "$ref": "https://meta.comcast.com/firebolt/types#/definitions/BooleanMap" + "type": "object", + "properties": { + "stereo": { + "type": "boolean" }, - { - "type": "object", - "propertyNames": { - "$ref": "https://meta.comcast.com/firebolt/types#/definitions/AudioProfile" - } + "dolbyDigital5.1": { + "type": "boolean" + }, + "dolbyDigital5.1+": { + "type": "boolean" + }, + "dolbyAtmos": { + "type": "boolean" + } + }, + "required": [ + "stereo", + "dolbyDigital5.1", + "dolbyDigital5.1+", + "dolbyAtmos" + ] + }, + "HDRFormatMap": { + "title": "HDRFormatMap", + "type": "object", + "properties": { + "hdr10": { + "type": "boolean" + }, + "hdr10Plus": { + "type": "boolean" + }, + "dolbyVision": { + "type": "boolean" + }, + "hlg": { + "type": "boolean" } + }, + "required": [ + "hdr10", + "hdr10Plus", + "dolbyVision", + "hlg" + ], + "description": "The type of HDR format that is supported" + }, + "HDCPVersionMap": { + "title": "HDCPVersionMap", + "type": "object", + "properties": { + "hdcp1.4": { + "type": "boolean" + }, + "hdcp2.2": { + "type": "boolean" + } + }, + "required": [ + "hdcp1.4", + "hdcp2.2" + ], + "description": "The type of HDCP versions that is supported" + }, + "DeviceVersion": { + "title": "DeviceVersion", + "type": "object", + "properties": { + "sdk": { + "$ref": "https://meta.comcast.com/firebolt/types#/definitions/SemanticVersion", + "description": "The Firebolt SDK version" + }, + "api": { + "$ref": "https://meta.comcast.com/firebolt/types#/definitions/SemanticVersion", + "description": "The latest Firebolt API version supported by the current device." + }, + "firmware": { + "$ref": "https://meta.comcast.com/firebolt/types#/definitions/SemanticVersion", + "description": "The firmware version as reported by the device" + }, + "os": { + "$ref": "https://meta.comcast.com/firebolt/types#/definitions/SemanticVersion", + "description": "**Deprecated** Use `firmware`, instead." + }, + "debug": { + "type": "string", + "description": "Detailed version as a string, for debugging purposes" + } + }, + "required": [ + "api", + "firmware", + "os" + ] + }, + "NetworkInfoResult": { + "title": "NetworkInfoResult", + "type": "object", + "properties": { + "state": { + "$ref": "#/components/schemas/NetworkState" + }, + "type": { + "$ref": "#/components/schemas/NetworkType" + } + }, + "required": [ + "state", + "type" ] } } diff --git a/src/openrpc/discovery.json b/src/openrpc/discovery.json index c3706de03..01ab2205e 100644 --- a/src/openrpc/discovery.json +++ b/src/openrpc/discovery.json @@ -642,7 +642,7 @@ "name": "identifiers", "summary": "A set of content identifiers for this call to action", "schema": { - "$ref": "https://meta.comcast.com/firebolt/entity#/definitions/Entity" + "$ref": "https://meta.comcast.com/firebolt/entertainment#/definitions/ContentIdentifiers" }, "required": true }, diff --git a/src/openrpc/metrics.json b/src/openrpc/metrics.json index d3a9516c5..692245cbd 100644 --- a/src/openrpc/metrics.json +++ b/src/openrpc/metrics.json @@ -1064,7 +1064,50 @@ } } ] - } + }, + { + "name": "appInfo", + "tags": [ + { + "name": "capabilities", + "x-uses": [ + "xrn:firebolt:capability:metrics:general" + ] + } + ], + "summary": "Inform the platform about an app's build info.", + "params": [ + { + "name": "build", + "summary": "The build / version of this app.", + "schema": { + "type": "string" + }, + "required": true + } + ], + "result": { + "name": "result", + "schema": { + "type": "null" + } + }, + "examples": [ + { + "name": "Send appInfo metric", + "params": [ + { + "name": "build", + "value": "1.2.2" + } + ], + "result": { + "name": "result", + "value": null + } + } + ] + } ], "components": { "schemas": { diff --git a/src/schemas/accessibility.json b/src/schemas/accessibility.json index ce6ad419a..e274d8b91 100644 --- a/src/schemas/accessibility.json +++ b/src/schemas/accessibility.json @@ -100,8 +100,7 @@ "title": "ClosedCaptionsSettings", "type": "object", "required": [ - "enabled", - "styles" + "enabled" ], "properties": { "enabled": { @@ -152,8 +151,7 @@ "title": "VoiceGuidanceSettings", "type": "object", "required": [ - "enabled", - "speed" + "enabled" ], "properties": { "enabled": { diff --git a/src/schemas/types.json b/src/schemas/types.json index 0caa49c1f..5d5eed60e 100644 --- a/src/schemas/types.json +++ b/src/schemas/types.json @@ -36,9 +36,7 @@ "enum": [ "stereo", "dolbyDigital5.1", - "dolbyDigital7.1", "dolbyDigital5.1+", - "dolbyDigital7.1+", "dolbyAtmos" ] }, diff --git a/src/sdks/core/CHANGELOG.md b/src/sdks/core/CHANGELOG.md index 7946afebf..9e1be84f6 100644 --- a/src/sdks/core/CHANGELOG.md +++ b/src/sdks/core/CHANGELOG.md @@ -1,3 +1,11 @@ +# 1.3.0 (https://github.com/rdkcentral/firebolt-apis/compare/v1.2.0...v1.3.0) (2024-08-12) + +### Features + +* Add Metrics.appInfo API ([#294](https://github.com/rdkcentral/firebolt-apis/issues/294)) ([47264b5](https://github.com/rdkcentral/firebolt-apis/commit/47264b5c5c71fd117a52ca50f2e57315932905ad)) +* CPP App-Passthrough Logic ([#286](https://github.com/rdkcentral/firebolt-apis/issues/286)) ([4eb84ee](https://github.com/rdkcentral/firebolt-apis/commit/4eb84ee08c463915e3b13afec6603541ea0b1ae4)) +* OpenRPC version upgraded to 3.1.0 ([#298](https://github.com/rdkcentral/firebolt-apis/issues/298)) ([16b3305](https://github.com/rdkcentral/firebolt-apis/commit/16b3305201624acf904c98d8c414b9756d42aaa7)) + # 1.2.0 (https://github.com/rdkcentral/firebolt-apis/compare/v1.1.0...v1.2.0) (2024-06-14) ### Bug Fixes diff --git a/src/sdks/core/package.json b/src/sdks/core/package.json index b1d245e4f..57ae723a4 100644 --- a/src/sdks/core/package.json +++ b/src/sdks/core/package.json @@ -1,6 +1,6 @@ { "name": "@firebolt-js/sdk", - "version": "1.2.1-next.2", + "version": "1.3.1-next.1", "description": "The Firebolt JS SDK", "main": "./dist/lib/firebolt.mjs", "types": "./dist/lib/firebolt.d.ts", diff --git a/src/sdks/core/sdk.config.json b/src/sdks/core/sdk.config.json index 14ba4d55c..f34bf72c8 100644 --- a/src/sdks/core/sdk.config.json +++ b/src/sdks/core/sdk.config.json @@ -23,7 +23,7 @@ "use": [ "xrn:firebolt:capability:advertising:configuration", "xrn:firebolt:capability:advertising:identifier", - "xrn:firebolt:capability:privacy:advertising" + "xrn:firebolt:capability:advertising:policy" ] }, { diff --git a/src/sdks/core/src/cpp/sdk/cpptest/CoreSDKTest.cpp b/src/sdks/core/src/cpp/sdk/cpptest/CoreSDKTest.cpp index b5d35f16e..e50d394de 100644 --- a/src/sdks/core/src/cpp/sdk/cpptest/CoreSDKTest.cpp +++ b/src/sdks/core/src/cpp/sdk/cpptest/CoreSDKTest.cpp @@ -22,6 +22,7 @@ #include #include "CoreSDKTest.h" + using namespace std; bool CoreSDKTest::_connected; CoreSDKTest::OnPolicyChangedNotification CoreSDKTest::_policyChangedNotification; @@ -234,6 +235,18 @@ void CoreSDKTest::GetDeviceName() } } +void CoreSDKTest::GetDeviceVersion() +{ + Firebolt::Error error = Firebolt::Error::None; + const std::string version = Firebolt::IFireboltAccessor::Instance().DeviceInterface().version(&error); + + if (error == Firebolt::Error::None) { + cout << "Get Device Version = " << version.c_str() << endl; + } else { + cout << "Get Device Version status = " << static_cast(error) << endl; + } +} + void CoreSDKTest::OnDeviceNameChangedNotification::onDeviceNameChanged(const std::string& name) { cout << "Name changed, new name --> " << name << endl; @@ -715,7 +728,41 @@ EnumMap lifecycleEventSourceMap = { { Firebolt::Lifecycle::LifecycleEventSource::REMOTE, "remote" } }; -void CoreSDKTest::OnBackgroundNotification::onBackground(const Firebolt::Lifecycle::LifecycleEvent& lifecycleEvent) +void CoreSDKTest::LifecycleReady() +{ + Firebolt::Error error = Firebolt::Error::None; + Firebolt::IFireboltAccessor::Instance().LifecycleInterface().ready(&error); + if (error == Firebolt::Error::None) { + cout << "Lifecycle ready is success" << endl; + } else { + cout << "Lifecycle ready status = " << static_cast(error) << endl; + } +} + +void CoreSDKTest::LifecycleFinished() +{ + Firebolt::Error error = Firebolt::Error::None; + Firebolt::IFireboltAccessor::Instance().LifecycleInterface().finished(&error); + if (error == Firebolt::Error::None) { + cout << "Lifecycle finished is success" << endl; + } else { + cout << "Lifecycle finished status = " << static_cast(error) << endl; + } +} + +void CoreSDKTest::LifecycleState() +{ + Firebolt::Error error = Firebolt::Error::None; + const std::string state = Firebolt::IFireboltAccessor::Instance().LifecycleInterface().state(&error); + + if (error == Firebolt::Error::None) { + cout << "State of the App = " << state.c_str() << endl; + } else { + cout << "State of the App throws an error = " << static_cast(error) << endl; + } +} + +void CoreSDKTest::OnBackgroundNotification::onBackground( const Firebolt::Lifecycle::LifecycleEvent& lifecycleEvent) { cout <<"onBackground event is triggered" << endl; cout <<"\tstate: " << ConvertFromEnum(lifecycleStateMap, lifecycleEvent.state) << endl; @@ -1026,6 +1073,45 @@ void CoreSDKTest::MetricsStopContent() } } +void CoreSDKTest::MetricsReady() +{ + Firebolt::Error error = Firebolt::Error::None; + std::optional entityId; + bool status = Firebolt::IFireboltAccessor::Instance().MetricsInterface().ready(&error); + + if (error == Firebolt::Error::None) { + cout << "Metrics Ready status = " << (status ? "true" : "false") << endl; + } else { + cout << "Metrics Ready status = " << static_cast(error) << endl; + } +} + +void CoreSDKTest::MetricsSignIn() +{ + Firebolt::Error error = Firebolt::Error::None; + std::optional entityId; + bool status = Firebolt::IFireboltAccessor::Instance().MetricsInterface().signIn(&error); + + if (error == Firebolt::Error::None) { + cout << "Metrics signIn status = " << (status ? "true" : "false") << endl; + } else { + cout << "Metrics signIn status = " << static_cast(error) << endl; + } +} + +void CoreSDKTest::MetricsSignOut() +{ + Firebolt::Error error = Firebolt::Error::None; + std::optional entityId; + bool status = Firebolt::IFireboltAccessor::Instance().MetricsInterface().signOut(&error); + + if (error == Firebolt::Error::None) { + cout << "Metrics signOut status = " << (status ? "true" : "false") << endl; + } else { + cout << "Metrics signOut status = " << static_cast(error) << endl; + } +} + void CoreSDKTest::GetSecondScreenDevice() { Firebolt::Error error = Firebolt::Error::None; @@ -1242,6 +1328,32 @@ void CoreSDKTest::DiscoveryWatchNext() } } +void CoreSDKTest::DiscoveryUserInterest() +{ + Firebolt::Error error = Firebolt::Error::None; + Firebolt::Discovery::InterestType type = Firebolt::Discovery::InterestType::INTEREST; + Firebolt::Discovery::InterestReason reason = Firebolt::Discovery::InterestReason::PLAYLIST; + + // Set up the entity details + Firebolt::Entity::EntityDetails entity; + + // Identifiers + entity.identifiers = "{\"entityId\": \"123\"}"; + + // Optional Info Metadata + entity.info = Firebolt::Entity::Metadata(); + entity.info->title = "A Cool Show"; + entity.info->synopsis = "A cool show synopsis"; + + Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().userInterest(type, reason, entity, &error); + + if (error == Firebolt::Error::None) { + cout << "Discovery User Interest is success" << endl; + } else { + cout << "Discovery User Interest status = " << static_cast(error) << endl; + } +} + void CoreSDKTest::DiscoveryPolicy() { Firebolt::Error error = Firebolt::Error::None; @@ -1399,15 +1511,12 @@ void CoreSDKTest::DiscoveryPurchasedContent() void CoreSDKTest::DiscoveryLaunch() { Firebolt::Error error = Firebolt::Error::None; - cout << "Enter appId :"; - getchar(); - std::string appId; - getline(cin, appId); + std::string appId = "123"; { std::optional intent = std::make_optional(); intent.value().action = "tune"; intent.value().data.entity.entityType = "channel"; - intent.value().data.entity.channelType = Firebolt::Intents::ChannelEntityChannelType::STREAMING; + intent.value().data.entity.channelType = Firebolt::Entity::ChannelEntityChannelType::STREAMING; intent.value().data.entity.entityId = "an-ott-channel"; std::string entityId; std::optional appContentData; @@ -1416,6 +1525,7 @@ void CoreSDKTest::DiscoveryLaunch() intent.value().context.source = "voice"; cout << "Calling Discovery Launch TuneIntent method " << endl; bool status = Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().launch(appId, intent, &error); + if (error == Firebolt::Error::None) { cout << "Discovery Launch TuneIntent is " << (status ? "true" : "false") << endl; } else { @@ -1453,7 +1563,6 @@ void CoreSDKTest::DiscoveryLaunch() throw std::runtime_error("DiscoveryLaunch failed. " + errorMessage); } } - cin.putback('\n'); } #ifdef POLYMORPHICS_REDUCER_METHODS void CoreSDKTest::DiscoveryWatched() @@ -1567,4 +1676,4 @@ void CoreSDKTest::OnNavigateToEntityIntentNotification::onNavigateTo(const Fireb void CoreSDKTest::OnNavigateToTuneIntentNotification::onNavigateTo(const Firebolt::Intents::TuneIntent& intent) { cout << "onNavigateTo for action : " << intent.action << endl; -} +} \ No newline at end of file diff --git a/src/sdks/core/src/cpp/sdk/cpptest/CoreSDKTest.h b/src/sdks/core/src/cpp/sdk/cpptest/CoreSDKTest.h index 9b8d056ea..d25521043 100644 --- a/src/sdks/core/src/cpp/sdk/cpptest/CoreSDKTest.h +++ b/src/sdks/core/src/cpp/sdk/cpptest/CoreSDKTest.h @@ -92,6 +92,7 @@ class CoreSDKTest { static void GetAccountUid(); static void GetDeviceName(); + static void GetDeviceVersion(); static void SubscribeDeviceNameChanged(); static void UnsubscribeDeviceNameChanged(); static void GetDeviceModel(); @@ -131,6 +132,9 @@ class CoreSDKTest { static void GetProfileFlags(); static void LifecycleClose(); + static void LifecycleFinished(); + static void LifecycleReady(); + static void LifecycleState(); static void SubscribeLifecycleBackgroundNotification(); static void UnsubscribeLifecycleBackgroundNotification(); static void SubscribeLifecycleForegroundNotification(); @@ -151,6 +155,9 @@ class CoreSDKTest { static void MetricsStartContent(); static void MetricsStopContent(); + static void MetricsReady(); + static void MetricsSignIn(); + static void MetricsSignOut(); static void GetSecondScreenDevice(); static void GetSecondScreenProtocols(); @@ -174,6 +181,7 @@ class CoreSDKTest { static void SubscribeDiscoveryOnNavigateToLaunchNotification(); static void UnsubscribeDiscoveryOnNavigateToLaunchNotification(); static void DiscoveryWatchNext(); + static void DiscoveryUserInterest(); static void ParametersInitialization(); @@ -199,4 +207,3 @@ class CoreSDKTest { static KeyboardPasswordAsyncResponse _keyboardPasswordAsyncResponse; static KeyboardStandardAsyncResponse _keyboardStandardAsyncResponse; }; - diff --git a/src/sdks/core/src/cpp/sdk/cpptest/Main.cpp b/src/sdks/core/src/cpp/sdk/cpptest/Main.cpp index df361a238..5b235dadb 100644 --- a/src/sdks/core/src/cpp/sdk/cpptest/Main.cpp +++ b/src/sdks/core/src/cpp/sdk/cpptest/Main.cpp @@ -1,3 +1,21 @@ +/* + * 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 #include #include @@ -40,6 +58,7 @@ void RunAllTests() { runTest(CoreSDKTest::GetDeviceModel, "GetDeviceModel"); runTest(CoreSDKTest::GetDeviceSku, "GetDeviceSku"); runTest(CoreSDKTest::GetDeviceName, "GetDeviceName"); + runTest(CoreSDKTest::GetDeviceName, "GetDeviceVersion"); runTest(CoreSDKTest::SubscribeDeviceNameChanged, "SubscribeDeviceNameChanged"); runTest(CoreSDKTest::UnsubscribeDeviceNameChanged, "UnsubscribeDeviceNameChanged"); runTest(CoreSDKTest::GetDeviceAudio, "GetDeviceAudio"); @@ -89,14 +108,22 @@ void RunAllTests() { // Lifecycle methods // runTest(CoreSDKTest::LifecycleClose, "LifecycleClose"); + runTest(CoreSDKTest::LifecycleReady, "LifecycleReady"); + runTest(CoreSDKTest::LifecycleFinished, "LifecycleFinished"); + runTest(CoreSDKTest::LifecycleState, "LifecycleState"); runTest(CoreSDKTest::SubscribeLifecycleBackgroundNotification, "SubscribeLifecycleBackgroundNotification"); runTest(CoreSDKTest::UnsubscribeLifecycleBackgroundNotification, "UnsubscribeLifecycleBackgroundNotification"); runTest(CoreSDKTest::SubscribeLifecycleForegroundNotification, "SubscribeLifecycleForegroundNotification"); runTest(CoreSDKTest::UnsubscribeLifecycleForegroundNotification, "UnsubscribeLifecycleForegroundNotification"); // Metrics methods + runTest(CoreSDKTest::MetricsReady, "MetricsReady"); + runTest(CoreSDKTest::MetricsSignIn, "MetricsSignIn"); + runTest(CoreSDKTest::MetricsSignOut, "MetricsSignOut"); runTest(CoreSDKTest::MetricsStartContent, "MetricsStartContent"); runTest(CoreSDKTest::MetricsStopContent, "MetricsStopContent"); + + // SecondScreen methods runTest(CoreSDKTest::GetSecondScreenDevice, "GetSecondScreenDevice"); @@ -115,7 +142,7 @@ void RunAllTests() { runTest(CoreSDKTest::DiscoveryPolicy, "DiscoveryPolicy"); runTest(CoreSDKTest::DiscoveryPurchasedContent, "DiscoveryPurchasedContent"); runTest(CoreSDKTest::DiscoveryWatchNext, "DiscoveryWatchNext"); - // runTest(CoreSDKTest::DiscoveryLaunch, "DiscoveryLaunch"); + runTest(CoreSDKTest::DiscoveryLaunch, "DiscoveryLaunch"); #ifdef POLYMORPHICS_REDUCER_METHODS runTest(CoreSDKTest::DiscoveryWatched, "DiscoveryWatched"); runTest(CoreSDKTest::DiscoveryWatchedReduced, "DiscoveryWatchedReduced"); @@ -166,4 +193,4 @@ int main(int argc, char* argv[]) { CoreSDKTest::DestroyFireboltInstance(); return 0; -} +} \ No newline at end of file diff --git a/src/sdks/core/src/cpp/templates/Device/include/module.h b/src/sdks/core/src/cpp/templates/Device/include/module.h new file mode 100644 index 000000000..a4d42be2c --- /dev/null +++ b/src/sdks/core/src/cpp/templates/Device/include/module.h @@ -0,0 +1,37 @@ +/* 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 "error.h" +/* ${IMPORTS} */ + +${if.declarations} +namespace Firebolt { + namespace ${info.Title} { + ${if.enums}/* ${ENUMS} */${end.if.enums} + ${if.types}/* ${TYPES} */${end.if.types} + ${if.providers}/* ${PROVIDERS} */${end.if.providers}${if.xuses}/* ${XUSES} */${end.if.xuses} + ${if.methods}struct I${info.Title} { + // Methods & Events + /* ${METHODS:declarations} */ + virtual ~I${info.Title}() = default; + virtual std::string version( Firebolt::Error *err = nullptr ) const = 0; + }; + ${end.if.methods} + } //namespace ${info.Title} +} +${end.if.declarations} \ No newline at end of file diff --git a/src/sdks/core/src/cpp/templates/Device/src/module_impl.cpp b/src/sdks/core/src/cpp/templates/Device/src/module_impl.cpp new file mode 100644 index 000000000..242897d9d --- /dev/null +++ b/src/sdks/core/src/cpp/templates/Device/src/module_impl.cpp @@ -0,0 +1,65 @@ +/* + * 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} + std::string ${info.Title}Impl::version(Firebolt::Error *err) const + { + JsonObject jsonParameters; + JsonData_Versions jsonResult; + std::string version; + + Firebolt::Error status = Firebolt::Error::NotConnected; + FireboltSDK::Transport* transport = FireboltSDK::Accessor::Instance().GetTransport(); + if (transport != nullptr) { + + status = transport->Invoke("${info.title.lowercase}.version", jsonParameters, jsonResult); + if (status == Firebolt::Error::None) { + !jsonResult.IsSet() ? jsonResult.Clear() : (void)0; + !jsonResult.Sdk.IsSet() ? jsonResult.Sdk.Clear() : (void)0; + jsonResult.Sdk.Major = static_cast(${major}); + jsonResult.Sdk.Minor = static_cast(${minor}); + jsonResult.Sdk.Patch = static_cast(${patch}); + jsonResult.Sdk.Readable = "${readable}"; + jsonResult.ToString(version); + } + + } else { + FIREBOLT_LOG_ERROR(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Error in getting Transport err = %d", status); + } + return version; + } + // Methods + /* ${METHODS} */ + + // Events + /* ${EVENTS} */ + +}//namespace ${info.Title} +}${end.if.implementations} +${if.enums} + +namespace WPEFramework { + +/* ${ENUMS} */ +}${end.if.enums} \ No newline at end of file diff --git a/src/sdks/core/src/cpp/templates/Device/src/module_impl.h b/src/sdks/core/src/cpp/templates/Device/src/module_impl.h new file mode 100644 index 000000000..b96de7778 --- /dev/null +++ b/src/sdks/core/src/cpp/templates/Device/src/module_impl.h @@ -0,0 +1,54 @@ +/* + * 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" +#include + + +/* ${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; + + std::string version(Firebolt::Error *err = nullptr) const override; + + // Methods & Events + /* ${METHODS:declarations-override} */ + };${end.if.methods} + +}//namespace ${info.Title} +}${end.if.implementations} \ No newline at end of file diff --git a/src/sdks/core/src/cpp/templates/Lifecycle/include/module.h b/src/sdks/core/src/cpp/templates/Lifecycle/include/module.h new file mode 100644 index 000000000..1f954f6de --- /dev/null +++ b/src/sdks/core/src/cpp/templates/Lifecycle/include/module.h @@ -0,0 +1,60 @@ +/* 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 "error.h" +#include +/* ${IMPORTS} */ + +${if.declarations}namespace Firebolt { +namespace ${info.Title} { + +${if.enums} +// Enums +/* ${ENUMS} */${end.if.enums} + +${if.types} +// Types +/* ${TYPES} */${end.if.types} + +${if.providers}/* ${PROVIDERS} */${end.if.providers}${if.xuses}/* ${XUSES} */${end.if.xuses} + +${if.methods}struct I${info.Title} { + + virtual ~I${info.Title}() = default; + virtual void ready(Firebolt::Error *err = nullptr) = 0; + virtual void finished(Firebolt::Error *err = nullptr) = 0; + virtual std::string state(Firebolt::Error *err = nullptr) = 0; + + // Methods & Events + /* ${METHODS:declarations} */ +};${end.if.methods} + +// Template for mapping enums to strings +template +using EnumMap = std::unordered_map; + +// Function to convert enum values to string representations +template +inline const std::string& ConvertEnum(EnumMap enumMap, T type) +{ + return enumMap[type]; +} + +} //namespace ${info.Title} +}${end.if.declarations} diff --git a/src/sdks/core/src/cpp/templates/Lifecycle/src/module_impl.cpp b/src/sdks/core/src/cpp/templates/Lifecycle/src/module_impl.cpp new file mode 100644 index 000000000..233d3f973 --- /dev/null +++ b/src/sdks/core/src/cpp/templates/Lifecycle/src/module_impl.cpp @@ -0,0 +1,152 @@ +/* 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} + +EnumMap lifecycleStateMap = { + { Firebolt::Lifecycle::LifecycleState::INITIALIZING, "initializing" }, + { Firebolt::Lifecycle::LifecycleState::INACTIVE, "inactive" }, + { Firebolt::Lifecycle::LifecycleState::FOREGROUND, "foreground" }, + { Firebolt::Lifecycle::LifecycleState::BACKGROUND, "background" }, + { Firebolt::Lifecycle::LifecycleState::UNLOADING, "unloading" }, + { Firebolt::Lifecycle::LifecycleState::SUSPENDED, "suspended" } +}; + + +/* ready - Notify the platform that the app is ready */ +static void readyDispatcher(const void* result) { + Firebolt::IFireboltAccessor::Instance().MetricsInterface().ready(); +} + +// localCallback to update the state +static void onReadyInnerCallback(void* notification, const void* userData, void* jsonResponse ) +{ + const LifecycleImpl* selfConst = static_cast(userData); + LifecycleImpl* self = const_cast(selfConst); + + WPEFramework::Core::ProxyType& proxyResponse = *(reinterpret_cast*>(jsonResponse)); + ASSERT(proxyResponse.IsValid() == true); + + if (proxyResponse.IsValid() == true) { + LifecycleEvent value; + + value.state = proxyResponse->State; + std::string stateStr = ConvertEnum(lifecycleStateMap, value.state); + // Assign stateStr to currentState in ${info.Title}Impl instance + self->currentState = stateStr; + std::cout << "Updated the Current State to: " << self->currentState << std::endl; + + proxyResponse.Release(); + + } +} + + + +/* ready - Notify the platform that the app is ready */ +void ${info.Title}Impl::ready(Firebolt::Error *err) { + Firebolt::Error status = Firebolt::Error::NotConnected; + + JsonObject jsonParameters; + + // Call Prioritize to subscribe to corresponding event, add to internalMap, and prioritize its callback + status = FireboltSDK::Event::Instance().Prioritize("lifecycle.onForeground", jsonParameters, onReadyInnerCallback, (void*)nullptr, this); + status = FireboltSDK::Event::Instance().Prioritize("lifecycle.onBackground", jsonParameters, onReadyInnerCallback, (void*)nullptr, this); + status = FireboltSDK::Event::Instance().Prioritize("lifecycle.onInactive", jsonParameters, onReadyInnerCallback, (void*)nullptr, this); + status = FireboltSDK::Event::Instance().Prioritize("lifecycle.onSuspended", jsonParameters, onReadyInnerCallback, (void*)nullptr, this); + status = FireboltSDK::Event::Instance().Prioritize("lifecycle.onUnloading", jsonParameters, onReadyInnerCallback, (void*)nullptr, this); + + FireboltSDK::Transport* transport = FireboltSDK::Accessor::Instance().GetTransport(); + if (transport != nullptr) { + WPEFramework::Core::JSON::VariantContainer jsonResult; + status = transport->Invoke("lifecycle.ready", jsonParameters, jsonResult); + if (status == Firebolt::Error::None) { + FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Lifecycle.ready is successfully invoked"); + + WPEFramework::Core::ProxyType job = WPEFramework::Core::ProxyType(WPEFramework::Core::ProxyType::Create(readyDispatcher, nullptr)); + WPEFramework::Core::IWorkerPool::Instance().Submit(job); + } else { + FIREBOLT_LOG_ERROR(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Error in invoking lifecycle.ready: %d", status); + if (err != nullptr) { + *err = status; + } + } + + } else { + FIREBOLT_LOG_ERROR(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Error in getting Transport err = %d", status); + if (err != nullptr) { + *err = status; + } + } +} + + +/* state - return the state of the app */ +std::string ${info.Title}Impl::state(Firebolt::Error *err) { + std::cout << "**CURRENT STATE OF THE APP::::**" << currentState << std::endl; + return currentState; +} + + + +/* finished - Notify the platform that the app is done unloading */ +void ${info.Title}Impl::finished(Firebolt::Error *err) +{ + Firebolt::Error status = Firebolt::Error::NotConnected; + if(currentState == "unloading") + { + FireboltSDK::Transport* transport = FireboltSDK::Accessor::Instance().GetTransport(); + if (transport != nullptr) { + + JsonObject jsonParameters; + + WPEFramework::Core::JSON::VariantContainer jsonResult; + status = transport->Invoke("lifecycle.finished", jsonParameters, jsonResult); + if (status == Firebolt::Error::None) { + FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Lifecycle.finished is successfully invoked"); + + } + + } else { + FIREBOLT_LOG_ERROR(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Error in getting Transport err = %d", status); + } + } + + return; +} + +// Methods +/* ${METHODS} */ + +// Events +/* ${EVENTS} */ + +}//namespace Lifecycle +}${end.if.implementations} +${if.enums} + +namespace WPEFramework { + +/* ${ENUMS} */ +}${end.if.enums} \ No newline at end of file diff --git a/src/sdks/core/src/cpp/templates/Lifecycle/src/module_impl.h b/src/sdks/core/src/cpp/templates/Lifecycle/src/module_impl.h new file mode 100644 index 000000000..79a582da5 --- /dev/null +++ b/src/sdks/core/src/cpp/templates/Lifecycle/src/module_impl.h @@ -0,0 +1,58 @@ +/* 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" +#include "firebolt.h" +#include "jsondata_lifecycle.h" +#include "${info.title.lowercase}.h" + +/* ${IMPORTS} */ + + +${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; + + std::string currentState = "INITIALIZING"; + + // Methods & Events + /* ${METHODS:declarations-override} */ + + void finished(Firebolt::Error *err = nullptr) override ; + void ready(Firebolt::Error *err = nullptr) override; + std::string state(Firebolt::Error *err = nullptr) override; + +};${end.if.methods} + +} // namespace ${info.Title} +} // namespace Firebolt +${end.if.implementations} \ No newline at end of file diff --git a/src/sdks/core/src/cpp/templates/Metrics/include/module.h b/src/sdks/core/src/cpp/templates/Metrics/include/module.h new file mode 100644 index 000000000..ccca61a6a --- /dev/null +++ b/src/sdks/core/src/cpp/templates/Metrics/include/module.h @@ -0,0 +1,36 @@ +#pragma once + +#include "error.h" +/* ${IMPORTS} */ + +${if.declarations}namespace Firebolt { +namespace ${info.Title} { +${if.enums} + +// Enums +/* ${ENUMS} */${end.if.enums} +${if.types} +// Types +/* ${TYPES} */${end.if.types} +${if.providers}/* ${PROVIDERS} */${end.if.providers}${if.xuses}/* ${XUSES} */${end.if.xuses} +${if.methods}struct I${info.Title} { + + virtual ~I${info.Title}() = default; + virtual bool ready( Firebolt::Error *err = nullptr ) = 0 ; + virtual bool signIn( Firebolt::Error *err = nullptr ) = 0 ; + virtual bool signOut( Firebolt::Error *err = nullptr ) = 0 ; + + // Methods & Events + /* ${METHODS:declarations} */ +};${end.if.methods} + +} //namespace ${info.Title} +}${end.if.declarations} + + + + + + + + diff --git a/src/sdks/core/src/cpp/templates/Metrics/src/module_impl.cpp b/src/sdks/core/src/cpp/templates/Metrics/src/module_impl.cpp index 59a50162d..085c4173a 100644 --- a/src/sdks/core/src/cpp/templates/Metrics/src/module_impl.cpp +++ b/src/sdks/core/src/cpp/templates/Metrics/src/module_impl.cpp @@ -18,68 +18,95 @@ #include "${info.title.lowercase}_impl.h" + ${if.implementations} namespace Firebolt { namespace ${info.Title} { ${if.providers} /* ${PROVIDERS} */${end.if.providers} - void ${info.Title}Impl::signIn() + +/* ready - Inform the platform that your app is minimally usable. This method is called automatically by `Lifecycle.ready()` */ + bool ${info.Title}Impl::ready( Firebolt::Error *err ) { Firebolt::Error status = Firebolt::Error::NotConnected; + bool success = false; FireboltSDK::Transport* transport = FireboltSDK::Accessor::Instance().GetTransport(); if (transport != nullptr) { - + JsonObject jsonParameters; - + WPEFramework::Core::JSON::Boolean jsonResult; - status = transport->Invoke("${info.title.lowercase}.signIn", jsonParameters, 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(), "${info.Title.signIn is successfully invoked, status : %s", (jsonResult.Value() ? "true" : "false")); + FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Metrics.ready is successfully invoked"); + success = jsonResult.Value(); } } else { FIREBOLT_LOG_ERROR(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Error in getting Transport err = %d", status); } + if (err != nullptr) { + *err = status; + } + + return success; } - void ${info.Title}Impl::signOut() + + /* signIn - Log a sign In event, called by Discovery.signIn(). */ + bool ${info.Title}Impl::signIn( Firebolt::Error *err ) { Firebolt::Error status = Firebolt::Error::NotConnected; + bool success = false; FireboltSDK::Transport* transport = FireboltSDK::Accessor::Instance().GetTransport(); if (transport != nullptr) { - + JsonObject jsonParameters; - + WPEFramework::Core::JSON::Boolean jsonResult; - status = transport->Invoke("${info.title.lowercase}.signOut", jsonParameters, 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(), "${info.Title}.signOut is successfully invoked, status : %s", (jsonResult.Value() ? "true" : "false")); + FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Metrics.signOut is successfully invoked"); + success = jsonResult.Value(); } } else { FIREBOLT_LOG_ERROR(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Error in getting Transport err = %d", status); } - } + if (err != nullptr) { + *err = status; + } + return success; - void ${info.Title}Impl::ready() + } + /* signOut - Log a sign out event, called by Discovery.signOut(). */ + bool ${info.Title}Impl::signOut( Firebolt::Error *err ) { Firebolt::Error status = Firebolt::Error::NotConnected; + bool success = false; FireboltSDK::Transport* transport = FireboltSDK::Accessor::Instance().GetTransport(); if (transport != nullptr) { - + JsonObject jsonParameters; - + WPEFramework::Core::JSON::Boolean jsonResult; - status = transport->Invoke("${info.title.lowercase}.ready", jsonParameters, 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(), "${info.Title}.ready is successfully invoked, status : %s", (jsonResult.Value() ? "true" : "false")); + FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Metrics.signOut is successfully invoked"); + success = jsonResult.Value(); } } else { FIREBOLT_LOG_ERROR(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Error in getting Transport err = %d", status); } + if (err != nullptr) { + *err = status; + } + + return success; } + // Methods /* ${METHODS} */ @@ -93,4 +120,4 @@ namespace ${info.Title} { namespace WPEFramework { /* ${ENUMS} */ -}${end.if.enums} +}${end.if.enums} \ No newline at end of file diff --git a/src/sdks/core/src/cpp/templates/Metrics/src/module_impl.h b/src/sdks/core/src/cpp/templates/Metrics/src/module_impl.h index d64b59695..219803938 100644 --- a/src/sdks/core/src/cpp/templates/Metrics/src/module_impl.h +++ b/src/sdks/core/src/cpp/templates/Metrics/src/module_impl.h @@ -20,6 +20,7 @@ #include "FireboltSDK.h" #include "IModule.h" + /* ${IMPORTS} */ #include "${info.title.lowercase}.h" @@ -41,12 +42,16 @@ namespace ${info.Title} { ~${info.Title}Impl() override = default; - static void signIn(); - static void signOut(); - static void ready(); + + bool ready( Firebolt::Error *err = nullptr ) ; + bool signIn( Firebolt::Error *err = nullptr ) ; + bool signOut( Firebolt::Error *err = nullptr ) ; + + + // Methods & Events /* ${METHODS:declarations-override} */ };${end.if.methods} }//namespace ${info.Title} -}${end.if.implementations} +}${end.if.implementations} \ No newline at end of file diff --git a/src/sdks/core/test/suite/advertising.test.ts b/src/sdks/core/test/suite/advertising.test.ts index 95ec53e77..9f788abd4 100644 --- a/src/sdks/core/test/suite/advertising.test.ts +++ b/src/sdks/core/test/suite/advertising.test.ts @@ -50,7 +50,7 @@ test("deviceAttributes()", () => { test("appBundleId()", () => { return Advertising.appBundleId().then((res: string) => { - expect(res).toBe("operator.app"); + expect(res).toBe("app.operator"); expect(typeof res).toBe("string"); }); }); diff --git a/src/sdks/discovery/CHANGELOG.md b/src/sdks/discovery/CHANGELOG.md index af3ac672a..d4218fc6b 100644 --- a/src/sdks/discovery/CHANGELOG.md +++ b/src/sdks/discovery/CHANGELOG.md @@ -1,3 +1,5 @@ +# 1.3.0 (https://github.com/rdkcentral/firebolt-apis/compare/v1.2.0...v1.3.0) (2024-08-12) + # 1.2.0 (https://github.com/rdkcentral/firebolt-apis/compare/v1.1.0...v1.2.0) (2024-06-14) ### Features diff --git a/src/sdks/discovery/package.json b/src/sdks/discovery/package.json index 0e4ec34e9..a0daa66d7 100644 --- a/src/sdks/discovery/package.json +++ b/src/sdks/discovery/package.json @@ -1,6 +1,6 @@ { "name": "@firebolt-js/discovery-sdk", - "version": "1.2.1-next.2", + "version": "1.3.1-next.1", "description": "The Firebolt Discovery JS SDK", "main": "./dist/lib/firebolt-discovery.mjs", "types": "./dist/lib/firebolt-discovery.d.ts", @@ -12,6 +12,9 @@ "validate": "npx firebolt-openrpc validate --input ./dist/firebolt-discovery-open-rpc.json", "sdk": "npx firebolt-openrpc sdk --input ./dist/firebolt-discovery-open-rpc.json --template ./src/js --output ./build/javascript/src", "native": "npx firebolt-openrpc sdk --input ./dist/firebolt-discovery-open-rpc.json --template ./src/js --output ./build/c/src --language ../../../node_modules/@firebolt-js/openrpc/languages/c", + "cpp": "npm run cpp:compile && npm run cpp:install", + "cpp:compile": "npx firebolt-openrpc sdk --input ./dist/firebolt-discovery-open-rpc.json --template ./src/cpp --output ./build/cpp/src --static-module Platform --language ../../../node_modules/@firebolt-js/openrpc/languages/cpp", + "cpp:install": "./build/cpp/src/scripts/install.sh -i ./build/cpp/src -s ./build/cpp/src/ -m discovery", "compile": "cd ../../.. && npm run compile", "slice": "npx firebolt-openrpc slice -i ../../../dist/firebolt-open-rpc.json --sdk ./sdk.config.json -o ./dist/firebolt-discovery-open-rpc.json", "docs": "npx firebolt-openrpc docs --input ./dist/firebolt-discovery-open-rpc.json --output build/docs/markdown --as-path", diff --git a/src/sdks/discovery/src/cpp/sdk/cpptest/CMakeLists.txt b/src/sdks/discovery/src/cpp/sdk/cpptest/CMakeLists.txt new file mode 100644 index 000000000..e2fc88793 --- /dev/null +++ b/src/sdks/discovery/src/cpp/sdk/cpptest/CMakeLists.txt @@ -0,0 +1,75 @@ +# 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 + +cmake_minimum_required(VERSION 3.3) + +project(FireboltDiscoverySDKTests) + +if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${SYSROOT_PATH}/usr" CACHE INTERNAL "" FORCE) + set(CMAKE_PREFIX_PATH ${SYSROOT_PATH}/usr/lib/cmake CACHE INTERNAL "" FORCE) +endif() + +list(APPEND CMAKE_MODULE_PATH + "${SYSROOT_PATH}/usr/lib/cmake" + "${SYSROOT_PATH}/tools/cmake") +message("FIREBOLT_PATH inside cmake " ${FIREBOLT_PATH}) +if (FIREBOLT_PATH) + set(CMAKE_FIREBOLT_PATH + "${FIREBOLT_PATH}/usr/lib/cmake/Firebolt" + "${FIREBOLT_PATH}/usr/lib/cmake/FireboltSDK") + list(APPEND CMAKE_PREFIX_PATH ${CMAKE_FIREBOLT_PATH}) + list(APPEND CMAKE_MODULE_PATH ${CMAKE_FIREBOLT_PATH}) +else () + set(FIREBOLT_PATH "${SYSROOT_PATH}" CACHE INTERNAL "" FORCE) +endif () + +find_package(WPEFramework CONFIG REQUIRED) +find_package(${NAMESPACE}Core CONFIG REQUIRED) +find_package(Firebolt CONFIG REQUIRED) +find_package(${FIREBOLT_NAMESPACE}SDK CONFIG REQUIRED) + +set(TESTAPP TestFireboltDiscovery) + +message("Setup ${TESTAPP}") + +add_executable(${TESTAPP} DiscoverySDKTest.cpp Main.cpp) + +target_link_libraries(${TESTAPP} + PRIVATE + ${NAMESPACE}Core::${NAMESPACE}Core + ${FIREBOLT_NAMESPACE}SDK::${FIREBOLT_NAMESPACE}SDK +) + +target_include_directories(${TESTAPP} + PRIVATE + $ + $ + $ +) + +set_target_properties(${TESTAPP} PROPERTIES + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED YES +) + +add_custom_command( + TARGET ${TESTAPP} + POST_BUILD + COMMENT "=================== Installing TestApp ======================" + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/${FIREBOLT_NAMESPACE}/usr/bin + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${TESTAPP} ${CMAKE_BINARY_DIR}/${FIREBOLT_NAMESPACE}/usr/bin +) diff --git a/src/sdks/discovery/src/cpp/sdk/cpptest/DiscoverySDKTest.cpp b/src/sdks/discovery/src/cpp/sdk/cpptest/DiscoverySDKTest.cpp new file mode 100644 index 000000000..27fe67244 --- /dev/null +++ b/src/sdks/discovery/src/cpp/sdk/cpptest/DiscoverySDKTest.cpp @@ -0,0 +1,102 @@ +/* + * 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 +#include +#include +#include "DiscoverySDKTest.h" + +using namespace std; +bool DiscoverySDKTest::_connected; + +void DiscoverySDKTest::ConnectionChanged(const bool connected, const Firebolt::Error error) +{ + cout << "Change in connection: connected: " << connected << " error: " << static_cast(error) << endl; + _connected = connected; +} + +void DiscoverySDKTest::CreateFireboltInstance(const std::string& url) +{ + const std::string config = "{\ + \"waitTime\": 100000,\ + \"logLevel\": \"Info\",\ + \"workerPool\":{\ + \"queueSize\": 8,\ + \"threadCount\": 3\ + },\ + \"wsUrl\": " + url + "}"; + + _connected = false; + Firebolt::IFireboltAccessor::Instance().Initialize(config); + Firebolt::IFireboltAccessor::Instance().Connect(ConnectionChanged); +} + +void DiscoverySDKTest::DestroyFireboltInstance() +{ + Firebolt::IFireboltAccessor::Instance().Disconnect(); + Firebolt::IFireboltAccessor::Instance().Deinitialize(); + Firebolt::IFireboltAccessor::Instance().Dispose(); +} + +bool DiscoverySDKTest::WaitOnConnectionReady() +{ + uint32_t waiting = 10000; + static constexpr uint32_t SLEEPSLOT_TIME = 100; + + // Right, a wait till connection is closed is requested.. + while ((waiting > 0) && (_connected == false)) { + + uint32_t sleepSlot = (waiting > SLEEPSLOT_TIME ? SLEEPSLOT_TIME : waiting); + // Right, lets sleep in slices of 100 ms + usleep(sleepSlot); + waiting -= sleepSlot; + } + return _connected; +} + +template +using EnumMap = std::unordered_map; +template +inline const string& ConvertFromEnum(EnumMap enumMap, T type) +{ + return enumMap[type]; +} +template +inline const T ConvertToEnum(EnumMap enumMap, const string& str) +{ + T value; + for (auto element: enumMap) { + if (element.second == str) { + value = element.first; + break; + } + } + return value; +} + +void DiscoverySDKTest::SampleTest() +{ + Firebolt::Error error = Firebolt::Error::None; + + if (error == Firebolt::Error::None) { + cout << "Sample Test Passed!" << endl; + } else { + std::string errorMessage = "Error: " + std::to_string(static_cast(error)); + throw std::runtime_error("SampleTest failed. " + errorMessage); + } +} diff --git a/src/sdks/discovery/src/cpp/sdk/cpptest/DiscoverySDKTest.h b/src/sdks/discovery/src/cpp/sdk/cpptest/DiscoverySDKTest.h new file mode 100644 index 000000000..2fcd2bcc0 --- /dev/null +++ b/src/sdks/discovery/src/cpp/sdk/cpptest/DiscoverySDKTest.h @@ -0,0 +1,41 @@ +/* + * 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 +#include "firebolt.h" + +class DiscoverySDKTest { + +public: + DiscoverySDKTest() = default; + virtual ~DiscoverySDKTest() = default; + + static void CreateFireboltInstance(const std::string& url); + static void DestroyFireboltInstance(); + static void TestDiscoveryStaticSDK(); + + static void SampleTest(); + + static bool WaitOnConnectionReady(); + +private: + static void ConnectionChanged(const bool, const Firebolt::Error); + static bool _connected; +}; \ No newline at end of file diff --git a/src/sdks/discovery/src/cpp/sdk/cpptest/Main.cpp b/src/sdks/discovery/src/cpp/sdk/cpptest/Main.cpp new file mode 100644 index 000000000..26e2b5dc6 --- /dev/null +++ b/src/sdks/discovery/src/cpp/sdk/cpptest/Main.cpp @@ -0,0 +1,89 @@ +/* + * 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 +#include +#include +#include +#include +#include "DiscoverySDKTest.h" + +using namespace std; + +const char* options = ":hu:"; + +void RunAllTests() { + bool allTestsPassed = true; + vector errorMessages; + + auto runTest = [&allTestsPassed, &errorMessages](auto testFunction, const string& testName) { + try { + testFunction(); + } catch (const exception& e) { + errorMessages.push_back("Test " + testName + " failed: " + e.what()); + allTestsPassed = false; + } + }; + + // Ensure the connection is ready before running tests + if (DiscoverySDKTest::WaitOnConnectionReady()) { + // Add tests here + + runTest(DiscoverySDKTest::SampleTest, "SampleTest"); + + if (allTestsPassed) { + cout << "============================" << endl; + cout << "ALL DISCOVERY SDK TESTS SUCCEEDED!" << endl; + cout << "============================" << endl; + } else { + cout << "============================" << endl; + cout << "SOME TESTS FAILED:" << endl; + for (const auto& errorMessage : errorMessages) { + cout << errorMessage << endl; + } + cout << "============================" << endl; + exit(1); + } + } else { + cout << "Discovery Test not able to connect with server..." << endl; + exit(1); + } +} + +int main(int argc, char* argv[]) { + int c; + string url = "ws://127.0.0.1:9998"; + while ((c = getopt(argc, argv, options)) != -1) { + switch (c) { + case 'u': + url = optarg; + break; + case 'h': + printf("./TestFireboltDiscovery -u ws://ip:port\n"); + exit(1); + } + } + + printf("Firebolt Discovery SDK Test\n"); + + DiscoverySDKTest::CreateFireboltInstance(url); + RunAllTests(); + DiscoverySDKTest::DestroyFireboltInstance(); + + return 0; +} \ No newline at end of file diff --git a/src/sdks/discovery/src/cpp/sdk/cpptest/build.sh b/src/sdks/discovery/src/cpp/sdk/cpptest/build.sh new file mode 100644 index 000000000..4db39cbe8 --- /dev/null +++ b/src/sdks/discovery/src/cpp/sdk/cpptest/build.sh @@ -0,0 +1,40 @@ +#!/bin/bash +usage() +{ + echo "options:" + echo " -t test path" + echo " -s sysroot path" + echo " -f firebolt path" + echo " -c clear build" + echo " -h : help" + echo + echo "usage: " + echo " ./build.sh -t testpath -c -f fireboltpath -s sysrootpath" +} + +TestPath="." +FireboltPath=${FIREBOLT_PATH} +SysrootPath=${SYSROOT_PATH} +ClearBuild="N" +while getopts t:s:f:ch flag +do + case "${flag}" in + t) TestPath="${OPTARG}";; + s) SysrootPath="${OPTARG}";; + f) FireboltPath="${OPTARG}";; + c) ClearBuild="Y";; + h) usage && exit 1;; + esac +done + +if [ "${ClearBuild}" == "Y" ]; +then + rm -rf ${TestPath}/build +fi + +echo "TestPath" +echo "${TestPath}" +echo "FireboltPath" +echo ${FireboltPath} +cmake -B${TestPath}/build -S${TestPath} -DSYSROOT_PATH=${SysrootPath} -DFIREBOLT_PATH=${FireboltPath} +cmake --build ${TestPath}/build diff --git a/src/sdks/discovery/src/cpp/templates/Content/src/module_impl.cpp b/src/sdks/discovery/src/cpp/templates/Content/src/module_impl.cpp new file mode 100644 index 000000000..1b174038b --- /dev/null +++ b/src/sdks/discovery/src/cpp/templates/Content/src/module_impl.cpp @@ -0,0 +1,380 @@ +/* + * 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} + + // Methods + /* requestUserInterest - Provide information about the entity currently displayed or selected on the screen. */ + InterestResult ContentImpl::requestUserInterest( const Discovery::InterestType& type, const Discovery::InterestReason& reason, Firebolt::Error *err ) + { + Firebolt::Error status = Firebolt::Error::NotConnected; + InterestResult interest; + FireboltSDK::Transport* transport = FireboltSDK::Accessor::Instance().GetTransport(); + if (transport != nullptr) { + + JsonObject jsonParameters; + Firebolt::Discovery::JsonData_InterestType jsonType = type; + WPEFramework::Core::JSON::Variant typeVariant(jsonType.Data()); + jsonParameters.Set(_T("type"), typeVariant); + Firebolt::Discovery::JsonData_InterestReason jsonReason = reason; + WPEFramework::Core::JSON::Variant reasonVariant(jsonReason.Data()); + jsonParameters.Set(_T("reason"), reasonVariant); + JsonData_InterestResult jsonResult; + status = transport->Invoke("content.requestUserInterest", jsonParameters, jsonResult); + if (status == Firebolt::Error::None) { + FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Content.requestUserInterest is successfully invoked"); + InterestResult interestResult; + interestResult.appId = jsonResult.AppId.Value(); + { + string identifiersStr; + jsonResult.Entity.Identifiers.ToString(identifiersStr); + interestResult.entity.identifiers = identifiersStr; + if (jsonResult.Entity.Info.IsSet()) { + interestResult.entity.info = std::make_optional(); + if (jsonResult.Entity.Info.Title.IsSet()) { + interestResult.entity.info.value().title = jsonResult.Entity.Info.Title; + } + if (jsonResult.Entity.Info.Synopsis.IsSet()) { + interestResult.entity.info.value().synopsis = jsonResult.Entity.Info.Synopsis; + } + if (jsonResult.Entity.Info.SeasonNumber.IsSet()) { + interestResult.entity.info.value().seasonNumber = jsonResult.Entity.Info.SeasonNumber; + } + if (jsonResult.Entity.Info.SeasonCount.IsSet()) { + interestResult.entity.info.value().seasonCount = jsonResult.Entity.Info.SeasonCount; + } + if (jsonResult.Entity.Info.EpisodeNumber.IsSet()) { + interestResult.entity.info.value().episodeNumber = jsonResult.Entity.Info.EpisodeNumber; + } + if (jsonResult.Entity.Info.EpisodeCount.IsSet()) { + interestResult.entity.info.value().episodeCount = jsonResult.Entity.Info.EpisodeCount; + } + if (jsonResult.Entity.Info.ReleaseDate.IsSet()) { + interestResult.entity.info.value().releaseDate = jsonResult.Entity.Info.ReleaseDate; + } + if (jsonResult.Entity.Info.ContentRatings.IsSet()) { + interestResult.entity.info.value().contentRatings = std::make_optional>(); + auto index(jsonResult.Entity.Info.ContentRatings.Elements()); + while (index.Next() == true) { + Entertainment::ContentRating contentRatingsResult1; + Firebolt::Entertainment::JsonData_ContentRating jsonResult = index.Current(); + { + contentRatingsResult1.scheme = jsonResult.Scheme; + contentRatingsResult1.rating = jsonResult.Rating; + if (jsonResult.Advisories.IsSet()) { + contentRatingsResult1.advisories = std::make_optional>(); + auto index(jsonResult.Advisories.Elements()); + while (index.Next() == true) { + contentRatingsResult1.advisories.value().push_back(index.Current().Value()); + } + } + } + interestResult.entity.info.value().contentRatings->push_back(contentRatingsResult1); + } + } + } + if (jsonResult.Entity.WaysToWatch.IsSet()) { + interestResult.entity.waysToWatch = std::make_optional>(); + auto index(jsonResult.Entity.WaysToWatch.Elements()); + while (index.Next() == true) { + Entertainment::WayToWatch waysToWatchResult1; + Firebolt::Entertainment::JsonData_WayToWatch jsonResult = index.Current(); + { + { + if (jsonResult.Identifiers.AssetId.IsSet()) { + waysToWatchResult1.identifiers.assetId = jsonResult.Identifiers.AssetId; + } + if (jsonResult.Identifiers.EntityId.IsSet()) { + waysToWatchResult1.identifiers.entityId = jsonResult.Identifiers.EntityId; + } + if (jsonResult.Identifiers.SeasonId.IsSet()) { + waysToWatchResult1.identifiers.seasonId = jsonResult.Identifiers.SeasonId; + } + if (jsonResult.Identifiers.SeriesId.IsSet()) { + waysToWatchResult1.identifiers.seriesId = jsonResult.Identifiers.SeriesId; + } + if (jsonResult.Identifiers.AppContentData.IsSet()) { + waysToWatchResult1.identifiers.appContentData = jsonResult.Identifiers.AppContentData; + } + } + if (jsonResult.Expires.IsSet()) { + waysToWatchResult1.expires = jsonResult.Expires; + } + if (jsonResult.Entitled.IsSet()) { + waysToWatchResult1.entitled = jsonResult.Entitled; + } + if (jsonResult.EntitledExpires.IsSet()) { + waysToWatchResult1.entitledExpires = jsonResult.EntitledExpires; + } + if (jsonResult.OfferingType.IsSet()) { + waysToWatchResult1.offeringType = jsonResult.OfferingType; + } + if (jsonResult.HasAds.IsSet()) { + waysToWatchResult1.hasAds = jsonResult.HasAds; + } + if (jsonResult.Price.IsSet()) { + waysToWatchResult1.price = jsonResult.Price; + } + if (jsonResult.VideoQuality.IsSet()) { + waysToWatchResult1.videoQuality = std::make_optional>(); + auto index(jsonResult.VideoQuality.Elements()); + while (index.Next() == true) { + waysToWatchResult1.videoQuality.value().push_back(index.Current().Value()); + } + } + auto index(jsonResult.AudioProfile.Elements()); + while (index.Next() == true) { + waysToWatchResult1.audioProfile.push_back(index.Current().Value()); + } + if (jsonResult.AudioLanguages.IsSet()) { + waysToWatchResult1.audioLanguages = std::make_optional>(); + auto index(jsonResult.AudioLanguages.Elements()); + while (index.Next() == true) { + waysToWatchResult1.audioLanguages.value().push_back(index.Current().Value()); + } + } + if (jsonResult.ClosedCaptions.IsSet()) { + waysToWatchResult1.closedCaptions = std::make_optional>(); + auto index(jsonResult.ClosedCaptions.Elements()); + while (index.Next() == true) { + waysToWatchResult1.closedCaptions.value().push_back(index.Current().Value()); + } + } + if (jsonResult.Subtitles.IsSet()) { + waysToWatchResult1.subtitles = std::make_optional>(); + auto index(jsonResult.Subtitles.Elements()); + while (index.Next() == true) { + waysToWatchResult1.subtitles.value().push_back(index.Current().Value()); + } + } + if (jsonResult.AudioDescriptions.IsSet()) { + waysToWatchResult1.audioDescriptions = std::make_optional>(); + auto index(jsonResult.AudioDescriptions.Elements()); + while (index.Next() == true) { + waysToWatchResult1.audioDescriptions.value().push_back(index.Current().Value()); + } + } + } + interestResult.entity.waysToWatch->push_back(waysToWatchResult1); + } + } + } + interest = interestResult; + } + + } else { + FIREBOLT_LOG_ERROR(FireboltSDK::Logger::Category::OpenRPC, FireboltSDK::Logger::Module(), "Error in getting Transport err = %d", status); + } + if (err != nullptr) { + *err = status; + } + + return interest; + } + + + // Events + /* onUserInterest - Provide information about the entity currently displayed or selected on the screen. */ + static void onUserInterestInnerCallback( void* notification, const void* userData, void* jsonResponse ) + { + WPEFramework::Core::ProxyType& proxyResponse = *(reinterpret_cast*>(jsonResponse)); + + ASSERT(proxyResponse.IsValid() == true); + + if (proxyResponse.IsValid() == true) { + InterestEvent interest; + + interest.appId = proxyResponse->AppId; + interest.type = proxyResponse->Type; + interest.reason = proxyResponse->Reason; + { + string identifiersStr; + (*proxyResponse).Entity.Identifiers.ToString(identifiersStr); + interest.entity.identifiers = identifiersStr; + if ((*proxyResponse).Entity.Info.IsSet()) { + interest.entity.info = std::make_optional(); + if ((*proxyResponse).Entity.Info.Title.IsSet()) { + interest.entity.info.value().title = (*proxyResponse).Entity.Info.Title; + } + if ((*proxyResponse).Entity.Info.Synopsis.IsSet()) { + interest.entity.info.value().synopsis = (*proxyResponse).Entity.Info.Synopsis; + } + if ((*proxyResponse).Entity.Info.SeasonNumber.IsSet()) { + interest.entity.info.value().seasonNumber = (*proxyResponse).Entity.Info.SeasonNumber; + } + if ((*proxyResponse).Entity.Info.SeasonCount.IsSet()) { + interest.entity.info.value().seasonCount = (*proxyResponse).Entity.Info.SeasonCount; + } + if ((*proxyResponse).Entity.Info.EpisodeNumber.IsSet()) { + interest.entity.info.value().episodeNumber = (*proxyResponse).Entity.Info.EpisodeNumber; + } + if ((*proxyResponse).Entity.Info.EpisodeCount.IsSet()) { + interest.entity.info.value().episodeCount = (*proxyResponse).Entity.Info.EpisodeCount; + } + if ((*proxyResponse).Entity.Info.ReleaseDate.IsSet()) { + interest.entity.info.value().releaseDate = (*proxyResponse).Entity.Info.ReleaseDate; + } + if ((*proxyResponse).Entity.Info.ContentRatings.IsSet()) { + interest.entity.info.value().contentRatings = std::make_optional>(); + auto index((*proxyResponse).Entity.Info.ContentRatings.Elements()); + while (index.Next() == true) { + Entertainment::ContentRating contentRatingsResult1; + Firebolt::Entertainment::JsonData_ContentRating jsonResult = index.Current(); + contentRatingsResult1.scheme = jsonResult.Scheme; + contentRatingsResult1.rating = jsonResult.Rating; + if (jsonResult.Advisories.IsSet()) { + contentRatingsResult1.advisories = std::make_optional>(); + auto index(jsonResult.Advisories.Elements()); + while (index.Next() == true) { + contentRatingsResult1.advisories.value().push_back(index.Current().Value()); + } + } + interest.entity.info.value().contentRatings.value().push_back(contentRatingsResult1); + } + } + } + if ((*proxyResponse).Entity.WaysToWatch.IsSet()) { + interest.entity.waysToWatch = std::make_optional>(); + auto index((*proxyResponse).Entity.WaysToWatch.Elements()); + while (index.Next() == true) { + Entertainment::WayToWatch waysToWatchResult1; + Firebolt::Entertainment::JsonData_WayToWatch jsonResult = index.Current(); + { + if (jsonResult.Identifiers.AssetId.IsSet()) { + waysToWatchResult1.identifiers.assetId = jsonResult.Identifiers.AssetId; + } + if (jsonResult.Identifiers.EntityId.IsSet()) { + waysToWatchResult1.identifiers.entityId = jsonResult.Identifiers.EntityId; + } + if (jsonResult.Identifiers.SeasonId.IsSet()) { + waysToWatchResult1.identifiers.seasonId = jsonResult.Identifiers.SeasonId; + } + if (jsonResult.Identifiers.SeriesId.IsSet()) { + waysToWatchResult1.identifiers.seriesId = jsonResult.Identifiers.SeriesId; + } + if (jsonResult.Identifiers.AppContentData.IsSet()) { + waysToWatchResult1.identifiers.appContentData = jsonResult.Identifiers.AppContentData; + } + } + if (jsonResult.Expires.IsSet()) { + waysToWatchResult1.expires = jsonResult.Expires; + } + if (jsonResult.Entitled.IsSet()) { + waysToWatchResult1.entitled = jsonResult.Entitled; + } + if (jsonResult.EntitledExpires.IsSet()) { + waysToWatchResult1.entitledExpires = jsonResult.EntitledExpires; + } + if (jsonResult.OfferingType.IsSet()) { + waysToWatchResult1.offeringType = jsonResult.OfferingType; + } + if (jsonResult.HasAds.IsSet()) { + waysToWatchResult1.hasAds = jsonResult.HasAds; + } + if (jsonResult.Price.IsSet()) { + waysToWatchResult1.price = jsonResult.Price; + } + if (jsonResult.VideoQuality.IsSet()) { + waysToWatchResult1.videoQuality = std::make_optional>(); + auto index(jsonResult.VideoQuality.Elements()); + while (index.Next() == true) { + waysToWatchResult1.videoQuality.value().push_back(index.Current().Value()); + } + } + auto index(jsonResult.AudioProfile.Elements()); + while (index.Next() == true) { + waysToWatchResult1.audioProfile.push_back(index.Current().Value()); + } + if (jsonResult.AudioLanguages.IsSet()) { + waysToWatchResult1.audioLanguages = std::make_optional>(); + auto index(jsonResult.AudioLanguages.Elements()); + while (index.Next() == true) { + waysToWatchResult1.audioLanguages.value().push_back(index.Current().Value()); + } + } + if (jsonResult.ClosedCaptions.IsSet()) { + waysToWatchResult1.closedCaptions = std::make_optional>(); + auto index(jsonResult.ClosedCaptions.Elements()); + while (index.Next() == true) { + waysToWatchResult1.closedCaptions.value().push_back(index.Current().Value()); + } + } + if (jsonResult.Subtitles.IsSet()) { + waysToWatchResult1.subtitles = std::make_optional>(); + auto index(jsonResult.Subtitles.Elements()); + while (index.Next() == true) { + waysToWatchResult1.subtitles.value().push_back(index.Current().Value()); + } + } + if (jsonResult.AudioDescriptions.IsSet()) { + waysToWatchResult1.audioDescriptions = std::make_optional>(); + auto index(jsonResult.AudioDescriptions.Elements()); + while (index.Next() == true) { + waysToWatchResult1.audioDescriptions.value().push_back(index.Current().Value()); + } + } + interest.entity.waysToWatch.value().push_back(waysToWatchResult1); + } + } + } + + proxyResponse.Release(); + + IContent::IOnUserInterestNotification& notifier = *(reinterpret_cast(notification)); + notifier.onUserInterest(interest); + } + } + void ContentImpl::subscribe( IContent::IOnUserInterestNotification& notification, Firebolt::Error *err ) + { + const string eventName = _T("content.onUserInterest"); + Firebolt::Error status = Firebolt::Error::None; + + JsonObject jsonParameters; + + status = FireboltSDK::Event::Instance().Subscribe(eventName, jsonParameters, onUserInterestInnerCallback, reinterpret_cast(¬ification), nullptr); + + if (err != nullptr) { + *err = status; + } + } + void ContentImpl::unsubscribe( IContent::IOnUserInterestNotification& notification, Firebolt::Error *err ) + { + Firebolt::Error status = FireboltSDK::Event::Instance().Unsubscribe(_T("content.onUserInterest"), reinterpret_cast(¬ification)); + + if (err != nullptr) { + *err = status; + } + } + + +}//namespace ${info.Title} +}${end.if.implementations} + +${if.enums} + +namespace WPEFramework { + +/* ${ENUMS} */ +}${end.if.enums} + diff --git a/src/sdks/discovery/src/cpp/templates/Content/src/module_impl.h b/src/sdks/discovery/src/cpp/templates/Content/src/module_impl.h new file mode 100644 index 000000000..a01a3eb3e --- /dev/null +++ b/src/sdks/discovery/src/cpp/templates/Content/src/module_impl.h @@ -0,0 +1,136 @@ +/* + * 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} { + + + // Types + class JsonData_InterestResult: public WPEFramework::Core::JSON::Container { + public: + ~JsonData_InterestResult() override = default; + + public: + JsonData_InterestResult() + : WPEFramework::Core::JSON::Container() + { + Add(_T("appId"), &AppId); + Add(_T("entity"), &Entity); + } + + JsonData_InterestResult(const JsonData_InterestResult& other) + { + Add(_T("appId"), &AppId); + AppId = other.AppId; + Add(_T("entity"), &Entity); + Entity = other.Entity; + } + + JsonData_InterestResult& operator=(const JsonData_InterestResult& other) + { + Add(_T("appId"), &AppId); + AppId = other.AppId; + Add(_T("entity"), &Entity); + Entity = other.Entity; + return (*this); + } + + public: + FireboltSDK::JSON::String AppId; + Firebolt::Entity::JsonData_EntityDetails Entity; + }; + + class JsonData_InterestEvent: public WPEFramework::Core::JSON::Container { + public: + ~JsonData_InterestEvent() override = default; + + public: + JsonData_InterestEvent() + : WPEFramework::Core::JSON::Container() + { + Add(_T("appId"), &AppId); + Add(_T("type"), &Type); + Add(_T("reason"), &Reason); + Add(_T("entity"), &Entity); + } + + JsonData_InterestEvent(const JsonData_InterestEvent& other) + { + Add(_T("appId"), &AppId); + AppId = other.AppId; + Add(_T("type"), &Type); + Type = other.Type; + Add(_T("reason"), &Reason); + Reason = other.Reason; + Add(_T("entity"), &Entity); + Entity = other.Entity; + } + + JsonData_InterestEvent& operator=(const JsonData_InterestEvent& other) + { + Add(_T("appId"), &AppId); + AppId = other.AppId; + Add(_T("type"), &Type); + Type = other.Type; + Add(_T("reason"), &Reason); + Reason = other.Reason; + Add(_T("entity"), &Entity); + Entity = other.Entity; + return (*this); + } + + public: + FireboltSDK::JSON::String AppId; + Firebolt::Discovery::JsonData_InterestType Type; + Firebolt::Discovery::JsonData_InterestReason Reason; + Firebolt::Entity::JsonData_EntityDetails Entity; + }; + + class ContentImpl : public IContent, public IModule { + + public: + ContentImpl() = default; + ContentImpl(const ContentImpl&) = delete; + ContentImpl& operator=(const ContentImpl&) = delete; + + ~ContentImpl() override = default; + + // Methods & Events + // signature callback params: + // method result properties : + void subscribe( IContent::IOnUserInterestNotification& notification, Firebolt::Error *err = nullptr ) override; + void unsubscribe( IContent::IOnUserInterestNotification& notification, Firebolt::Error *err = nullptr ) override; + + /* + requestUserInterest + Provide information about the entity currently displayed or selected on the screen. + */ + InterestResult requestUserInterest( const Discovery::InterestType& type, const Discovery::InterestReason& reason, Firebolt::Error *err = nullptr ) override; + + }; + +}//namespace ${info.Title} +}${end.if.implementations} diff --git a/src/sdks/manage/CHANGELOG.md b/src/sdks/manage/CHANGELOG.md index 23aeda267..67b8021bb 100644 --- a/src/sdks/manage/CHANGELOG.md +++ b/src/sdks/manage/CHANGELOG.md @@ -1,3 +1,5 @@ +# 1.3.0 (https://github.com/rdkcentral/firebolt-apis/compare/v1.2.0...v1.3.0) (2024-08-12) + # 1.2.0 (https://github.com/rdkcentral/firebolt-apis/compare/v1.1.0...v1.2.0) (2024-06-14) # [1.1.0](https://github.com/rdkcentral/firebolt-apis/compare/v1.0.0...v1.1.0) (2024-02-09) diff --git a/src/sdks/manage/package.json b/src/sdks/manage/package.json index ef8c41e66..bb529e583 100644 --- a/src/sdks/manage/package.json +++ b/src/sdks/manage/package.json @@ -1,6 +1,6 @@ { "name": "@firebolt-js/manage-sdk", - "version": "1.2.1-next.2", + "version": "1.3.1-next.1", "description": "The Firebolt Manage JS SDK", "main": "./dist/lib/firebolt-manage.mjs", "types": "./dist/lib/firebolt-manage.d.ts", diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/Main.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/Main.cpp index c28aa7e0c..4d2698dbe 100644 --- a/src/sdks/manage/src/cpp/sdk/cpptest/Main.cpp +++ b/src/sdks/manage/src/cpp/sdk/cpptest/Main.cpp @@ -1,3 +1,21 @@ +/* + * 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 #include #include diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.cpp index f8a388724..6dde2c9c2 100644 --- a/src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.cpp +++ b/src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.cpp @@ -617,9 +617,7 @@ void ManageSDKTest::KeyboardProvider::SendMessage(bool response) cout << _parameters.message << " : "; getline(cin, key); if (response) { - Firebolt::Keyboard::KeyboardResult keyboardResult; - keyboardResult.text = key; - keyboardResult.canceled = false; + std::string keyboardResult = key; cout << " Invoking _session->result " << endl; _session->result(keyboardResult); } else {