diff --git a/.github/workflows/release-github.yml b/.github/workflows/release-github.yml index 97a1c6e1c..5ffe10c3e 100644 --- a/.github/workflows/release-github.yml +++ b/.github/workflows/release-github.yml @@ -6,6 +6,12 @@ on: - 'main' - 'next' - 'next-major' + - 'proposed' + pull_request: + types: [opened, synchronize] + branches: + - 'next' + - 'proposed' env: HUSKY: 0 jobs: @@ -44,25 +50,33 @@ jobs: run: | echo "Setting RELEASE_CHANNEL to '$(node ./src/js/version.mjs channel $NPM_DIST_TAG)' using branch name '$NPM_DIST_TAG'" echo "RELEASE_CHANNEL=$(node ./src/js/version.mjs channel $NPM_DIST_TAG)" >> $GITHUB_ENV + - name: Override release channel for PRs + if: github.event_name == 'pull_request' + run: | + echo "Setting RELEASE_CHANNEL to 'pr${{ github.event.number }}'" + echo "RELEASE_CHANNEL=pr${{ github.event.number }}" >> $GITHUB_ENV - name: Release mono-artifact to GitHub - if: github.ref_name != 'main' || github.event_name == 'workflow_dispatch' + if: (github.ref_name != 'main' && github.event_name != 'pull_request') || github.event_name == 'workflow_dispatch' env: GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_BOT_PAT }} # <-- Allows semantic-release-bot to push changes to protected branches npm_config_tag: ${{ env.NPM_DIST_TAG }} # <-- For main, this is `latest.` Otherwise, `next`, `next-major`, etc. See ./.releaserc for release branch config. run: npx semantic-release - name: Dry-run mono-artifact - if: github.ref_name == 'main' && github.event_name != 'workflow_dispatch' + if: (github.ref_name == 'main' && github.event_name != 'workflow_dispatch') || github.event_name == 'pull_request' env: GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_BOT_PAT }} # <-- Allows semantic-release-bot to push changes to protected branches npm_config_tag: ${{ env.NPM_DIST_TAG }} # <-- For main, this is `latest.` Otherwise, `next`, `next-major`, etc. See ./.releaserc for release branch config. run: npx semantic-release --dry-run + - name: Build artifacts for PRs + if: github.event_name == 'pull_request' + run: npm run dist - name: Check if semantic-release created a build id: check_build uses: andstor/file-existence-action@v2 with: files: "./src/sdks/core/dist/lib/firebolt.mjs" - name: Release Firebolt SDKs to NPM - if: steps.check_build.outputs.files_exists == 'true' && (github.ref_name != 'main' || github.event_name == 'workflow_dispatch') + if: steps.check_build.outputs.files_exists == 'true' && github.event_name != 'pull_request' && (github.ref_name != 'main' || github.event_name == 'workflow_dispatch') env: NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }} # <-- Allows semantic-release to publish to npm without 2 factor auth. npm_config_tag: ${{ env.NPM_DIST_TAG }} # <-- For main, this is `latest.` Otherwise, `next`, `next-major`, etc. See ./.releaserc for release branch config. @@ -87,10 +101,10 @@ jobs: GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_BOT_PAT }} # <-- Allows semantic-release-bot to push changes to protected branches npm_config_tag: ${{ env.NPM_DIST_TAG }} # <-- For main, this is `latest.` Otherwise, `next`, `next-major`, etc. See ./.releaserc for release branch config. run: | - npm run publish:docs /tmp/firebolt-docs + npm run publish:docs /tmp/firebolt-docs $RELEASE_CHANNEL cd /tmp/firebolt-docs git config --global user.email "you@example.com" git config --global user.name "Your Name" git add --all - git commit -m "chore: Publish $RELEASE_CHANNEL" + git diff-index --quiet HEAD || git commit -m "chore: Publish $RELEASE_CHANNEL" git push diff --git a/.releaserc b/.releaserc index e309bb4dd..c5635fd72 100644 --- a/.releaserc +++ b/.releaserc @@ -13,6 +13,11 @@ "name": "next-major", "channel": "next-major", "prerelease": true + }, + { + "name": "proposed", + "channel": "proposed", + "prerelease": true } ], "dryRun": false, @@ -48,6 +53,16 @@ { "assets": "./*.tgz" } - ] + ], + [ + "@saithodev/semantic-release-backmerge", + { + "backmergeStrategy": "merge", + "mergeMode": "theirs", + "backmergeBranches": [ + { "from": "main", "to": "next" } + ] + } + ] ] } diff --git a/CHANGELOG.md b/CHANGELOG.md index 3aca9e12e..d65d2e333 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,246 @@ -# [0.14.0-next.8](https://github.com/rdkcentral/firebolt-apis/compare/v0.14.0-next.7...v0.14.0-next.8) (2023-06-27) +# [0.18.0-next.4](https://github.com/rdkcentral/firebolt-apis/compare/v0.18.0-next.3...v0.18.0-next.4) (2023-10-24) ### Bug Fixes +* Account.session params to be mandatory ([#196](https://github.com/rdkcentral/firebolt-apis/issues/196)) ([fc5c638](https://github.com/rdkcentral/firebolt-apis/commit/fc5c63886d9b4eb30b32c1edc75f0f6afe80a827)) + +# [0.18.0-next.3](https://github.com/rdkcentral/firebolt-apis/compare/v0.18.0-next.2...v0.18.0-next.3) (2023-10-10) + + +### Bug Fixes + +* Updated Discovery.launch example with xrn:firebolt:application-type ([#187](https://github.com/rdkcentral/firebolt-apis/issues/187)) ([4dbbab3](https://github.com/rdkcentral/firebolt-apis/commit/4dbbab3d9fa68c0e5185ca72fd0170bae8a30139)) + +# [0.18.0-next.2](https://github.com/rdkcentral/firebolt-apis/compare/v0.18.0-next.1...v0.18.0-next.2) (2023-09-26) + + +### Bug Fixes + +* Updated metrics:distributor capability to could ([#185](https://github.com/rdkcentral/firebolt-apis/issues/185)) ([9ca2206](https://github.com/rdkcentral/firebolt-apis/commit/9ca2206a2dca7149dcf93df3d303806d136785ed)) + +# [0.18.0-next.1](https://github.com/rdkcentral/firebolt-apis/compare/v0.17.1...v0.18.0-next.1) (2023-09-26) + + +### Features + +* Added optional parameter 'force' in usergrants.request ([#186](https://github.com/rdkcentral/firebolt-apis/issues/186)) ([31801ca](https://github.com/rdkcentral/firebolt-apis/commit/31801caec6bea0e8b295ea6a9ec54ca1d8e08d16)) + +## [0.17.1](https://github.com/rdkcentral/firebolt-apis/compare/v0.17.0...v0.17.1) (2023-09-15) + + +### Bug Fixes + +* Add enumerated values for fontFamily/fontEdge ([#181](https://github.com/rdkcentral/firebolt-apis/issues/181)) ([de35cb8](https://github.com/rdkcentral/firebolt-apis/commit/de35cb8073438f945bb4b7a8e8f420b8d6ba2358)) +* Add proposed branch to .releaserc ([e65e43f](https://github.com/rdkcentral/firebolt-apis/commit/e65e43f47113e72b79c09d9fa89b2d9d3dad9e9d)) +* Add proposed branch to CI builds ([8a5c142](https://github.com/rdkcentral/firebolt-apis/commit/8a5c142def4b50a2f83836bf85b8c51889793890)) +* Deploy GitHub.io docs for PRs ([#180](https://github.com/rdkcentral/firebolt-apis/issues/180)) ([7ef7d9d](https://github.com/rdkcentral/firebolt-apis/commit/7ef7d9dac20d73591b6c3391a8afbbfd55a717e7)) + +## [0.17.1-next.4](https://github.com/rdkcentral/firebolt-apis/compare/v0.17.1-next.3...v0.17.1-next.4) (2023-09-12) + + +### Bug Fixes + +* Add enumerated values for fontFamily/fontEdge ([#181](https://github.com/rdkcentral/firebolt-apis/issues/181)) ([de35cb8](https://github.com/rdkcentral/firebolt-apis/commit/de35cb8073438f945bb4b7a8e8f420b8d6ba2358)) + +## [0.17.1-next.3](https://github.com/rdkcentral/firebolt-apis/compare/v0.17.1-next.2...v0.17.1-next.3) (2023-09-12) + + +### Bug Fixes + +* Add proposed branch to .releaserc ([e65e43f](https://github.com/rdkcentral/firebolt-apis/commit/e65e43f47113e72b79c09d9fa89b2d9d3dad9e9d)) + +## [0.17.1-next.2](https://github.com/rdkcentral/firebolt-apis/compare/v0.17.1-next.1...v0.17.1-next.2) (2023-09-12) + + +### Bug Fixes + +* Add proposed branch to CI builds ([8a5c142](https://github.com/rdkcentral/firebolt-apis/commit/8a5c142def4b50a2f83836bf85b8c51889793890)) + +## [0.17.1-next.1](https://github.com/rdkcentral/firebolt-apis/compare/v0.17.0...v0.17.1-next.1) (2023-09-08) + + +### Bug Fixes + +* Deploy GitHub.io docs for PRs ([#180](https://github.com/rdkcentral/firebolt-apis/issues/180)) ([7ef7d9d](https://github.com/rdkcentral/firebolt-apis/commit/7ef7d9dac20d73591b6c3391a8afbbfd55a717e7)) + +# [0.17.0](https://github.com/rdkcentral/firebolt-apis/compare/v0.16.0...v0.17.0) (2023-09-07) + + +### Bug Fixes + +* Manual merge of main to next ([6a11710](https://github.com/rdkcentral/firebolt-apis/commit/6a11710d3c8028ebbe70b39a27f4944184b93181)) +* Point to production firebolt-openrpc ([a367307](https://github.com/rdkcentral/firebolt-apis/commit/a367307d45dbdebfd3d1bf17a87113bc220ea93f)) +* Reduce font size on capability index headers ([6c1487b](https://github.com/rdkcentral/firebolt-apis/commit/6c1487bf65ac005028c60759bcace8550156e987)) +* **transport:** Add test for lazy-loading the transport layer ([#10](https://github.com/rdkcentral/firebolt-apis/issues/10)) ([168fcaf](https://github.com/rdkcentral/firebolt-apis/commit/168fcaf4e6264cc0c2498f02c16523fb4a51cdd3)), closes [#164](https://github.com/rdkcentral/firebolt-apis/issues/164) [#157](https://github.com/rdkcentral/firebolt-apis/issues/157) [#157](https://github.com/rdkcentral/firebolt-apis/issues/157) [#159](https://github.com/rdkcentral/firebolt-apis/issues/159) [#159](https://github.com/rdkcentral/firebolt-apis/issues/159) +* Unit test cases for setting null value ([#159](https://github.com/rdkcentral/firebolt-apis/issues/159)) ([7e011e2](https://github.com/rdkcentral/firebolt-apis/commit/7e011e2937842902c6b111646492b33a057b23c8)) +* Update firebolt-openrpc, fix tests ([9480984](https://github.com/rdkcentral/firebolt-apis/commit/948098490595ffa374df08f3f44157d70beb7990)) +* Update firebolt-openrpc, fix tests ([312b5ec](https://github.com/rdkcentral/firebolt-apis/commit/312b5ec627e9b494ac455475efe7851bed70c34e)) +* Update package.json to point to release 2.0.4 of `firebolt-openrpc` ([9e3cf55](https://github.com/rdkcentral/firebolt-apis/commit/9e3cf55d465d3b429ebcba0167e888eb7d7f0588)) +* update to firebolt-openrpc, c tests ([#176](https://github.com/rdkcentral/firebolt-apis/issues/176)) ([3984a78](https://github.com/rdkcentral/firebolt-apis/commit/3984a781d871ab9b35aecbab77157b635e4f638f)), closes [#140](https://github.com/rdkcentral/firebolt-apis/issues/140) +* Using 3 letter ISO639 language codes ([#173](https://github.com/rdkcentral/firebolt-apis/issues/173)) ([b341dee](https://github.com/rdkcentral/firebolt-apis/commit/b341deedd9ac8ab00f3e762622fda29872f83932)) + + +### Features + +* Added manage apis for windlowColor and windowOpacity ([#157](https://github.com/rdkcentral/firebolt-apis/issues/157)) ([f508358](https://github.com/rdkcentral/firebolt-apis/commit/f508358aeb2f58bb3893bbfaf09e2340fcadac8f)) + +# [0.17.0-next.3](https://github.com/rdkcentral/firebolt-apis/compare/v0.17.0-next.2...v0.17.0-next.3) (2023-09-07) + + +### Bug Fixes + +* Point to production firebolt-openrpc ([a367307](https://github.com/rdkcentral/firebolt-apis/commit/a367307d45dbdebfd3d1bf17a87113bc220ea93f)) + +# [0.17.0-next.2](https://github.com/rdkcentral/firebolt-apis/compare/v0.17.0-next.1...v0.17.0-next.2) (2023-09-05) + + +### Bug Fixes + +* update to firebolt-openrpc, c tests ([#176](https://github.com/rdkcentral/firebolt-apis/issues/176)) ([3984a78](https://github.com/rdkcentral/firebolt-apis/commit/3984a781d871ab9b35aecbab77157b635e4f638f)), closes [#140](https://github.com/rdkcentral/firebolt-apis/issues/140) + +# [0.17.0-next.1](https://github.com/rdkcentral/firebolt-apis/compare/v0.16.0...v0.17.0-next.1) (2023-09-01) + + +### Bug Fixes + +* Manual merge of main to next ([6a11710](https://github.com/rdkcentral/firebolt-apis/commit/6a11710d3c8028ebbe70b39a27f4944184b93181)) +* Reduce font size on capability index headers ([6c1487b](https://github.com/rdkcentral/firebolt-apis/commit/6c1487bf65ac005028c60759bcace8550156e987)) +* **transport:** Add test for lazy-loading the transport layer ([#10](https://github.com/rdkcentral/firebolt-apis/issues/10)) ([168fcaf](https://github.com/rdkcentral/firebolt-apis/commit/168fcaf4e6264cc0c2498f02c16523fb4a51cdd3)), closes [#164](https://github.com/rdkcentral/firebolt-apis/issues/164) [#157](https://github.com/rdkcentral/firebolt-apis/issues/157) [#157](https://github.com/rdkcentral/firebolt-apis/issues/157) [#159](https://github.com/rdkcentral/firebolt-apis/issues/159) [#159](https://github.com/rdkcentral/firebolt-apis/issues/159) +* Unit test cases for setting null value ([#159](https://github.com/rdkcentral/firebolt-apis/issues/159)) ([7e011e2](https://github.com/rdkcentral/firebolt-apis/commit/7e011e2937842902c6b111646492b33a057b23c8)) +* Update firebolt-openrpc, fix tests ([9480984](https://github.com/rdkcentral/firebolt-apis/commit/948098490595ffa374df08f3f44157d70beb7990)) +* Update firebolt-openrpc, fix tests ([312b5ec](https://github.com/rdkcentral/firebolt-apis/commit/312b5ec627e9b494ac455475efe7851bed70c34e)) +* Update package.json to point to release 2.0.4 of `firebolt-openrpc` ([9e3cf55](https://github.com/rdkcentral/firebolt-apis/commit/9e3cf55d465d3b429ebcba0167e888eb7d7f0588)) +* Using 3 letter ISO639 language codes ([#173](https://github.com/rdkcentral/firebolt-apis/issues/173)) ([b341dee](https://github.com/rdkcentral/firebolt-apis/commit/b341deedd9ac8ab00f3e762622fda29872f83932)) + + +### Features + +* Added manage apis for windlowColor and windowOpacity ([#157](https://github.com/rdkcentral/firebolt-apis/issues/157)) ([f508358](https://github.com/rdkcentral/firebolt-apis/commit/f508358aeb2f58bb3893bbfaf09e2340fcadac8f)) + +# [0.16.0](https://github.com/rdkcentral/firebolt-apis/compare/v0.15.0...v0.16.0) (2023-08-14) + + +### Features + +* Added Manage APIs for `windowColor` and `windowOpacity` ([#164](https://github.com/rdkcentral/firebolt-apis/issues/164)) ([99b9fa6](https://github.com/rdkcentral/firebolt-apis/commit/99b9fa60d3987e7a8d5e7230e7401cae7d2d352c)), closes [#157](https://github.com/rdkcentral/firebolt-apis/issues/157) [#157](https://github.com/rdkcentral/firebolt-apis/issues/157) [#159](https://github.com/rdkcentral/firebolt-apis/issues/159) [#159](https://github.com/rdkcentral/firebolt-apis/issues/159) +# [0.16.0-next.4](https://github.com/rdkcentral/firebolt-apis/compare/v0.16.0-next.3...v0.16.0-next.4) (2023-09-01) + + +### Bug Fixes + +* Reduce font size on capability index headers ([6c1487b](https://github.com/rdkcentral/firebolt-apis/commit/6c1487bf65ac005028c60759bcace8550156e987)) +* **transport:** Add test for lazy-loading the transport layer ([#10](https://github.com/rdkcentral/firebolt-apis/issues/10)) ([168fcaf](https://github.com/rdkcentral/firebolt-apis/commit/168fcaf4e6264cc0c2498f02c16523fb4a51cdd3)), closes [#164](https://github.com/rdkcentral/firebolt-apis/issues/164) [#157](https://github.com/rdkcentral/firebolt-apis/issues/157) [#157](https://github.com/rdkcentral/firebolt-apis/issues/157) [#159](https://github.com/rdkcentral/firebolt-apis/issues/159) [#159](https://github.com/rdkcentral/firebolt-apis/issues/159) +* Using 3 letter ISO639 language codes ([#173](https://github.com/rdkcentral/firebolt-apis/issues/173)) ([b341dee](https://github.com/rdkcentral/firebolt-apis/commit/b341deedd9ac8ab00f3e762622fda29872f83932)) + +# [0.16.0-next.3](https://github.com/rdkcentral/firebolt-apis/compare/v0.16.0-next.2...v0.16.0-next.3) (2023-08-14) + + +### Bug Fixes + +* Update package.json to point to release 2.0.4 of `firebolt-openrpc` ([9e3cf55](https://github.com/rdkcentral/firebolt-apis/commit/9e3cf55d465d3b429ebcba0167e888eb7d7f0588)) + +# [0.16.0-next.2](https://github.com/rdkcentral/firebolt-apis/compare/v0.16.0-next.1...v0.16.0-next.2) (2023-08-10) + + +### Bug Fixes + +* Unit test cases for setting null value ([#159](https://github.com/rdkcentral/firebolt-apis/issues/159)) ([7e011e2](https://github.com/rdkcentral/firebolt-apis/commit/7e011e2937842902c6b111646492b33a057b23c8)) +* Update firebolt-openrpc, fix tests ([9480984](https://github.com/rdkcentral/firebolt-apis/commit/948098490595ffa374df08f3f44157d70beb7990)) +* Update firebolt-openrpc, fix tests ([312b5ec](https://github.com/rdkcentral/firebolt-apis/commit/312b5ec627e9b494ac455475efe7851bed70c34e)) + +# [0.16.0-next.1](https://github.com/rdkcentral/firebolt-apis/compare/v0.15.0...v0.16.0-next.1) (2023-08-07) + + +### Features + +* Added manage apis for windlowColor and windowOpacity ([#157](https://github.com/rdkcentral/firebolt-apis/issues/157)) ([f508358](https://github.com/rdkcentral/firebolt-apis/commit/f508358aeb2f58bb3893bbfaf09e2340fcadac8f)) + +# [0.15.0](https://github.com/rdkcentral/firebolt-apis/compare/v0.14.0...v0.15.0) (2023-07-31) + + +### Bug Fixes + +* CHANGELOGs for 0.15 ([#152](https://github.com/rdkcentral/firebolt-apis/issues/152)) ([667f7a4](https://github.com/rdkcentral/firebolt-apis/commit/667f7a4620b3726a48e9071af6f5a9cfaf1c3ec8)) +* CI weirdness ([b72990f](https://github.com/rdkcentral/firebolt-apis/commit/b72990f5363b5ce37aa09e80a2b2daffc209216a)) * Rename Advisory "Committee" to "Board" ([#135](https://github.com/rdkcentral/firebolt-apis/issues/135)) ([ef410c4](https://github.com/rdkcentral/firebolt-apis/commit/ef410c43bbb32414c3aa1d11b43093565cc90edf)) +* Update package-lock.json ([767fc65](https://github.com/rdkcentral/firebolt-apis/commit/767fc658b5ac2020f5d6eca82c8734baf0200fd8)) +* Updating package.json ([dd438b7](https://github.com/rdkcentral/firebolt-apis/commit/dd438b77c18c4565fd91a88e3394e5ce7c2cecff)) +* Upgrade to `firebolt-js/openrpc` version 2.0.3 ([c0a2647](https://github.com/rdkcentral/firebolt-apis/commit/c0a26475dba5059f9fc6ceb11bcb103bb355cceb)) +* window fix from firebolt-openrpc 2.0.3-next.1 ([8c06dd1](https://github.com/rdkcentral/firebolt-apis/commit/8c06dd1432822719f5634e2877b36efdf02a4809)) + + +### Features + +* Added support to set and get null in ClosedCaptions style fields ([#150](https://github.com/rdkcentral/firebolt-apis/issues/150)) ([9c511e4](https://github.com/rdkcentral/firebolt-apis/commit/9c511e4fddebcdf5dfc04e9e8e31f98ab7eef680)) +* Added windowColor and windowOpacity to closedCaptions style ([#145](https://github.com/rdkcentral/firebolt-apis/issues/145)) ([f65b901](https://github.com/rdkcentral/firebolt-apis/commit/f65b9019bda22400df9b9634c332e720db38118d)) +* Audio Description and Preferred Audio Languages Settings ([#45](https://github.com/rdkcentral/firebolt-apis/issues/45)) ([58f6ea1](https://github.com/rdkcentral/firebolt-apis/commit/58f6ea1dde7a819883eb3da24f879b6a9ecc9a41)) + +# [0.15.0-next.4](https://github.com/rdkcentral/firebolt-apis/compare/v0.15.0-next.3...v0.15.0-next.4) (2023-07-31) + + +### Bug Fixes + +* CHANGELOGs for 0.15 ([#152](https://github.com/rdkcentral/firebolt-apis/issues/152)) ([667f7a4](https://github.com/rdkcentral/firebolt-apis/commit/667f7a4620b3726a48e9071af6f5a9cfaf1c3ec8)) +* Update package-lock.json ([767fc65](https://github.com/rdkcentral/firebolt-apis/commit/767fc658b5ac2020f5d6eca82c8734baf0200fd8)) + +# [0.15.0-next.3](https://github.com/rdkcentral/firebolt-apis/compare/v0.15.0-next.2...v0.15.0-next.3) (2023-07-31) + + +### Features + +* Audio Description and Preferred Audio Languages Settings ([#45](https://github.com/rdkcentral/firebolt-apis/issues/45)) ([58f6ea1](https://github.com/rdkcentral/firebolt-apis/commit/58f6ea1dde7a819883eb3da24f879b6a9ecc9a41)) + +# [0.15.0-next.2](https://github.com/rdkcentral/firebolt-apis/compare/v0.15.0-next.1...v0.15.0-next.2) (2023-07-28) + + +### Bug Fixes + +* CI weirdness ([b72990f](https://github.com/rdkcentral/firebolt-apis/commit/b72990f5363b5ce37aa09e80a2b2daffc209216a)) +* Updating package.json ([dd438b7](https://github.com/rdkcentral/firebolt-apis/commit/dd438b77c18c4565fd91a88e3394e5ce7c2cecff)) + +# [0.15.0-next.1](https://github.com/rdkcentral/firebolt-apis/compare/v0.14.0...v0.15.0-next.1) (2023-07-27) + + +### Bug Fixes + +* Rename Advisory "Committee" to "Board" ([#135](https://github.com/rdkcentral/firebolt-apis/issues/135)) ([ef410c4](https://github.com/rdkcentral/firebolt-apis/commit/ef410c43bbb32414c3aa1d11b43093565cc90edf)) +* window fix from firebolt-openrpc 2.0.3-next.1 ([8c06dd1](https://github.com/rdkcentral/firebolt-apis/commit/8c06dd1432822719f5634e2877b36efdf02a4809)) + + +### Features + +* Added support to set and get null in ClosedCaptions style fields ([#150](https://github.com/rdkcentral/firebolt-apis/issues/150)) ([9c511e4](https://github.com/rdkcentral/firebolt-apis/commit/9c511e4fddebcdf5dfc04e9e8e31f98ab7eef680)) +* Added windowColor and windowOpacity to closedCaptions style ([#145](https://github.com/rdkcentral/firebolt-apis/issues/145)) ([f65b901](https://github.com/rdkcentral/firebolt-apis/commit/f65b9019bda22400df9b9634c332e720db38118d)) + +# [0.14.0-next.10](https://github.com/rdkcentral/firebolt-apis/compare/v0.14.0-next.8...v0.14.0-next.11) (2023-07-26) + +### Features + +* Added support to set and get null in ClosedCaptions style fields ([#150](https://github.com/rdkcentral/firebolt-apis/issues/150)) ([9c511e4](https://github.com/rdkcentral/firebolt-apis/commit/9c511e4fddebcdf5dfc04e9e8e31f98ab7eef680)) +* Added windowColor and windowOpacity to closedCaptions style ([#145](https://github.com/rdkcentral/firebolt-apis/issues/145)) ([f65b901](https://github.com/rdkcentral/firebolt-apis/commit/f65b9019bda22400df9b9634c332e720db38118d)) + +### Bug Fixes + +* window fix from firebolt-openrpc 2.0.3-next.1 ([8c06dd1](https://github.com/rdkcentral/firebolt-apis/commit/8c06dd1432822719f5634e2877b36efdf02a4809)) +* Rename Advisory "Committee" to "Board" ([#135](https://github.com/rdkcentral/firebolt-apis/issues/135)) ([ef410c4](https://github.com/rdkcentral/firebolt-apis/commit/ef410c43bbb32414c3aa1d11b43093565cc90edf)) + +# [0.14.0](https://github.com/rdkcentral/firebolt-apis/compare/v0.13.0...v0.14.0) (2023-06-22) + +* Add Capabilities ToC to github.io docs ([0d23136](https://github.com/rdkcentral/firebolt-apis/commit/0d23136bfa4976686795158bdfe179430598af9e)) +* **Advertising:** put resetAdvertisingIdentifier back in manage sdk ([ce92ae7](https://github.com/rdkcentral/firebolt-apis/commit/ce92ae7bfff58fa1d3e4bee78c88d5edf0266473)) +* event links in capability toc ([31a8a85](https://github.com/rdkcentral/firebolt-apis/commit/31a8a85c0749ebfa872f2a158975697396ebdf8c)) +* **governance:** Add governance process docs ([a80ab53](https://github.com/rdkcentral/firebolt-apis/commit/a80ab53c5cdd914b5acbce1effbdb464475bed63)) +* Move to `firebolt-openrpc` 2.0.2 ([52fe2a7](https://github.com/rdkcentral/firebolt-apis/commit/52fe2a78b17f1e36ec854fedd52d136cfa60b4e2)) +* package-lock.json ([dd8025c](https://github.com/rdkcentral/firebolt-apis/commit/dd8025c637a5ae58ce2e0355b995d55feeab9713)) +* Update path in publish docs ([9881383](https://github.com/rdkcentral/firebolt-apis/commit/98813833a074a6e25b012d2aac376377d8c5d5a9)) + + +### Features + +* Add an event when apps call signIn or signOut ([#133](https://github.com/rdkcentral/firebolt-apis/issues/133)) ([8ba2515](https://github.com/rdkcentral/firebolt-apis/commit/8ba2515948c433ccc38662f223f5fb399cf34841)) +* Allow granted in capability.info and capability.granted to be null ([#134](https://github.com/rdkcentral/firebolt-apis/issues/134)) ([c5c31ee](https://github.com/rdkcentral/firebolt-apis/commit/c5c31ee3c744ec018a57232d2e7b1caf41158ed6)) +* Change voice guidance limits to 0.5 and 2 ([#137](https://github.com/rdkcentral/firebolt-apis/issues/137)) ([b8f1944](https://github.com/rdkcentral/firebolt-apis/commit/b8f19449efd808639599b162aba61c08ec089c41)) # [0.14.0-next.7](https://github.com/rdkcentral/firebolt-apis/compare/v0.14.0-next.6...v0.14.0-next.7) (2023-06-22) diff --git a/package.json b/package.json index dc9f6c83f..93bc762e4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@firebolt-js/sdks", - "version": "0.16.0-test.1", + "version": "0.18.0-next.4", "description": "The Firebolt JS SDK", "type": "module", "bin": { @@ -15,7 +15,7 @@ "validate:each": "npx firebolt-openrpc validate --input src/openrpc --schemas node_modules/@firebolt-js/schemas/src/schemas --schemas src/schemas --transformations", "validate:compiled": "npx firebolt-openrpc validate --input dist/firebolt-open-rpc.json && npm run validate --workspaces", "validate": "npm run validate:each && npm run validate:compiled ", - "compile": "npx firebolt-openrpc openrpc --input src --template src/template/openrpc/template.json --output ./dist/firebolt-open-rpc.json --schemas src/schemas --schemas node_modules/@firebolt-js/schemas/src/schemas", + "compile": "npx firebolt-openrpc openrpc --input src --template src/template/openrpc/template.json --output ./dist/firebolt-open-rpc.json --schemas node_modules/@firebolt-js/schemas/src/schemas --schemas src/schemas", "slice": "npm run slice --workspaces", "sdks": "npm run sdk --workspaces", "docs": "npm run docs --workspaces", @@ -44,20 +44,21 @@ "devDependencies": { "@commitlint/cli": "^17.0.3", "@commitlint/config-conventional": "^17.0.3", - "@firebolt-js/openrpc": "2.0.2", - "@firebolt-js/schemas": "0.11.0", + "@firebolt-js/openrpc": "2.1.0", + "@firebolt-js/schemas": "1.0.0-next.0", + "@saithodev/semantic-release-backmerge": "^3.2.0", "@semantic-release/changelog": "^6.0.1", "@semantic-release/git": "^10.0.1", "@semantic-release/npm": "^9.0.1", "@semantic-release/release-notes-generator": "^10.0.1", "ajv": "^6.12.6", - "production-changelog": "./src/js/production-changelog/", "husky": "^8.0.0", "jest": "^28.1.0", "jest-environment-jsdom": "^28.1.3", "mkdirp": "^2.1.6", "nopt": "^7.1.0", - "semantic-release": "^19.0.5", + "production-changelog": "./src/js/production-changelog/", + "semantic-release": "^21.1.1", "typescript": "^4.6.4" }, "keywords": [ diff --git a/src/js/github.io/index.mjs b/src/js/github.io/index.mjs index 794d21f2b..1e7d8bd32 100644 --- a/src/js/github.io/index.mjs +++ b/src/js/github.io/index.mjs @@ -19,7 +19,7 @@ const parsedArgs = Object.assign(defaultOpts, nopt(knownOpts, shortHands, proces const signOff = () => console.log('\nThis has been a presentation of \x1b[38;5;202mFirebolt\x1b[0m \u{1F525} \u{1F529}\n') const packageJson = await readJson(process.env.npm_package_json) -const version = channel(packageJson.version) +const version = parsedArgs.argv.remain && parsedArgs.argv.remain[0] || channel(packageJson.version) const requirements = await readFiles(await readDir(path.join('.', 'requirements'), { recursive: true }), path.join('.', 'requirements')) const processFiles = (docs, base, dir, subdir, category, setType) => { @@ -120,7 +120,7 @@ const capabilities = () => { const linkify = (method) => `[${method}](./${corerpc.methods.find(m => m.name === method) ? 'core' : 'manage'}/${method.split('.').shift()}/#${method.match(/\.on[A-Z]/) ? method.split('.').pop().charAt(2).toLowerCase() + method.split('.').pop().substring(3).toLowerCase() : method.split('.').pop().toLowerCase()})` Object.keys(capabilities).sort().forEach(c => { - manifest += `## \`${c}\`\n` + manifest += `### \`${c}\`\n` if (capabilities[c].uses.length) { manifest += '\n| Uses |\n' diff --git a/src/js/version.mjs b/src/js/version.mjs index 970c2b5b1..0d7f17cdc 100644 --- a/src/js/version.mjs +++ b/src/js/version.mjs @@ -44,7 +44,7 @@ else if (task === 'channel') { .then(JSON.parse) // default to 'test' channel if branch is unknown - const config = releaserc.branches.find(b => b.name === branch) || { channel: 'test' } + const config = releaserc.branches.find(b => b.name === branch) || { channel: branch.split('/').pop() } const channel = config.channel || (!config.prerelease ? 'latest' : config.name) // return the configured channel name for the branch, otherwise return the branch name, unless it's the main branch, then return 'latest' diff --git a/src/json/firebolt-specification.json b/src/json/firebolt-specification.json index 204f530f1..e2796e824 100644 --- a/src/json/firebolt-specification.json +++ b/src/json/firebolt-specification.json @@ -149,6 +149,12 @@ }, "xrn:firebolt:capability:privacy:advertising": { "level": "could" + }, + "xrn:firebolt:capability:metrics:distributor": { + "level": "could" + }, + "xrn:firebolt:capability:storage:secure": { + "level": "could" } }, "apis": {} diff --git a/src/openrpc/accessibility.json b/src/openrpc/accessibility.json index 2f1e226a4..c010a6146 100644 --- a/src/openrpc/accessibility.json +++ b/src/openrpc/accessibility.json @@ -39,7 +39,7 @@ "value": { "enabled": true, "styles": { - "fontFamily": "Monospace sans-serif", + "fontFamily": "monospaced_sanserif", "fontSize": 1, "fontColor": "#ffffff", "fontEdge": "none", @@ -48,8 +48,14 @@ "backgroundColor": "#000000", "backgroundOpacity": 100, "textAlign": "center", - "textAlignVertical": "middle" - } + "textAlignVertical": "middle", + "windowColor": "white", + "windowOpacity": 50 + }, + "preferredLanguages": [ + "eng", + "spa" + ] } } } @@ -86,7 +92,7 @@ "value": { "enabled": true, "styles": { - "fontFamily": "Monospace sans-serif", + "fontFamily": "monospaced_sanserif", "fontSize": 1, "fontColor": "#ffffff", "fontEdge": "none", @@ -95,8 +101,14 @@ "backgroundColor": "#000000", "backgroundOpacity": 100, "textAlign": "center", - "textAlignVertical": "middle" - } + "textAlignVertical": "middle", + "windowColor": "white", + "windowOpacity": 50 + }, + "preferredLanguages": [ + "eng", + "spa" + ] } } } @@ -175,9 +187,56 @@ } } ] - } + }, + { + "name": "audioDescriptionSettings", + "summary": "Get the user's preferred audio description settings", + "params": [], + "tags": [ + { + "name": "property:readonly" + }, + { + "name": "capabilities", + "x-uses": [ + "xrn:firebolt:capability:accessibility:audiodescriptions" + ] + } + ], + "result": { + "name": "settings", + "summary": "the audio description settings", + "schema": { + "$ref": "#/components/schemas/AudioDescriptionSettings" + } + }, + "examples": [ + { + "name": "Getting the audio description settings", + "params": [], + "result": { + "name": "Default Result", + "value": { + "enabled": true + } + } + } + ] + } ], "components": { - "schemas": {} + "schemas": { + "AudioDescriptionSettings": { + "title": "AudioDescriptionSettings", + "type": "object", + "required": ["enabled"], + "properties": { + "enabled": { + "type": "boolean", + "description": "Whether or not audio descriptions should be enabled by default" + } + } + } + } } } \ No newline at end of file diff --git a/src/openrpc/account.json b/src/openrpc/account.json index ed641d20c..b4a5b81f2 100644 --- a/src/openrpc/account.json +++ b/src/openrpc/account.json @@ -86,12 +86,14 @@ "params": [ { "name": "token", + "required": true, "schema": { "$ref": "#/components/schemas/Token" } }, { "name": "expiresIn", + "required": true, "schema": { "$ref": "#/components/schemas/Expiry" } diff --git a/src/openrpc/advertising.json b/src/openrpc/advertising.json index 41e5ad51b..22a86b312 100644 --- a/src/openrpc/advertising.json +++ b/src/openrpc/advertising.json @@ -158,7 +158,16 @@ } ], "summary": "Get the advertising ID", - "params": [], + "params": [ + { + "name": "options", + "summary": "AdvertisingId options", + "required": false, + "schema": { + "$ref": "#/components/schemas/AdvertisingIdOptions" + } + } + ], "result": { "name": "advertisingId", "summary": "the advertising ID", @@ -192,6 +201,50 @@ "lmt": "0" } } + }, + { + "name": "Getting the advertising ID with scope browse", + "params": [ + { + "name": "options", + "value": { + "scope": { + "type": "browse", + "id": "paidPlacement" + } + } + } + ], + "result": { + "name": "Default Result", + "value": { + "ifa": "01234567-89AB-CDEF-GH01-23456789ABCD", + "ifa_type": "idfa", + "lmt": "0" + } + } + }, + { + "name": "Getting the advertising ID with scope content", + "params": [ + { + "name": "options", + "value": { + "scope": { + "type": "content", + "id": "metadata:linear:station:123" + } + } + } + ], + "result": { + "name": "Default Result", + "value": { + "ifa": "01234567-89AB-CDEF-GH01-23456789ABCD", + "ifa_type": "idfa", + "lmt": "0" + } + } } ] }, @@ -322,6 +375,35 @@ "description": "The authentication provider, when it is separate entity than the app provider, e.g. an MVPD." } } + }, + "AdvertisingIdOptions": { + "title": "AdvertisingIdOptions", + "type": "object", + "properties": { + "scope": { + "type": "object", + "description": "Provides the options to send scope type and id to select desired advertising id", + "required": [ + "type", + "id" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "browse", + "content" + ], + "default": "browse", + "description": "The scope type, which will determine where to show advertisement" + }, + "id": { + "type": "string", + "description": "A value that identifies a specific scope within the scope type" + } + } + } + } } } } diff --git a/src/openrpc/audio_descriptions.json b/src/openrpc/audio_descriptions.json new file mode 100644 index 000000000..fb909285e --- /dev/null +++ b/src/openrpc/audio_descriptions.json @@ -0,0 +1,57 @@ +{ + "openrpc": "1.2.4", + "info": { + "title": "AudioDescriptions", + "description": "A module for managing audio-description Settings.", + "version": "0.0.0" + }, + "methods": [ + { + "name": "enabled", + "tags": [ + { + "name": "property" + }, + { + "name": "capabilities", + "x-uses": [ + "xrn:firebolt:capability:accessibility:audiodescriptions" + ] + } + ], + "summary": "Whether or not audio-descriptions are enabled.", + "params": [ + ], + "result": { + "name": "enabled", + "schema": { + "type": "boolean" + } + }, + "examples": [ + { + "name": "Default example #1", + "params": [ + ], + "result": { + "name": "enabled", + "value": true + } + }, + { + "name": "Default example #2", + "params": [ + ], + "result": { + "name": "enabled", + "value": false + } + } + ] + } + ], + "components": { + "schemas": { + } + } +} \ No newline at end of file diff --git a/src/openrpc/capabilities.json b/src/openrpc/capabilities.json index 892f0e493..e2b35f8af 100644 --- a/src/openrpc/capabilities.json +++ b/src/openrpc/capabilities.json @@ -563,7 +563,7 @@ } ], "result": { - "name": "Default Result", + "name": "request", "summary": "Returns an array of CapabilityInfo objects for the passed in capabilities.", "schema": { "type": "array", @@ -907,4 +907,4 @@ } } } -} \ No newline at end of file +} diff --git a/src/openrpc/closed_captions.json b/src/openrpc/closed_captions.json index a3a0c6659..90fd21e90 100644 --- a/src/openrpc/closed_captions.json +++ b/src/openrpc/closed_captions.json @@ -59,7 +59,7 @@ ] } ], - "summary": "The prefered font family for displaying closed-captions.", + "summary": "The preferred font family for displaying closed-captions.", "params": [], "result": { "name": "family", @@ -73,7 +73,7 @@ "params": [], "result": { "name": "family", - "value": "monospace" + "value": "monospaced_sanserif" } }, { @@ -83,6 +83,14 @@ "name": "family", "value": "cursive" } + }, + { + "name": "Default example #3", + "params": [], + "result": { + "name": "family", + "value": null + } } ] }, @@ -99,7 +107,7 @@ ] } ], - "summary": "The prefered font size for displaying closed-captions.", + "summary": "The preferred font size for displaying closed-captions.", "params": [], "result": { "name": "size", @@ -123,6 +131,14 @@ "name": "size", "value": 1 } + }, + { + "name": "Default example #3", + "params": [], + "result": { + "name": "size", + "value": null + } } ] }, @@ -139,7 +155,7 @@ ] } ], - "summary": "The prefered font color for displaying closed-captions.", + "summary": "The preferred font color for displaying closed-captions.", "params": [], "result": { "name": "color", @@ -163,6 +179,14 @@ "name": "color", "value": "#000000" } + }, + { + "name": "Default example #3", + "params": [], + "result": { + "name": "color", + "value": null + } } ] }, @@ -179,7 +203,7 @@ ] } ], - "summary": "The prefered font edge style for displaying closed-captions.", + "summary": "The preferred font edge style for displaying closed-captions.", "params": [], "result": { "name": "edge", @@ -201,7 +225,15 @@ "params": [], "result": { "name": "edge", - "value": "solid" + "value": "uniform" + } + }, + { + "name": "Default example #3", + "params": [], + "result": { + "name": "edge", + "value": null } } ] @@ -219,7 +251,7 @@ ] } ], - "summary": "The prefered font edge color for displaying closed-captions.", + "summary": "The preferred font edge color for displaying closed-captions.", "params": [], "result": { "name": "color", @@ -243,6 +275,14 @@ "name": "color", "value": "#ffffff" } + }, + { + "name": "Default example #3", + "params": [], + "result": { + "name": "color", + "value": null + } } ] }, @@ -259,7 +299,7 @@ ] } ], - "summary": "The prefered opacity for displaying closed-captions characters.", + "summary": "The preferred opacity for displaying closed-captions characters.", "params": [], "result": { "name": "opacity", @@ -283,6 +323,14 @@ "name": "opacity", "value": 100 } + }, + { + "name": "Default example #3", + "params": [], + "result": { + "name": "opacity", + "value": null + } } ] }, @@ -299,7 +347,7 @@ ] } ], - "summary": "The prefered background color for displaying closed-captions, .", + "summary": "The preferred background color for displaying closed-captions, .", "params": [], "result": { "name": "color", @@ -323,6 +371,14 @@ "name": "color", "value": "#ffffff" } + }, + { + "name": "Default example #3", + "params": [], + "result": { + "name": "color", + "value": null + } } ] }, @@ -339,7 +395,7 @@ ] } ], - "summary": "The prefered opacity for displaying closed-captions backgrounds.", + "summary": "The preferred opacity for displaying closed-captions backgrounds.", "params": [], "result": { "name": "opacity", @@ -363,6 +419,14 @@ "name": "opacity", "value": 100 } + }, + { + "name": "Default example #3", + "params": [], + "result": { + "name": "opacity", + "value": null + } } ] }, @@ -379,10 +443,10 @@ ] } ], - "summary": "The prefered horizontal alignment for displaying closed-captions characters.", + "summary": "The preferred horizontal alignment for displaying closed-captions characters.", "params": [], "result": { - "name": "opacity", + "name": "alignment", "schema": { "$ref": "https://meta.comcast.com/firebolt/accessibility#/definitions/HorizontalAlignment" } @@ -392,7 +456,7 @@ "name": "Default example #1", "params": [], "result": { - "name": "aligment", + "name": "alignment", "value": "center" } }, @@ -400,9 +464,17 @@ "name": "Default example #2", "params": [], "result": { - "name": "aligment", + "name": "alignment", "value": "left" } + }, + { + "name": "Default example #3", + "params": [], + "result": { + "name": "alignment", + "value": null + } } ] }, @@ -419,10 +491,10 @@ ] } ], - "summary": "The prefered horizontal alignment for displaying closed-captions characters.", + "summary": "The preferred horizontal alignment for displaying closed-captions characters.", "params": [], "result": { - "name": "opacity", + "name": "alignment", "schema": { "$ref": "https://meta.comcast.com/firebolt/accessibility#/definitions/VerticalAlignment" } @@ -432,7 +504,7 @@ "name": "Default example #1", "params": [], "result": { - "name": "alignement", + "name": "alignment", "value": "middle" } }, @@ -440,9 +512,163 @@ "name": "Default example #2", "params": [], "result": { - "name": "alignement", + "name": "alignment", "value": "top" } + }, + { + "name": "Default example #3", + "params": [], + "result": { + "name": "alignment", + "value": null + } + } + ] + }, + { + "name": "windowColor", + "tags": [ + { + "name": "property" + }, + { + "name": "capabilities", + "x-uses": [ + "xrn:firebolt:capability:accessibility:closedcaptions" + ] + } + ], + "summary": "The preferred window color for displaying closed-captions, .", + "params": [], + "result": { + "name": "color", + "schema": { + "$ref": "https://meta.comcast.com/firebolt/accessibility#/definitions/Color" + } + }, + "examples": [ + { + "name": "Default example #1", + "params": [], + "result": { + "name": "color", + "value": "#000000" + } + }, + { + "name": "Default example #2", + "params": [], + "result": { + "name": "color", + "value": "white" + } + }, + { + "name": "Default example #3", + "params": [], + "result": { + "name": "color", + "value": null + } + } + ] + }, + { + "name": "windowOpacity", + "tags": [ + { + "name": "property" + }, + { + "name": "capabilities", + "x-uses": [ + "xrn:firebolt:capability:accessibility:closedcaptions" + ] + } + ], + "summary": "The preferred window opacity for displaying closed-captions backgrounds.", + "params": [], + "result": { + "name": "opacity", + "schema": { + "$ref": "https://meta.comcast.com/firebolt/accessibility#/definitions/Opacity" + } + }, + "examples": [ + { + "name": "Default example #1", + "params": [], + "result": { + "name": "opacity", + "value": 99 + } + }, + { + "name": "Default example #2", + "params": [], + "result": { + "name": "opacity", + "value": 100 + } + }, + { + "name": "Default example #3", + "params": [], + "result": { + "name": "opacity", + "value": null + } + } + ] + }, + { + "name": "preferredLanguages", + "summary": "A prioritized list of ISO 639-2/B codes for the preferred closed captions languages on this device.", + "params": [], + "tags": [ + { + "name": "property" + }, + { + "name": "capabilities", + "x-uses": [ + "xrn:firebolt:capability:accessibility:closedcaptions" + ] + } + ], + "result": { + "name": "languages", + "summary": "the preferred closed captions languages", + "schema": { + "type": "array", + "items": { + "$ref": "https://meta.comcast.com/firebolt/localization#/definitions/ISO639_2Language" + } + } + }, + "examples": [ + { + "name": "Default Example", + "params": [], + "result": { + "name": "Default Result", + "value": [ + "spa", + "eng" + ] + } + }, + { + "name": "Default Example #2", + "params": [], + "result": { + "name": "Default Result", + "value": [ + "eng", + "spa" + ] + } } ] } diff --git a/src/openrpc/discovery.json b/src/openrpc/discovery.json index 949ff09a5..eb7530a35 100644 --- a/src/openrpc/discovery.json +++ b/src/openrpc/discovery.json @@ -444,7 +444,7 @@ "schema": { "$ref": "https://meta.comcast.com/firebolt/discovery#/definitions/PurchasedContentResult" }, - "summary": "The data for the purachasedContent" + "summary": "The data for the purchasedContent" } ], "result": { @@ -971,7 +971,7 @@ ] } ], - "summary": "Launch or foreground the specified app, and optionally instructs it to navigate to the specified user action", + "summary": "Launch or foreground the specified app, and optionally instructs it to navigate to the specified user action. \n For the Primary Experience, the appId can be any one of: \n\n - xrn:firebolt:application-type:main \n\n - xrn:firebolt:application-type:settings", "params": [ { "name": "appId", @@ -1079,7 +1079,7 @@ "params": [ { "name": "appId", - "value": "urn:firebolt:apps:main" + "value": "xrn:firebolt:application-type:main" }, { "name": "intent", @@ -1106,7 +1106,7 @@ "params": [ { "name": "appId", - "value": "urn:firebolt:apps:main" + "value": "xrn:firebolt:application-type:main" }, { "name": "intent", @@ -1131,7 +1131,7 @@ "params": [ { "name": "appId", - "value": "urn:firebolt:apps:main" + "value": "xrn:firebolt:application-type:main" }, { "name": "intent", @@ -1153,7 +1153,7 @@ "params": [ { "name": "appId", - "value": "urn:firebolt:apps:main" + "value": "xrn:firebolt:application-type:main" }, { "name": "intent", @@ -1175,7 +1175,7 @@ "params": [ { "name": "appId", - "value": "urn:firebolt:apps:main" + "value": "xrn:firebolt:application-type:settings " }, { "name": "intent", @@ -1200,7 +1200,7 @@ "params": [ { "name": "appId", - "value": "urn:firebolt:apps:main" + "value": "xrn:firebolt:application-type:main" }, { "name": "intent", @@ -1221,11 +1221,11 @@ } }, { - "name": "Launch the Aggregated Experience to the App Store details page for a specfic app with the ID 'foo'.", + "name": "Launch the Aggregated Experience to the App Store details page for a specific app with the ID 'foo'.", "params": [ { "name": "appId", - "value": "urn:firebolt:apps:main" + "value": "xrn:firebolt:application-type:main " }, { "name": "intent", @@ -1302,7 +1302,7 @@ ] } ], - "summary": "Inform the platform that your user is signed in, for increased visiblity in search & discovery. Sign-in state is used separately from what content can be access through entitlements and availabilities. Sign-in state may be used when deciding whether to choose this app to handle a user intent. For instance, if the user tries to launch something generic like playing music from an artist, only a signed-in app will be chosen. If the user wants to tune to a channel, only a signed-in app will be chosen to handle that intent. While signIn can optionally include entitlements as those typically change at signIn time, it is recommended to make a separate call to Discovery.contentAccess for entitlements. signIn is not only for when a user explicitly enters login credentials. If an app does not require any credentials from the user to consume content, such as in a free app, then the app should call signIn immediately on launch.", + "summary": "Inform the platform that your user is signed in, for increased visibility in search & discovery. Sign-in state is used separately from what content can be access through entitlements and availabilities. Sign-in state may be used when deciding whether to choose this app to handle a user intent. For instance, if the user tries to launch something generic like playing music from an artist, only a signed-in app will be chosen. If the user wants to tune to a channel, only a signed-in app will be chosen to handle that intent. While signIn can optionally include entitlements as those typically change at signIn time, it is recommended to make a separate call to Discovery.contentAccess for entitlements. signIn is not only for when a user explicitly enters login credentials. If an app does not require any credentials from the user to consume content, such as in a free app, then the app should call signIn immediately on launch.", "params": [ { "name": "entitlements", diff --git a/src/openrpc/localization.json b/src/openrpc/localization.json index 1327529a0..db92eeb5b 100644 --- a/src/openrpc/localization.json +++ b/src/openrpc/localization.json @@ -99,7 +99,7 @@ ] } ], - "summary": "Get the ISO 3166 code for the counrty device is located in", + "summary": "Get the ISO 3166-1 alpha-2 code for the country device is located in", "params": [], "result": { "name": "code", @@ -132,6 +132,11 @@ "summary": "Get the ISO 639 1/2 code for the preferred language", "params": [], "tags": [ + { + "name": "deprecated", + "x-since": "0.17.0", + "x-alternative": "Localization.locale" + }, { "name": "property" }, @@ -168,6 +173,50 @@ } ] }, + { + "name": "preferredAudioLanguages", + "summary": "A prioritized list of ISO 639 1/2 codes for the preferred audio languages on this device.", + "params": [], + "tags": [ + { + "name": "property" + }, + { + "name": "capabilities", + "x-uses": [ + "xrn:firebolt:capability:localization:language" + ] + } + ], + "result": { + "name": "languages", + "summary": "the preferred audio languages", + "schema": { + "type": "array", + "items": { + "$ref": "https://meta.comcast.com/firebolt/localization#/definitions/ISO639_2Language" + } + } + }, + "examples": [ + { + "name": "Default Example", + "params": [], + "result": { + "name": "Default Result", + "value": ["spa", "eng"] + } + }, + { + "name": "Default Example #2", + "params": [], + "result": { + "name": "Default Result", + "value": ["eng", "spa"] + } + } + ] + }, { "name": "locale", "tags": [ diff --git a/src/openrpc/secure_storage.json b/src/openrpc/secure_storage.json index a790631a4..1d65c1d4b 100644 --- a/src/openrpc/secure_storage.json +++ b/src/openrpc/secure_storage.json @@ -318,7 +318,7 @@ }, "examples": [ { - "name": "Set a refresh token with name authRefreshToken with optional paramter for appId foo", + "name": "Set a refresh token with name authRefreshToken with optional parameter for appId foo", "params": [ { "name": "appId", diff --git a/src/openrpc/user_grants.json b/src/openrpc/user_grants.json index 789fe4461..fcfe8b1c0 100644 --- a/src/openrpc/user_grants.json +++ b/src/openrpc/user_grants.json @@ -391,6 +391,14 @@ "minItems": 1 }, "required": true + }, + { + "name": "options", + "summary": "Request options", + "schema": { + "$ref": "#/components/schemas/RequestOptions" + }, + "required": false } ], "result": { @@ -405,7 +413,7 @@ }, "examples": [ { - "name": "Default result", + "name": "Default result #1", "params": [ { "name": "appId", @@ -436,6 +444,45 @@ } ] } + }, + { + "name": "Default result #2", + "params": [ + { + "name": "appId", + "value": "certapp" + }, + { + "name": "permissions", + "value": [ + { + "role": "use", + "capability": "xrn:firebolt:capability:localization:postal-code" + } + ] + }, + { + "name": "options", + "value": { + "force": true + } + } + ], + "result": { + "name": "defaultResult", + "value": [ + { + "app": { + "id": "certapp", + "title": "Certification App" + }, + "state": "granted", + "capability": "xrn:firebolt:capability:localization:postal-code", + "role": "use", + "lifespan": "powerActive" + } + ] + } } ] } @@ -528,6 +575,16 @@ }, "additionalProperties": false, "required": [] + }, + "RequestOptions": { + "title": "RequestOptions", + "type": "object", + "properties": { + "force": { + "type": "boolean", + "description": "Whether to force for user grant even if the previous decision stored" + } + } } } } diff --git a/src/schemas/accessibility.json b/src/schemas/accessibility.json new file mode 100644 index 000000000..ce6ad419a --- /dev/null +++ b/src/schemas/accessibility.json @@ -0,0 +1,176 @@ +{ + "$id": "https://meta.comcast.com/firebolt/accessibility", + "title": "Accessibility", + "anyOf": [ + { + "$ref": "#/definitions/ClosedCaptionsStyles" + }, + { + "$ref": "#/definitions/ClosedCaptionsSettings" + } + ], + "definitions": { + "FontFamily": { + "type": ["string", "null"], + "enum": [ + "monospaced_serif", + "proportional_serif", + "monospaced_sanserif", + "proportional_sanserif", + "smallcaps", + "cursive", + "casual", + null + ] + }, + "FontSize": { + "type": ["number", "null"], + "minimum": 0 + }, + "FontEdge": { + "type": ["string", "null"], + "enum": [ + "none", + "raised", + "depressed", + "uniform", + "drop_shadow_left", + "drop_shadow_right", + null + ] + }, + "Color": { + "type": ["string", "null"] + }, + "Opacity": { + "type": ["number", "null"], + "minimum": 0, + "maximum": 100 + }, + "HorizontalAlignment": { + "type": ["string", "null"] + }, + "VerticalAlignment": { + "type": ["string", "null"] + }, + "ClosedCaptionsStyles": { + "title": "ClosedCaptionsStyles", + "type": "object", + "description": "The default styles to use when displaying closed-captions", + "properties": { + "fontFamily": { + "$ref": "#/definitions/FontFamily" + }, + "fontSize": { + "$ref": "#/definitions/FontSize" + }, + "fontColor": { + "$ref": "#/definitions/Color" + }, + "fontEdge": { + "$ref": "#/definitions/FontEdge" + }, + "fontEdgeColor": { + "$ref": "#/definitions/Color" + }, + "fontOpacity": { + "$ref": "#/definitions/Opacity" + }, + "backgroundColor": { + "$ref": "#/definitions/Color" + }, + "backgroundOpacity": { + "$ref": "#/definitions/Opacity" + }, + "textAlign": { + "$ref": "#/definitions/HorizontalAlignment" + }, + "textAlignVertical": { + "$ref": "#/definitions/VerticalAlignment" + }, + "windowColor": { + "$ref": "#/definitions/Color" + }, + "windowOpacity": { + "$ref": "#/definitions/Opacity" + } + } + }, + "ClosedCaptionsSettings": { + "title": "ClosedCaptionsSettings", + "type": "object", + "required": [ + "enabled", + "styles" + ], + "properties": { + "enabled": { + "type": "boolean", + "description": "Whether or not closed-captions should be enabled by default" + }, + "styles": { + "$ref": "#/definitions/ClosedCaptionsStyles" + }, + "preferredLanguages": { + "type": "array", + "items": { + "$ref": "https://meta.comcast.com/firebolt/localization#/definitions/ISO639_2Language" + } + } + }, + "examples": [ + { + "enabled": true, + "styles": { + "fontFamily": "monospaced_serif", + "fontSize": 1, + "fontColor": "#ffffff", + "fontEdge": "none", + "fontEdgeColor": "#7F7F7F", + "fontOpacity": 100, + "backgroundColor": "#000000", + "backgroundOpacity": 100, + "textAlign": "center", + "textAlignVertical": "middle", + "windowColor": "white", + "windowOpacity": 50 + }, + "preferredLanguages": [ + "eng", + "spa" + ] + } + ] + }, + "VoiceSpeed": { + "title": "VoiceSpeed", + "type": "number", + "minimum": 0.5, + "maximum": 2 + }, + "VoiceGuidanceSettings": { + "title": "VoiceGuidanceSettings", + "type": "object", + "required": [ + "enabled", + "speed" + ], + "properties": { + "enabled": { + "type": "boolean", + "description": "Whether or not voice guidance should be enabled by default" + }, + "speed": { + "$ref": "https://meta.comcast.com/firebolt/accessibility#/definitions/VoiceSpeed", + "description": "The speed at which voice guidance speech will be read back to the user" + } + }, + "examples": [ + { + "enabled": true, + "speed": 2 + } + ] + } + } +} \ No newline at end of file diff --git a/src/schemas/localization.json b/src/schemas/localization.json new file mode 100644 index 000000000..1bc606672 --- /dev/null +++ b/src/schemas/localization.json @@ -0,0 +1,46 @@ +{ + "$id": "https://meta.comcast.com/firebolt/localization", + "title": "Localization", + "oneOf": [ + { + "$ref": "#/definitions/Locality" + }, + { + "$ref": "#/definitions/CountryCode" + }, + { + "$ref": "#/definitions/Language" + }, + { + "$ref": "#/definitions/Locale" + }, + { + "$ref": "#/definitions/TimeZone" + } + ], + "definitions": { + "CountryCode": { + "type": "string", + "pattern": "^[A-Z]{2}$" + }, + "Language": { + "type": "string", + "pattern": "^[A-Za-z]{2}$" + }, + "ISO639_2Language": { + "type": "string", + "pattern": "^[a-z]{3}$" + }, + "Locality": { + "type": "string" + }, + "Locale": { + "type": "string", + "pattern": "^[a-zA-Z]+([a-zA-Z0-9\\-]*)$" + }, + "TimeZone": { + "type": "string", + "pattern": "^[-+_\/ A-Za-z 0-9]*$" + } + } +} diff --git a/src/sdks/core/CHANGELOG.md b/src/sdks/core/CHANGELOG.md index 0331a9425..3b6fd058f 100644 --- a/src/sdks/core/CHANGELOG.md +++ b/src/sdks/core/CHANGELOG.md @@ -1,3 +1,28 @@ +# [0.17.1](https://github.com/rdkcentral/firebolt-apis/compare/v0.17.0...v0.17.1) (2023-09-15) + +### Bug Fixes + +fix: Add enumerated values for fontFamily/fontEdge (#181) + +# [0.17.0](https://github.com/rdkcentral/firebolt-apis/compare/v0.16.0...v0.17.0) (2023-09-07) + +### Bug Fixes + +* fix: Using 3 letter ISO639 language codes ([#173](https://github.com/rdkcentral/firebolt-apis/issues/173)) + +# [0.15.0](https://github.com/rdkcentral/firebolt-apis/compare/v0.14.0...v0.15.0) (2023-07-31) + +### Bug Fixes + +* Rename Advisory "Committee" to "Board" ([#135](https://github.com/rdkcentral/firebolt-apis/issues/135)) ([ef410c4](https://github.com/rdkcentral/firebolt-apis/commit/ef410c43bbb32414c3aa1d11b43093565cc90edf)) +* window fix from firebolt-openrpc 2.0.3 ([8c06dd1](https://github.com/rdkcentral/firebolt-apis/commit/8c06dd1432822719f5634e2877b36efdf02a4809)) + +### Features + +* **Nullable CC Styles** Added support to set and get null in ClosedCaptions style fields ([#150](https://github.com/rdkcentral/firebolt-apis/issues/150)) ([9c511e4](https://github.com/rdkcentral/firebolt-apis/commit/9c511e4fddebcdf5dfc04e9e8e31f98ab7eef680)) +* **Window CC Styles** Added windowColor and windowOpacity to closedCaptions style ([#145](https://github.com/rdkcentral/firebolt-apis/issues/145)) ([f65b901](https://github.com/rdkcentral/firebolt-apis/commit/f65b9019bda22400df9b9634c332e720db38118d)) +* **Audio Descriptions** Audio Description and Preferred Audio Languages Settings ([#45](https://github.com/rdkcentral/firebolt-apis/issues/45)) ([58f6ea1](https://github.com/rdkcentral/firebolt-apis/commit/58f6ea1dde7a819883eb3da24f879b6a9ecc9a41)) + # [0.14.0](https://github.com/rdkcentral/firebolt-apis/compare/v0.13.0...v0.14.0) (2023-06-22) ### Bug Fixes diff --git a/src/sdks/core/package.json b/src/sdks/core/package.json index d629630ee..6c93328f3 100644 --- a/src/sdks/core/package.json +++ b/src/sdks/core/package.json @@ -1,6 +1,6 @@ { "name": "@firebolt-js/sdk", - "version": "0.16.0-test.1", + "version": "0.18.0-next.4", "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 5af0e4a18..f406f8bea 100644 --- a/src/sdks/core/sdk.config.json +++ b/src/sdks/core/sdk.config.json @@ -7,7 +7,8 @@ "module": "Accessibility", "use": [ "xrn:firebolt:capability:accessibility:closedcaptions", - "xrn:firebolt:capability:accessibility:voiceguidance" + "xrn:firebolt:capability:accessibility:voiceguidance", + "xrn:firebolt:capability:accessibility:audiodescriptions" ] }, { diff --git a/src/sdks/core/src/cpp/sdk/ctest/CMakeLists.txt b/src/sdks/core/src/cpp/sdk/ctest/CMakeLists.txt new file mode 100644 index 000000000..c87f15662 --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/ctest/CMakeLists.txt @@ -0,0 +1,70 @@ +# 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(FireboltCoreSDKTests) + +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 TestFireboltCore) + +message("Setup ${TESTAPP}") + +add_executable(${TESTAPP} main.c) + +target_link_libraries(${TESTAPP} + PRIVATE + ${NAMESPACE}Core::${NAMESPACE}Core + ${FIREBOLT_NAMESPACE}SDK::${FIREBOLT_NAMESPACE}SDK +) + +target_include_directories(${TESTAPP} + PRIVATE + $ + $ + $ +) + +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/core/src/cpp/sdk/ctest/build.sh b/src/sdks/core/src/cpp/sdk/ctest/build.sh new file mode 100755 index 000000000..4db39cbe8 --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/ctest/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/core/src/cpp/sdk/ctest/main.c b/src/sdks/core/src/cpp/sdk/ctest/main.c new file mode 100644 index 000000000..6e6dbf020 --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/ctest/main.c @@ -0,0 +1,470 @@ +#include +#include +#include + +#include "firebolt.h" +#include "accessibility.h" +#include "account.h" +#include "advertising.h" +#include "device.h" +#include "discovery.h" +#include "common/entertainment.h" + +void ShowMenu() +{ + printf("Enter\n" + "\tI : Get Device ID\n" + "\tC : Get Closed Caption Settings\n" + "\tG : Get Voice Guidance Settings\n" + "\tP : Get Advertising Policy\n" + "\tU : Get Account UID\n" + "\tE : Push EntityInfo\n" + "\tN : Register/Unregister for Device Name change\n" + "\tR : Register/Unregister for Screen Resolution change\n" + "\tA : Register/Unregister for Accessibilty Voice Guidance change\n" + "\tH : Register/Unregister for OnNavigateTo:HomeIntent\n" + "\tS : Register/Unregister for OnNavigateTo:SearchIntent\n" + "\tQ : Quit\n\n" + ); +} + +void ShowEventMenu() +{ + printf("Enter\n" + "\tR: Register Event\n" + "\tU: Unregister Event\n" + "\tQ : Quit\n"); +} + +#define HandleEventListener(Module, eventFuncName, Callback, eventTestStr, eventName) \ +{ \ + int opt; \ + do { \ + getchar(); \ + ShowEventMenu(); \ + printf("Enter option : "); \ + opt = toupper(getchar()); \ + switch (opt) { \ + case 'R': { \ + int32_t result = Module##_Register_On##eventFuncName((const void*)Callback, eventTestStr); \ + if (result != FireboltSDKErrorNone) { \ + printf("Register event %s is failed, status = %d \n", eventName, result); \ + } else { \ + printf("Event %s is registered successfully\n", eventName); \ + } \ + break; \ + } \ + case 'U': { \ + int32_t result = Module##_Unregister_On##eventFuncName((const void*)Callback); \ + if (result != FireboltSDKErrorNone) { \ + printf("Unregister event %s is failed, status = %d \n", eventName, result); \ + } else { \ + printf("Event %s is unregistered successfully\n", eventName); \ + } \ + break; \ + } \ + default: \ + break; \ + } \ + } while (opt != 'Q'); \ +} + +const char* get_skiprestriction_enum_string(Advertising_SkipRestriction skipRestriction) +{ + char* strSkipRestriction; + switch(skipRestriction) { + case ADVERTISING_SKIPRESTRICTION_NONE: + strSkipRestriction = "None"; + break; + case ADVERTISING_SKIPRESTRICTION_ADS_UNWATCHED: + strSkipRestriction = "AdsUnwatched"; + break; + case ADVERTISING_SKIPRESTRICTION_ADS_ALL: + strSkipRestriction = "AdsAll"; + break; + case ADVERTISING_SKIPRESTRICTION_ALL: + strSkipRestriction = "All"; + break; + default: + strSkipRestriction = "None"; + break; + } + return strSkipRestriction; +} + +static const char deviceNameTestStr[] = "DeviceNameTestStr"; +static void NotifyDeviceNameChange(const void* userData, Firebolt_String_t handle) +{ + if (handle) { + printf("Got new device.name :%s\n", Firebolt_String(handle)); + Firebolt_String_Release(handle); + } else { + printf("device.name event handle is not valid\n"); + } +} + +static const char deviceScreenResolutionTestStr[] = "deviceScreenResolutionTestStr"; +static void NotifyDeviceScreenResolutionChange(const void* userData, Device_ResolutionArray_t handle) +{ + if (Device_ResolutionArray_IsValid(handle) == true) { + uint32_t size = Device_ResolutionArray_Size(handle); + printf("Device ScreenResolutions changed for %d numbers\n", size); + for (uint32_t i = 0; i < size; ++i) { + printf("New reslution[%d] = %d\n", i, Device_ResolutionArray_Get(handle, i)); + } + Device_ResolutionArray_Release(handle); + } else { + printf("device.screenresolution event handle is not valid\n"); + } +} + +static const char accessibilityVoiceGuidanceTestStr[] = "AccessibilityVoiceGuidanceTestStr"; +static void NotifyAccessibilityVoiceGuidanceChange(const void* userData, Accessibility_VoiceGuidanceSettings_t handle) +{ + if (Accessibility_VoiceGuidanceSettings_IsValid(handle) == true) { + bool enabled = Accessibility_VoiceGuidanceSettings_Get_Enabled(handle); + uint32_t speed = Accessibility_VoiceGuidanceSettings_Get_Speed(handle); + printf("VoiceGuidanceSettings: Enabled : %d, Speed : %d\n", enabled, speed); + Accessibility_VoiceGuidanceSettings_Release(handle); + } else { + printf("accessibility.voiceguidance event handle is not valid\n"); + } +} + +static const char discoveryHomeIntentTestStr[] = "DiscoveryHomeIntentTestStr"; +static void NotifyOnNavigateToHomeIntent(const void* userData, Intents_HomeIntent_t handle) +{ + if (Intents_HomeIntent_IsValid(handle) == true) { + char* action = Intents_HomeIntent_Get_Action(handle); + printf("NavigateToHomeIntent: Action: %s\n", action); + Intents_HomeIntent_Release(handle); + } else { + printf("discovery.onNavigateToChanged HomeIntent event handle is not valid\n"); + } +} + +static const char discoverySearchIntentTestStr[] = "DiscoverySearchIntentTestStr"; +static void NotifyOnNavigateToSearchIntent(const void* userData, Intents_SearchIntent_t handle) +{ + if (Intents_SearchIntent_IsValid(handle) == true) { + char* action = Intents_SearchIntent_Get_Action(handle); + printf("NavigateToSearchIntent: Action: %s\n", action); + Intents_SearchIntent_Release(handle); + } else { + printf("discovery.onNavigateTo LauncIntent event handle is not valid\n"); + } +} + +int main (int argc, char* argv[]) +{ + char* config = "{\ + \"waitTime\": 1000,\ + \"logLevel\": \"Info\",\ + \"workerPool\":{\ + \"queueSize\": 8,\ + \"threadCount\": 3\ + },\ + \"wsUrl\": \"ws://127.0.0.1:9998\"\ +}"; + + printf("Firebolt Core SDK Test\n"); + + //Intitialize the SDK + FireboltSDK_Initialize(config); + int option; + + do { + ShowMenu(); + printf("Enter option : "); + option = toupper(getchar()); + switch (option) { + case 'I': { + //Lets get the Device ID + Firebolt_String_t handle; + int32_t result = Device_GetId(&handle); + if (result == FireboltSDKErrorNone) { + printf("Device: Id:%s\n\n", Firebolt_String(handle)); + Firebolt_String_Release(handle); + handle = NULL; + } else { + printf("Failed to get Device ID\n\n"); + } + break; + } + case 'C': { + Accessibility_ClosedCaptionsSettings_t handle; + int32_t result = Accessibility_GetClosedCaptionsSettings(&handle); + + if (result == FireboltSDKErrorNone) { + if (Accessibility_ClosedCaptionsSettings_IsValid(handle) == true) { + printf("ClosedCaption Settings ------------------\n"); + Accessibility_ClosedCaptionsStyles_t styleHandle = Accessibility_ClosedCaptionsSettings_Get_Styles(handle); + if (Accessibility_ClosedCaptionsStyles_IsValid(styleHandle)) { + printf("ClosedCaptionStyles:\n"); + char* fontFamily = Accessibility_ClosedCaptionsStyles_Get_FontFamily(styleHandle); + printf("\tFontFamily : %s\n", fontFamily); + uint32_t fontSize = Accessibility_ClosedCaptionsStyles_Get_FontSize(styleHandle); + printf("\tFontSize : %d\n", fontSize); + char* fontColor = Accessibility_ClosedCaptionsStyles_Get_FontColor(styleHandle); + printf("\tFontColor : %s\n", fontColor); + char* fontEdge = Accessibility_ClosedCaptionsStyles_Get_FontEdge(styleHandle); + printf("\tFontEdge : %s\n", fontEdge); + char* fontEdgeColor = Accessibility_ClosedCaptionsStyles_Get_FontEdgeColor(styleHandle); + printf("\tFontEdgeColor : %s\n", fontEdgeColor); + uint32_t fontOpacity = Accessibility_ClosedCaptionsStyles_Get_FontOpacity(styleHandle); + printf("\tFontOpacity : %d\n", fontOpacity); + char* bgColor = Accessibility_ClosedCaptionsStyles_Get_BackgroundColor(styleHandle); + printf("\tBackgroundColor : %s\n", bgColor); + uint32_t bgOpacity = Accessibility_ClosedCaptionsStyles_Get_BackgroundOpacity(styleHandle); + printf("\tBackgroundOpacity : %d\n", bgOpacity); + char* txAlign = Accessibility_ClosedCaptionsStyles_Get_TextAlign(styleHandle); + printf("\tTextAlign : %s\n", txAlign); + char* txAlignVertical = Accessibility_ClosedCaptionsStyles_Get_TextAlignVertical(styleHandle); + printf("\tTextAlignVertical : %s\n", txAlignVertical); + Accessibility_ClosedCaptionsStyles_Release(styleHandle); + } + bool enabled = Accessibility_ClosedCaptionsSettings_Get_Enabled(handle); + printf("Enabled: %d\n\n", enabled); + Accessibility_ClosedCaptionsSettings_Release(handle); + } else { + printf("Invalid ClosedCaptionsSettings_t\n\n"); + } + } else { + printf("Failed to get Closed Caption Settings\n\n"); + } + break; + } + case 'G': { + Accessibility_VoiceGuidanceSettings_t handle; + int32_t result = Accessibility_GetVoiceGuidanceSettings(&handle); + + if (result == FireboltSDKErrorNone) { + if (Accessibility_VoiceGuidanceSettings_IsValid(handle) == true) { + bool enabled = Accessibility_VoiceGuidanceSettings_Get_Enabled(handle); + uint32_t speed = Accessibility_VoiceGuidanceSettings_Get_Speed(handle); + printf("VoiceGuidanceSettings: Enabled : %d, Speed : %d\n", enabled, speed); + Accessibility_VoiceGuidanceSettings_Release(handle); + } else { + printf("Invalid VoiceGuidanceSettings_t\n\n"); + } + } else { + printf("Failed to get Voice Guidance Settings\n\n"); + } + break; + } + case 'P': { + Advertising_AdPolicy_t handle; + int32_t result = Advertising_GetPolicy(&handle); + if (result == FireboltSDKErrorNone) { + if (Advertising_AdPolicy_IsValid(handle) == true) { + printf("AdPolicy: "); + Advertising_SkipRestriction skipRestriction = Advertising_AdPolicy_Get_SkipRestriction(handle); + printf("SkipRestriction = %s ", get_skiprestriction_enum_string(skipRestriction)); + bool limitAdTracking = Advertising_AdPolicy_Get_LimitAdTracking(handle); + printf("LimitAdTracking = %s \n", limitAdTracking? "true" : "false"); + Advertising_AdPolicy_Release(handle); + } else { + printf("Invalid Advertising_AdPolicy_t\n\n"); + } + } else { + printf("Failed to get Advertising Policy\n\n"); + } + break; + } + case 'U': { + Firebolt_String_t handle; + int32_t result = Account_GetUid(&handle); + if (result == FireboltSDKErrorNone) { + printf("Account: Uid:%s\n\n", Firebolt_String(handle)); + Firebolt_String_Release(handle); + handle = NULL; + } else { + printf("Failed to get Advertising Policy\n\n"); + } + break; + } + case 'E': { + { + Discovery_EntityInfoResult_t entityInfoResult = Discovery_EntityInfoResult_Acquire(); + Entertainment_EntityInfo_t entityInfo = Entertainment_EntityInfo_Acquire(); + + //Populate the ContentIdentifiers Object + Entertainment_ContentIdentifiers_t ci = Entertainment_ContentIdentifiers_Acquire(); + Entertainment_ContentIdentifiers_Set_AssetId(ci, "12345678"); + Entertainment_ContentIdentifiers_Set_EntityId(ci, "ABCDEFGH"); + Entertainment_ContentIdentifiers_Set_SeasonId(ci, "1"); + Entertainment_ContentIdentifiers_Set_SeriesId(ci, "9ER34FR"); + Entertainment_ContentIdentifiers_Set_AppContentData(ci, "Sample App Content Data"); + + //Populate EntityInfo Object + //Set the ContentIdentifiers Object to EntityInfo Object + Entertainment_EntityInfo_Set_Identifiers(entityInfo, ci); + Entertainment_ContentIdentifiers_Release(ci); + Entertainment_EntityInfo_Set_Title(entityInfo, "Game Of Thrones"); + Entertainment_EntityInfo_Set_EntityType(entityInfo, "program"); + Entertainment_EntityInfo_Set_ProgramType(entityInfo, ENTERTAINMENT_PROGRAMTYPE_SEASON); + Entertainment_EntityInfo_Set_Synopsis(entityInfo, "The imaginary continent of Westeros was once inhabited by a magical people, the Children of the Forest. For centuries, other people came across the Narrow Sea from the eastern continent of Essos: up North, the First Men; in the Center, the Andals; down South, the Dornish."); + Entertainment_EntityInfo_Set_SeasonNumber(entityInfo, 1); + Entertainment_EntityInfo_Set_EpisodeNumber(entityInfo, 1); + Entertainment_EntityInfo_Set_ReleaseDate(entityInfo, "2012-04-23T18:25:43.511Z"); + + { + Entertainment_ContentRatingArray_t crArray = Entertainment_ContentRatingArray_Acquire(); + { + //Populate the ContentRatings Handle for US TV scheme + Entertainment_ContentRating_t cr = Entertainment_ContentRating_Acquire(); + Entertainment_ContentRating_Set_Scheme(cr, ENTERTAINMENT_CONTENTRATING_SCHEME_US_TV); + Entertainment_ContentRating_Set_Rating(cr, "TVMA"); + Entertainment_ContentRating_AdvisoriesArray_t crAdvisories = Entertainment_ContentRating_AdvisoriesArray_Acquire(); + Entertainment_ContentRating_AdvisoriesArray_Add(crAdvisories, "V"); + Entertainment_ContentRating_AdvisoriesArray_Add(crAdvisories, "S"); + Entertainment_ContentRating_AdvisoriesArray_Add(crAdvisories, "L"); + Entertainment_ContentRating_Set_Advisories(cr, crAdvisories); + Entertainment_ContentRating_AdvisoriesArray_Release(crAdvisories); + Entertainment_ContentRatingArray_Add(crArray, cr); + } + { + //Populate the ContentRatings Handle for US TV scheme + Entertainment_ContentRating_t cr = Entertainment_ContentRating_Acquire(); + Entertainment_ContentRating_Set_Scheme(cr, ENTERTAINMENT_CONTENTRATING_SCHEME_CA_TV); + Entertainment_ContentRating_Set_Rating(cr, "18+"); + Entertainment_ContentRating_AdvisoriesArray_t crAdvisories = Entertainment_ContentRating_AdvisoriesArray_Acquire(); + Entertainment_ContentRating_AdvisoriesArray_Add(crAdvisories, "18+"); + Entertainment_ContentRating_Set_Advisories(cr, crAdvisories); + Entertainment_ContentRating_AdvisoriesArray_Release(crAdvisories); + Entertainment_ContentRatingArray_Add(crArray, cr); + } + Entertainment_EntityInfo_Set_ContentRatings(entityInfo, crArray); + Entertainment_ContentRatingArray_Release(crArray); + } + + //Populate WayToWatch Array in EntityInfo + { + //Populate the WayToWatch Object + Entertainment_WayToWatch_t w2w = Entertainment_WayToWatch_Acquire(); + { + //Add the ContentIdentifiers Object in WayToWatch + Entertainment_ContentIdentifiers_t ciI = Entertainment_ContentIdentifiers_Acquire(); + Entertainment_ContentIdentifiers_Set_AssetId(ciI, "12345678"); + Entertainment_ContentIdentifiers_Set_EntityId(ciI, "ABCDEFGH"); + Entertainment_ContentIdentifiers_Set_SeasonId(ciI, "1"); + Entertainment_ContentIdentifiers_Set_SeriesId(ciI, "9ER34FR"); + Entertainment_ContentIdentifiers_Set_AppContentData(ciI, "Sample App Content Data"); + Entertainment_WayToWatch_Set_Identifiers(w2w, ciI); + Entertainment_ContentIdentifiers_Release(ciI); + } + Entertainment_WayToWatch_Set_Expires(w2w, "2014-04-23T18:25:43.511Z"); + Entertainment_WayToWatch_Set_Entitled(w2w, true); + Entertainment_WayToWatch_Set_EntitledExpires(w2w, "2014-04-23T18:25:43.511Z"); + Entertainment_WayToWatch_Set_OfferingType(w2w, ENTERTAINMENT_OFFERINGTYPE_FREE); + Entertainment_WayToWatch_Set_HasAds(w2w, true); + + //Populate VideoQuality Array + Entertainment_WayToWatch_VideoQualityArray_t vqArray = + Entertainment_WayToWatch_VideoQualityArray_Acquire(); + Entertainment_WayToWatch_VideoQualityArray_Add( + vqArray, ENTERTAINMENT_WAYTOWATCH_VIDEOQUALITY_HD); + Entertainment_WayToWatch_VideoQualityArray_Add( + vqArray, ENTERTAINMENT_WAYTOWATCH_VIDEOQUALITY_UHD); + Entertainment_WayToWatch_Set_VideoQuality(w2w, vqArray); + Entertainment_WayToWatch_VideoQualityArray_Release(vqArray); + + //Populate AudioProfile Array + Entertainment_AudioProfileArray_t apArray = + Entertainment_AudioProfileArray_Acquire(); + Entertainment_AudioProfileArray_Add( + apArray, TYPES_AUDIOPROFILE_STEREO); + Entertainment_AudioProfileArray_Add( + apArray, TYPES_AUDIOPROFILE_DOLBY_DIGITAL_5_1); + Entertainment_AudioProfileArray_Add( + apArray, TYPES_AUDIOPROFILE_DOLBY_DIGITAL_5_1_PLUS); + Entertainment_WayToWatch_Set_AudioProfile(w2w, apArray); + Entertainment_AudioProfileArray_Release(apArray); + + //Populate AudioLanguages Array + Entertainment_WayToWatch_AudioLanguagesArray_t alArray = + Entertainment_WayToWatch_AudioLanguagesArray_Acquire(); + Entertainment_WayToWatch_AudioLanguagesArray_Add(alArray, "en"); + Entertainment_WayToWatch_AudioLanguagesArray_Add(alArray, "fr"); + Entertainment_WayToWatch_Set_AudioLanguages(w2w, alArray); + Entertainment_WayToWatch_AudioLanguagesArray_Release(alArray); + + //Populate ClosedCaptions Array + Entertainment_WayToWatch_ClosedCaptionsArray_t ccArray = + Entertainment_WayToWatch_ClosedCaptionsArray_Acquire(); + Entertainment_WayToWatch_ClosedCaptionsArray_Add(ccArray, "en"); + Entertainment_WayToWatch_ClosedCaptionsArray_Add(ccArray, "fr"); + Entertainment_WayToWatch_Set_ClosedCaptions(w2w, ccArray); + Entertainment_WayToWatch_ClosedCaptionsArray_Release(ccArray); + + //Populate Subtitles Array + Entertainment_WayToWatch_SubtitlesArray_t sbArray = + Entertainment_WayToWatch_SubtitlesArray_Acquire(); + Entertainment_WayToWatch_SubtitlesArray_Add(sbArray, "en"); + Entertainment_WayToWatch_SubtitlesArray_Add(sbArray, "fr"); + Entertainment_WayToWatch_Set_Subtitles(w2w, sbArray); + Entertainment_WayToWatch_SubtitlesArray_Release(sbArray); + + //Populate AudioDescriptions Array + Entertainment_WayToWatch_AudioDescriptionsArray_t adArray = + Entertainment_WayToWatch_AudioDescriptionsArray_Acquire(); + Entertainment_WayToWatch_AudioDescriptionsArray_Add(adArray, "en"); + Entertainment_WayToWatch_Set_AudioDescriptions(w2w, adArray); + Entertainment_WayToWatch_AudioDescriptionsArray_Release(adArray); + + //Populate WayToWatch Array + Entertainment_WayToWatchArray_t w2wArray = + Entertainment_WayToWatchArray_Acquire(); + Entertainment_WayToWatchArray_Add(w2wArray, w2w); + Entertainment_EntityInfo_Set_WaysToWatch(entityInfo, w2wArray); + Entertainment_WayToWatchArray_Release(w2wArray); + Entertainment_WayToWatch_Release(w2w); + } + + //Populate EntityInfoResult Object + Discovery_EntityInfoResult_Set_Expires(entityInfoResult, "2012-06-23T18:25:43.511Z"); + Discovery_EntityInfoResult_Set_Entity(entityInfoResult, entityInfo); + Entertainment_EntityInfo_Release(entityInfo); + + //All Set, Call the Push + int32_t result = Discovery_PushEntityInfo(entityInfoResult); + if (result == FireboltSDKErrorNone) { + printf("\nSuccessfully Pushed entityInfo\n"); + + } else { + printf("\nFailed to Push entityInfo\n"); + } + Discovery_EntityInfoResult_Release(entityInfoResult); + break; + } + } + case 'R': { + HandleEventListener(Device, ScreenResolutionChanged, (const void*)NotifyDeviceScreenResolutionChange, deviceScreenResolutionTestStr, "device.screenresolution") + break; + } + case 'N': { + HandleEventListener(Device, NameChanged, (const void*)NotifyDeviceNameChange, deviceNameTestStr, "device.name") + break; + } + case 'A': { + HandleEventListener(Accessibility, VoiceGuidanceSettingsChanged, (const void*)NotifyAccessibilityVoiceGuidanceChange, accessibilityVoiceGuidanceTestStr, "accessibility.voiceguidance") + break; + } + case 'H': { + HandleEventListener(Discovery, NavigateToHomeIntent, (const void*)NotifyOnNavigateToHomeIntent, discoveryHomeIntentTestStr, "discovery.onNavigateTo") + break; + } + case 'S': { + HandleEventListener(Discovery, NavigateToSearchIntent, (const void*)NotifyOnNavigateToSearchIntent, discoverySearchIntentTestStr, "discovery.onNavigateTo") + break; + } + default: + break; + } + getchar(); // Skip white space + } while (option != 'Q'); + + FireboltSDK_Deinitialize(); + + return 0; +} diff --git a/src/sdks/core/src/cpp/sdk/test/CMakeLists.txt b/src/sdks/core/src/cpp/sdk/test/CMakeLists.txt new file mode 100644 index 000000000..9242ea10e --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/test/CMakeLists.txt @@ -0,0 +1,85 @@ +# 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(FireboltCoreSDKTests) +project_version(1.0.0) + +set(TESTLIB ${PROJECT_NAME}) + +message("Setup ${TESTLIB} v${PROJECT_VERSION}") + +set(CMAKE_POSITION_INDEPENDENT_CODE ON) +find_package(${NAMESPACE}Core CONFIG REQUIRED) + +file(GLOB CPP_SOURCES *.cpp) +add_library(${TESTLIB} STATIC ${CPP_SOURCES} CoreSDKTestGeneratedCode.c) + +target_link_libraries(${TESTLIB} + PRIVATE + ${FIREBOLT_NAMESPACE}SDK::${FIREBOLT_NAMESPACE}SDK + ${NAMESPACE}Core::${NAMESPACE}Core +) + +target_include_directories(${TESTLIB} + PRIVATE + $ + $ + $ + $ +) + +set_target_properties(${TESTLIB} PROPERTIES + CXX_STANDARD 11 + CXX_STANDARD_REQUIRED YES + LINK_WHAT_YOU_USE TRUE + FRAMEWORK FALSE +) + +set(TESTAPP FireboltCoreSDKTestApp) + +message("Setup ${TESTAPP} v${PROJECT_VERSION}") + +add_executable(${TESTAPP} Main.c) + +target_link_libraries(${TESTAPP} + PRIVATE + ${TESTLIB} +) + +target_include_directories(${TESTAPP} + PRIVATE + $ + $ + $ +) + +install( + TARGETS ${TESTLIB} EXPORT ${TESTLIB}Targets + ARCHIVE DESTINATION lib COMPONENT libs # static lib + LIBRARY DESTINATION lib COMPONENT libs # shared lib +) + +InstallCMakeConfig(TARGETS ${TESTLIB}) + +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/core/src/cpp/sdk/test/CoreSDKCTests.h b/src/sdks/core/src/cpp/sdk/test/CoreSDKCTests.h new file mode 100644 index 000000000..a6592156c --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/test/CoreSDKCTests.h @@ -0,0 +1,35 @@ +/* + * 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 + */ + +#ifndef CORESDK_C_TESTS_H +#define CORESDK_C_TESTS_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +int32_t test_firebolt_core_main(); +int32_t test_properties_get_policy(); + +#ifdef __cplusplus +} +#endif + +#endif //CORESDK_C_TESTS_H diff --git a/src/sdks/core/src/cpp/sdk/test/CoreSDKTestGeneratedCode.c b/src/sdks/core/src/cpp/sdk/test/CoreSDKTestGeneratedCode.c new file mode 100644 index 000000000..cbb0fa76c --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/test/CoreSDKTestGeneratedCode.c @@ -0,0 +1,330 @@ +/* + * 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 "CoreSDKCTests.h" +#include "CoreSDKTestGeneratedCode.h" + +#include "accessibility.h" +#include "advertising.h" +#include "common/types.h" +#include "device.h" +#include "lifecycle.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int32_t test_generated_properties_get_device_id() +{ + Firebolt_String_t handle; + int32_t result = Device_GetId(&handle); + + if (result == FireboltSDKErrorNone) { + printf("\nDevice: Id:%s\n", Firebolt_String(handle)); + Firebolt_String_Release(handle); + } + + EXPECT_EQ(result, FireboltSDKErrorNone); + return result; +} +#if 0 +int32_t test_generated_properties_get_device_version() +{ + Device_Versions_t handle; + int32_t result = Device_GetVersion(&handle); + + if (result == FireboltSDKErrorNone) { + if (Device_Versions_IsValid(handle)) { + Types_SemanticVersion_t sdkHandle = Device_Versions_Get_Sdk(handle); + if (Types_SemanticVersion_IsValid(sdkHandle)) { + uint32_t major = Types_SemanticVersion_Get_Major(sdkHandle); + uint32_t minor = Types_SemanticVersion_Get_Minor(sdkHandle); + uint32_t patch = Types_SemanticVersion_Get_Patch(sdkHandle); + char* readable = Types_SemanticVersion_Get_Readable(sdkHandle); + printf("\nDevice:SDK Version major:%d minor:%d patch:%d readable:%s\n", + major, minor, patch, readable); + Types_SemanticVersion_Release(sdkHandle); + result = FireboltSDKErrorNone; + } + Types_SemanticVersion_t osHandle = Device_Versions_Get_Os(handle); + if (Types_SemanticVersion_IsValid(osHandle)) { + uint32_t major = Types_SemanticVersion_Get_Major(osHandle); + uint32_t minor = Types_SemanticVersion_Get_Minor(osHandle); + uint32_t patch = Types_SemanticVersion_Get_Patch(osHandle); + const char* readable = Types_SemanticVersion_Get_Readable(osHandle); + printf("\nDevice:OS Version major:%d minor:%d patch:%d readable:%s\n", + major, minor, patch, readable); + Types_SemanticVersion_Release(osHandle); + result = FireboltSDKErrorNone; + } + Device_Versions_Release(handle); + } else { + result = FireboltSDKErrorUnavailable; + } + } + + EXPECT_EQ(result, FireboltSDKErrorNone); + return result; +} +#endif +int32_t test_generated_properties_get_accessibility_closedcaption() +{ + Accessibility_ClosedCaptionsSettings_t handle; + int32_t result = Accessibility_GetClosedCaptionsSettings(&handle); + + if (result == FireboltSDKErrorNone) { + if (Accessibility_ClosedCaptionsSettings_IsValid(handle) == true) { + printf("ClosedCaption Settings ------------------\n"); + Accessibility_ClosedCaptionsStyles_t styleHandle = Accessibility_ClosedCaptionsSettings_Get_Styles(handle); + if (Accessibility_ClosedCaptionsStyles_IsValid(styleHandle)) { + printf("ClosedCaptionStyles:\n"); + char* fontFamily = Accessibility_ClosedCaptionsStyles_Get_FontFamily(styleHandle); + printf("\tFontFamily : %s\n", fontFamily); + uint32_t fontSize = Accessibility_ClosedCaptionsStyles_Get_FontSize(styleHandle); + printf("\tFontSize : %d\n", fontSize); + char* fontColor = Accessibility_ClosedCaptionsStyles_Get_FontColor(styleHandle); + printf("\tFontColor : %s\n", fontColor); + char* fontEdge = Accessibility_ClosedCaptionsStyles_Get_FontEdge(styleHandle); + printf("\tFontEdge : %s\n", fontEdge); + char* fontEdgeColor = Accessibility_ClosedCaptionsStyles_Get_FontEdgeColor(styleHandle); + printf("\tFontEdgeColor : %s\n", fontEdgeColor); + uint32_t fontOpacity = Accessibility_ClosedCaptionsStyles_Get_FontOpacity(styleHandle); + printf("\tFontOpacity : %d\n", fontOpacity); + char* bgColor = Accessibility_ClosedCaptionsStyles_Get_BackgroundColor(styleHandle); + printf("\tBackgroundColor : %s\n", bgColor); + uint32_t bgOpacity = Accessibility_ClosedCaptionsStyles_Get_BackgroundOpacity(styleHandle); + printf("\tBackgroundOpacity : %d\n", bgOpacity); + char* txAlign = Accessibility_ClosedCaptionsStyles_Get_TextAlign(styleHandle); + printf("\tTextAlign : %s\n", txAlign); + char* txAlignVertical = Accessibility_ClosedCaptionsStyles_Get_TextAlignVertical(styleHandle); + printf("\tTextAlignVertical : %s\n", txAlignVertical); + Accessibility_ClosedCaptionsStyles_Release(styleHandle); + } + bool enabled = Accessibility_ClosedCaptionsSettings_Get_Enabled(handle); + printf("Enabled: %d\n", enabled); + Accessibility_ClosedCaptionsSettings_Release(handle); + } else { + result = FireboltSDKErrorUnavailable; + } + } + + EXPECT_EQ(result, FireboltSDKErrorNone); + return result; +} +int32_t test_generated_properties_get_accessibility_voiceguidancesettings() +{ + Accessibility_VoiceGuidanceSettings_t handle; + int32_t result = Accessibility_GetVoiceGuidanceSettings(&handle); + + if (result == FireboltSDKErrorNone) { + if (Accessibility_VoiceGuidanceSettings_IsValid(handle) == true) { + bool enabled = Accessibility_VoiceGuidanceSettings_Get_Enabled(handle); + uint32_t speed = Accessibility_VoiceGuidanceSettings_Get_Speed(handle); + printf("VoiceGuidanceSettings: Enabled : %d, Speed : %d\n", enabled, speed); + Accessibility_VoiceGuidanceSettings_Release(handle); + } else { + result = FireboltSDKErrorUnavailable; + } + } + EXPECT_EQ(result, FireboltSDKErrorNone); + return result; +} +const char* get_skiprestriction_enum_string(Advertising_SkipRestriction skipRestriction) +{ + const char* strSkipRestriction; + switch(skipRestriction) { + case ADVERTISING_SKIPRESTRICTION_NONE: + strSkipRestriction = "None"; + break; + case ADVERTISING_SKIPRESTRICTION_ADS_UNWATCHED: + strSkipRestriction = "AdsUnwatched"; + break; + case ADVERTISING_SKIPRESTRICTION_ADS_ALL: + strSkipRestriction = "AdsAll"; + break; + case ADVERTISING_SKIPRESTRICTION_ALL: + strSkipRestriction = "All"; + break; + default: + strSkipRestriction = "None"; + break; + } + return strSkipRestriction; +} + +int32_t test_generated_properties_get_advertising_policy() +{ + Advertising_AdPolicy_t handle; + int32_t result = Advertising_GetPolicy(&handle); + if (result == FireboltSDKErrorNone) { + if (Advertising_AdPolicy_IsValid(handle) == true) { + printf("AdPolicy: "); + Advertising_SkipRestriction skipRestriction = Advertising_AdPolicy_Get_SkipRestriction(handle); + printf("SkipRestriction = %s ", get_skiprestriction_enum_string(skipRestriction)); + bool limitAdTracking = Advertising_AdPolicy_Get_LimitAdTracking(handle); + printf("LimitAdTracking = %s \n", limitAdTracking? "true" : "false"); + Advertising_AdPolicy_Release(handle); + } else { + result = FireboltSDKErrorUnavailable; + } + } + EXPECT_EQ(result, FireboltSDKErrorNone); + return result; +} + +#include +#include +pthread_cond_t cond = PTHREAD_COND_INITIALIZER; +pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; + +static const char deviceNameTestStr[] = "DeviceNameTestStr"; +static void NotifyDeviceNameChange(const void* userData, Firebolt_String_t handle) +{ + EXPECT_NE(handle, NULL); + if (handle) { + printf("\nGot new device.name :%s\n", Firebolt_String(handle)); + Firebolt_String_Release(handle); + } + EXPECT_EQ(strncmp((const char*)userData, deviceNameTestStr, strlen(deviceNameTestStr)), 0); + pthread_cond_signal(&cond); +} +int32_t test_generated_event_device_name() +{ + int32_t result = Device_Register_OnNameChanged((const void*)&NotifyDeviceNameChange, deviceNameTestStr); + EXPECT_EQ(result, FireboltSDKErrorNone); + if (result != FireboltSDKErrorNone) { + printf("Set event device.name status = %d \n", result); + } else { + printf("Set event device.name registered successfully\n"); + + pthread_mutex_lock(&lock); + printf("Waiting for device.name event\n"); + pthread_cond_wait(&cond, &lock); + pthread_mutex_unlock(&lock); + } + + result = Device_Unregister_OnNameChanged((const void*)NotifyDeviceNameChange); + EXPECT_EQ(result, FireboltSDKErrorNone); + return result; +} + +int32_t test_generated_event_device_name_with_register_same_callback() +{ + int32_t result = Device_Register_OnNameChanged((const void*)NotifyDeviceNameChange, deviceNameTestStr); + EXPECT_EQ(result, FireboltSDKErrorNone); + if (result != FireboltSDKErrorNone) { + printf("Set event device.name status = %d \n", result); + } else { + printf("Set event device.name registered successfully\n"); + result = Device_Register_OnNameChanged((const void*)NotifyDeviceNameChange, deviceNameTestStr); + EXPECT_EQ(result, FireboltSDKErrorInUse); + if (result == FireboltSDKErrorInUse) { + printf("%s Yes this device.name event is already registered with same callback\n", __func__); + } + } + + result = Device_Unregister_OnNameChanged((const void*)NotifyDeviceNameChange); + EXPECT_EQ(result, FireboltSDKErrorNone); + return result; +} +static const char deviceScreenResolutionTestStr[] = "deviceScreenResolutionTestStr"; +static void NotifyDeviceScreenResolutionChange(const void* userData, Device_ResolutionArray_t handle) +{ + EXPECT_EQ(Device_ResolutionArray_IsValid(handle), true); + if (Device_ResolutionArray_IsValid(handle) == true) { + uint32_t size = Device_ResolutionArray_Size(handle); + printf("Device ScreenResolutions changed for %d numbers\n", size); + for (uint32_t i = 0; i < size; ++i) { + printf("New reslution[%d] = %d\n", i, Device_ResolutionArray_Get(handle, i)); + } + Device_ResolutionArray_Release(handle); + } + EXPECT_EQ(strncmp((const char*)userData, deviceScreenResolutionTestStr, strlen(deviceScreenResolutionTestStr)), 0); + pthread_cond_signal(&cond); +} +int32_t test_generated_event_device_screenresolution() +{ + int32_t result = Device_Register_OnScreenResolutionChanged((const void*)NotifyDeviceScreenResolutionChange, deviceScreenResolutionTestStr); + EXPECT_EQ(result, FireboltSDKErrorNone); + if (result != FireboltSDKErrorNone) { + printf("Set event device.screenresolution status = %d \n", result); + } else { + printf("Set event device.screenresolution registered successfully\n"); + + pthread_mutex_lock(&lock); + printf("Waiting for device.screenresolution event\n"); + pthread_cond_wait(&cond, &lock); + pthread_mutex_unlock(&lock); + } + + result = Device_Unregister_OnScreenResolutionChanged((const void*)NotifyDeviceScreenResolutionChange); + EXPECT_EQ(result, FireboltSDKErrorNone); + return result; +} + +static const char accessibilityVoiceGuidanceTestStr[] = "AccessibilityVoiceGuidanceTestStr"; +static void NotifyAccessibilityVoiceGuidanceChange(const void* userData, Accessibility_VoiceGuidanceSettings_t handle) +{ + EXPECT_EQ(Accessibility_VoiceGuidanceSettings_IsValid(handle), true); + if (Accessibility_VoiceGuidanceSettings_IsValid(handle) == true) { + bool enabled = Accessibility_VoiceGuidanceSettings_Get_Enabled(handle); + uint32_t speed = Accessibility_VoiceGuidanceSettings_Get_Speed(handle); + printf("VoiceGuidanceSettings: Enabled : %d, Speed : %d\n", enabled, speed); + Accessibility_VoiceGuidanceSettings_Release(handle); + } + EXPECT_EQ(strncmp((const char*)userData, accessibilityVoiceGuidanceTestStr, strlen(accessibilityVoiceGuidanceTestStr)), 0); + pthread_cond_signal(&cond); +} +int32_t test_generated_event_accessibility_voice_guidance_settings() +{ + int32_t result = Accessibility_Register_OnVoiceGuidanceSettingsChanged((const void*)NotifyAccessibilityVoiceGuidanceChange, accessibilityVoiceGuidanceTestStr); + EXPECT_EQ(result, FireboltSDKErrorNone); + if (result != FireboltSDKErrorNone) { + printf("Set event device.name status = %d \n", result); + } else { + printf("Set event accessibility.voiceguidance registered successfully\n"); + + pthread_mutex_lock(&lock); + printf("Waiting for accessibility.voiceguidance event\n"); + pthread_cond_wait(&cond, &lock); + pthread_mutex_unlock(&lock); + } + + result = Accessibility_Unregister_OnVoiceGuidanceSettingsChanged((const void*)NotifyAccessibilityVoiceGuidanceChange); + EXPECT_EQ(result, FireboltSDKErrorNone); + return result; +} +#if 0 +int32_t test_generated_calls_metrics_lifecycle_ready() +{ + int32_t result = Lifecycle_Ready(); + if (result != FireboltSDKErrorNone) { + printf("Lifecycle.ready call status = %d \n", result); + } else { + printf("Lifecycle.ready is called successfully\n"); + } + // Just add sleep() to keep the test process in active for a while, since the test process should be in-active to invoke worker pool dispatcher (for calls-metrics mehods). This sleep is not required for actual apps case. + sleep(1); + return result; +} +#endif +#ifdef __cplusplus +} +#endif diff --git a/src/sdks/core/src/cpp/sdk/test/CoreSDKTestGeneratedCode.h b/src/sdks/core/src/cpp/sdk/test/CoreSDKTestGeneratedCode.h new file mode 100644 index 000000000..4b9d12441 --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/test/CoreSDKTestGeneratedCode.h @@ -0,0 +1,42 @@ +/* + * 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 + */ + +#ifndef CORESDK_TEST_GENERATED_CODE_H +#define CORESDK_TEST_GENERATED_CODE_H + + +#ifdef __cplusplus +extern "C" { +#endif + +//int32_t test_generated_properties_get_device_version(); +int32_t test_generated_properties_get_device_id(); +int32_t test_generated_properties_get_accessibility_closedcaption(); +int32_t test_generated_properties_get_accessibility_voiceguidancesettings(); +int32_t test_generated_properties_get_advertising_policy(); +int32_t test_generated_event_device_name(); +int32_t test_generated_event_device_name_with_register_same_callback(); +int32_t test_generated_event_device_screenresolution(); +int32_t test_generated_event_accessibility_voice_guidance_settings(); +//int32_t test_generated_calls_metrics_lifecycle_ready(); + +#ifdef __cplusplus +} +#endif + +#endif // CORESDK_TEST_GENERATED_CODE_H diff --git a/src/sdks/core/src/cpp/sdk/test/CoreSDKTests.cpp b/src/sdks/core/src/cpp/sdk/test/CoreSDKTests.cpp new file mode 100644 index 000000000..cfcca0686 --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/test/CoreSDKTests.cpp @@ -0,0 +1,86 @@ +/* + * 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 "Module.h" +#include "CoreSDKTests.h" + +namespace FireboltSDK { + CoreTests::CoreTests() + : Tests() + { + _functionMap.emplace(std::piecewise_construct, std::forward_as_tuple("Get Discovery Policy"), + std::forward_as_tuple(&GetDiscoveryPolicy)); + } + + /* static */ int32_t CoreTests::GetDiscoveryPolicy() + { + const string method = _T("discovery.policy"); + WPEFramework::Core::ProxyType response; + int32_t status = FireboltSDK::Properties::Get(method, response); + + EXPECT_EQ(status, FireboltSDKErrorNone); + if (status == FireboltSDKErrorNone) { + FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::Core, Logger::Module(), + "EnableRecommendations : %d", response->EnableRecommendations.Value()); + FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::Core, Logger::Module(), + "ShareWatchHistory : %d", response->ShareWatchHistory.Value()); + FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::Core, Logger::Module(), + "RememberWatchedPrograms : %d", response->RememberWatchedPrograms.Value()); + } else { + FIREBOLT_LOG_ERROR(FireboltSDK::Logger::Category::Core, Logger::Module(), + "Get %s status = %d", method.c_str(), status); + } + + return status; + } +} + +#ifdef __cplusplus +extern "C" { +#endif + +int32_t test_firebolt_core_main() +{ + return FireboltSDK::Tests::Main(); +} + +int32_t test_properties_get_policy() +{ + const string method = _T("discovery.policy"); + WPEFramework::Core::ProxyType response; + int32_t status = FireboltSDK::Properties::Get(method, response); + + EXPECT_EQ(status, FireboltSDKErrorNone); + if (status == FireboltSDKErrorNone) { + FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::Core, "ctest", + "EnableRecommendations : %d", response->EnableRecommendations.Value()); + FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::Core, "ctest", + "ShareWatchHistory : %d", response->ShareWatchHistory.Value()); + FIREBOLT_LOG_INFO(FireboltSDK::Logger::Category::Core, "ctest", + "RememberWatchedPrograms : %d", response->RememberWatchedPrograms.Value()); + } else { + FIREBOLT_LOG_ERROR(FireboltSDK::Logger::Category::Core, "ctest", + "Get %s status = %d", method.c_str(), status); + } + + return status; +} + +#ifdef __cplusplus +} +#endif diff --git a/src/sdks/core/src/cpp/sdk/test/CoreSDKTests.h b/src/sdks/core/src/cpp/sdk/test/CoreSDKTests.h new file mode 100644 index 000000000..480129e6d --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/test/CoreSDKTests.h @@ -0,0 +1,62 @@ +/* + * 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 + +namespace FireboltSDK { + class Policy : public WPEFramework::Core::JSON::Container { + public: + Policy(const Policy& copy) = delete; + Policy() + : WPEFramework::Core::JSON::Container() + , EnableRecommendations(false) + , ShareWatchHistory(false) + , RememberWatchedPrograms(false) + { + Add(_T("enableRecommendations"), &EnableRecommendations); + Add(_T("shareWatchHistory"), &ShareWatchHistory); + Add(_T("rememberWatchedPrograms"), &RememberWatchedPrograms); + } + Policy& operator=(const Policy& RHS) + { + EnableRecommendations = RHS.EnableRecommendations; + ShareWatchHistory = RHS.ShareWatchHistory; + RememberWatchedPrograms = RHS.RememberWatchedPrograms; + + return (*this); + } + + ~Policy() override = default; + + public: + WPEFramework::Core::JSON::Boolean EnableRecommendations; + WPEFramework::Core::JSON::Boolean ShareWatchHistory; + WPEFramework::Core::JSON::Boolean RememberWatchedPrograms; + }; + + class CoreTests : public Tests { + + public: + CoreTests(); + ~CoreTests() override = default; + + static int32_t GetDiscoveryPolicy(); + }; +} diff --git a/src/sdks/core/src/cpp/sdk/test/Main.c b/src/sdks/core/src/cpp/sdk/test/Main.c new file mode 100644 index 000000000..2490dbb95 --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/test/Main.c @@ -0,0 +1,57 @@ +/* + * 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 "CoreSDKCTests.h" +#include "CoreSDKTestGeneratedCode.h" + +int __cnt = 0; +int __pass = 0; + +int TotalTests = 0; +int TotalTestsPassed = 0; + +int main() +{ + test_firebolt_create_instance(); + test_firebolt_core_main(); + + // Calling C function sequences + printf("%s:%s:%d Calling C function tests\n", __FILE__, __func__, __LINE__); + EXECUTE("test_properties_get_device_id", test_properties_get_device_id); + EXECUTE("test_properties_get_policy", test_properties_get_policy); + EXECUTE("test_properties_set", test_properties_set); + EXECUTE("test_eventregister_by_providing_callback", test_eventregister_by_providing_callback); + EXECUTE("test_eventregister", test_eventregister); + EXECUTE("test_string_set_get_value", test_string_set_get_value); + EXECUTE("test_generated_properties_get_device_id", test_generated_properties_get_device_id); + //EXECUTE("test_generated_properties_get_device_version", test_generated_properties_get_device_version); + EXECUTE("test_generated_properties_get_accessibility_closedcaption", test_generated_properties_get_accessibility_closedcaption); + EXECUTE("test_generated_properties_get_accessibility_voiceguidancesettings", test_generated_properties_get_accessibility_voiceguidancesettings); + EXECUTE("test_generated_properties_get_advertising_policy", test_generated_properties_get_advertising_policy); + EXECUTE("test_generated_event_device_name", test_generated_event_device_name); + EXECUTE("test_generated_event_device_name_with_register_same_callback", test_generated_event_device_name_with_register_same_callback); + EXECUTE("test_generated_event_device_screenresolution", test_generated_event_device_screenresolution); + EXECUTE("test_generated_event_accessibility_voice_guidance_settings", test_generated_event_accessibility_voice_guidance_settings); + //EXECUTE("test_generated_calls_metrics_lifecycle_ready", test_generated_calls_metrics_lifecycle_ready); + + test_firebolt_dispose_instance(); + + printf("TOTAL: %i tests; %i PASSED, %i FAILED\n", TotalTests, TotalTestsPassed, (TotalTests - TotalTestsPassed)); +} + diff --git a/src/sdks/core/src/cpp/sdk/test/Module.cpp b/src/sdks/core/src/cpp/sdk/test/Module.cpp new file mode 100644 index 000000000..d63badc4b --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/test/Module.cpp @@ -0,0 +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 "Module.h" + +MODULE_NAME_DECLARATION(BUILD_REFERENCE) diff --git a/src/sdks/core/src/cpp/sdk/test/Module.h b/src/sdks/core/src/cpp/sdk/test/Module.h new file mode 100644 index 000000000..c32a6dcd0 --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/test/Module.h @@ -0,0 +1,28 @@ +/* + * 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 + +#ifndef MODULE_NAME +#define MODULE_NAME OpenRPCCoreTestApp +#endif + +#include + +#undef EXTERNAL +#define EXTERNAL diff --git a/src/sdks/core/src/js/sdk/Lifecycle/defaults.mjs b/src/sdks/core/src/js/sdk/Lifecycle/defaults.mjs index 3cdf2deeb..324d4267a 100644 --- a/src/sdks/core/src/js/sdk/Lifecycle/defaults.mjs +++ b/src/sdks/core/src/js/sdk/Lifecycle/defaults.mjs @@ -28,7 +28,8 @@ const emit = (value) => { MockTransport.event('Lifecycle', value.state, value) } -const automation = window.__firebolt ? !!window.__firebolt.automation : false +const win = typeof window !== 'undefined' ? window : {} +const automation = win.__firebolt ? !!win.__firebolt.automation : false export default { ready: function() { @@ -56,7 +57,8 @@ export default { }, finished: function() { - if (window.location) - window.location.href = "about:blank" + if (win.location) + win.location.href = "about:blank" }, } + diff --git a/src/sdks/core/test/suite/lazy-transport.test.ts b/src/sdks/core/test/suite/lazy-transport.test.ts new file mode 100644 index 000000000..ebfb739fe --- /dev/null +++ b/src/sdks/core/test/suite/lazy-transport.test.ts @@ -0,0 +1,115 @@ +/* + * Copyright 2021 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 + */ + +// NOTE: this test SHOULD NOT include Setup, since it does it's own +// setup for Firebolt SDK/TL handshake +const win = globalThis || window + +import Setup from '../../../../../test/Setup' +import { beforeAll, test, expect } from '@jest/globals'; +import { Lifecycle, Discovery } from "../../build/javascript/src/firebolt"; + +// holds test transport layer state, e.g. callback +type stateType = { + callback: (arg0: string) => void | null +} + +const state:stateType = { + callback: null +} + +let navigateToListenCount = 0 +let pullEntityInfoListenCount = 0 +let callbackWiredUp = false +let sendCalled = false + +const transport = { + send: function(message) { + sendCalled = true + const json = JSON.parse(message) + console.log('transport.send: ' + json.method) + if (json.method.toLowerCase() === 'lifecycle.ready') { + // we'll assert on this later... + navigateToListenCount++ + if (state.callback) { + // we'll assert on this later... + callbackWiredUp = true + let response = { + jsonrpc: '2.0', + id: json.id, + result: true + } + // catching errors, so all tests don't fail if this breaks + try { + // send back the onInactive event immediately, to test for race conditions + state.callback(JSON.stringify(response)) + } + catch (err) { + // fail silenetly (the boolean-based tests below will figure it out...) + } + } + } + else if (json.method.toLowerCase() === 'discovery.onpullentityinfo') { + pullEntityInfoListenCount++ + } + }, + receive: function(callback) { + console.log('transport.receive') + // store the callback + state.callback = callback + } +} + +beforeAll(()=> { + + // listen twice, using event-specific call FIRST + Discovery.listen("navigateTo", (value) => { callbackWiredUp = true }) + Discovery.listen("navigateTo", (value) => { /* this just adds more listen calls to make sure we don't spam */ }) + Discovery.listen((event, value) => { /* testing both listen signatures */ }) + Discovery.listen((event, value) => { /* testing both listen signatures */ }) + // listen three more times, using wildcard FIRST (from above) + + let p = new Promise( (resolve, reject) => { + setTimeout( _ => { + resolve(null) + }, 4000) + }) + + Lifecycle.ready() + + win.__firebolt.setTransportLayer(transport) + + return p +}) + + +test('Transport injected after SDK', () => { + expect(callbackWiredUp).toBe(true) +}); + +test('Transport send method working', () => { + expect(sendCalled).toBe(true) +}); + +test('Transport was sent listeners', () => { + expect(navigateToListenCount).toBeGreaterThan(0) +}); + +test('Transport was sent each listener only once', () => { + expect(navigateToListenCount).toBe(1) +}); diff --git a/src/sdks/manage/CHANGELOG.md b/src/sdks/manage/CHANGELOG.md index 3e2204b10..e79f5d7a3 100644 --- a/src/sdks/manage/CHANGELOG.md +++ b/src/sdks/manage/CHANGELOG.md @@ -1,3 +1,34 @@ +# [0.17.1](https://github.com/rdkcentral/firebolt-apis/compare/v0.17.0...v0.17.1) (2023-09-15) + +### Bug Fixes + +fix: Add enumerated values for fontFamily/fontEdge (#181) + +# [0.17.0](https://github.com/rdkcentral/firebolt-apis/compare/v0.16.0...v0.17.0) (2023-09-07) + +### Bug Fixes + +* fix: Using 3 letter ISO639 language codes ([#173](https://github.com/rdkcentral/firebolt-apis/issues/173)) + +# [0.16.0](https://github.com/rdkcentral/firebolt-apis/compare/v0.15.0...v0.16.0) (2023-08-14) + +### Features + +* Added Manage APIs for `windlowColor` and `windowOpacity` ([#157](https://github.com/rdkcentral/firebolt-apis/issues/157)) ([f508358](https://github.com/rdkcentral/firebolt-apis/commit/f508358aeb2f58bb3893bbfaf09e2340fcadac8f)) + +# [0.15.0](https://github.com/rdkcentral/firebolt-apis/compare/v0.14.0...v0.15.0) (2023-07-31) + +### Bug Fixes + +* Rename Advisory "Committee" to "Board" ([#135](https://github.com/rdkcentral/firebolt-apis/issues/135)) ([ef410c4](https://github.com/rdkcentral/firebolt-apis/commit/ef410c43bbb32414c3aa1d11b43093565cc90edf)) +* window fix from firebolt-openrpc 2.0.3 ([8c06dd1](https://github.com/rdkcentral/firebolt-apis/commit/8c06dd1432822719f5634e2877b36efdf02a4809)) + +### Features + +* **Nullable CC Styles** Added support to set and get null in ClosedCaptions style fields ([#150](https://github.com/rdkcentral/firebolt-apis/issues/150)) ([9c511e4](https://github.com/rdkcentral/firebolt-apis/commit/9c511e4fddebcdf5dfc04e9e8e31f98ab7eef680)) +* **Window CC Styles** Added windowColor and windowOpacity to closedCaptions style ([#145](https://github.com/rdkcentral/firebolt-apis/issues/145)) ([f65b901](https://github.com/rdkcentral/firebolt-apis/commit/f65b9019bda22400df9b9634c332e720db38118d)) +* **Audio Descriptions** Audio Description and Preferred Audio Languages Settings ([#45](https://github.com/rdkcentral/firebolt-apis/issues/45)) ([58f6ea1](https://github.com/rdkcentral/firebolt-apis/commit/58f6ea1dde7a819883eb3da24f879b6a9ecc9a41)) + # [0.14.0](https://github.com/rdkcentral/firebolt-apis/compare/v0.13.0...v0.14.0) (2023-06-22) ### Bug Fixes diff --git a/src/sdks/manage/package.json b/src/sdks/manage/package.json index 264f0742f..75f7d78f7 100644 --- a/src/sdks/manage/package.json +++ b/src/sdks/manage/package.json @@ -1,6 +1,6 @@ { "name": "@firebolt-js/manage-sdk", - "version": "0.16.0-test.1", + "version": "0.18.0-next.4", "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/sdk.config.json b/src/sdks/manage/sdk.config.json index 8d67b1396..56d869412 100644 --- a/src/sdks/manage/sdk.config.json +++ b/src/sdks/manage/sdk.config.json @@ -48,6 +48,15 @@ "xrn:firebolt:capability:accessibility:closedcaptions" ] }, + { + "module": "AudioDescriptions", + "use": [ + "xrn:firebolt:capability:accessibility:audiodescriptions" + ], + "manage": [ + "xrn:firebolt:capability:accessibility:audiodescriptions" + ] + }, { "module": "VoiceGuidance", "use": [ diff --git a/src/sdks/manage/test/suite/closedCaptions.test.ts b/src/sdks/manage/test/suite/closedCaptions.test.ts index d43da3f13..90c15417f 100644 --- a/src/sdks/manage/test/suite/closedCaptions.test.ts +++ b/src/sdks/manage/test/suite/closedCaptions.test.ts @@ -27,7 +27,7 @@ test("ClosedCaptions.enabled()", () => { test("ClosedCaptions.fontFamily()", () => { return ClosedCaptions.fontFamily().then((res: string) => { - expect(res).toEqual("monospace"); + expect(res).toEqual("monospaced_sanserif"); }); }); @@ -87,7 +87,7 @@ test("ClosedCaptions.textAlignVertical()", () => { test("ClosedCaptions.listen()", () => { return ClosedCaptions.listen("fontColorChanged", () => {}).then( - (res: Number) => { + (res: number) => { expect(res > 0).toBe(true); } ); @@ -95,7 +95,7 @@ test("ClosedCaptions.listen()", () => { test("ClosedCaptions.once()", () => { return ClosedCaptions.once("fontColorChanged", () => {}).then( - (res: Number) => { + (res: number) => { expect(res > 0).toBe(true); } ); @@ -104,4 +104,19 @@ test("ClosedCaptions.once()", () => { test("clear", () => { const result = ClosedCaptions.clear(-1000); expect(result).toBeFalsy(); -}); \ No newline at end of file +}); + +test("ClosedCaptions.setFontColor() with null", async () => { + const oldValue = await ClosedCaptions.fontColor() + return ClosedCaptions.fontColor(null).then(async (res: null) => { + expect(res).toBe(null); + const newValue = await ClosedCaptions.fontColor() + expect(newValue).toBe(null) + }); +}); + +test("ClosedCaptions.setFontColor() with ffffff", () => { + return ClosedCaptions.fontColor("#ffffff").then((res: null) => { + expect(res).toBe(null); + }); +});