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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,57 @@ jobs:
--openrpc /workspace/docs/openrpc/the-spec/firebolt-open-rpc.json \
--app-openrpc /workspace/docs/openrpc/the-spec/firebolt-app-open-rpc.json \
--test-exe /workspace/build/test/FireboltClientComponentTests

cpp_demo_tests:
permissions:
contents: read
packages: read
needs: [build_docker]
runs-on: ubuntu-latest
steps:
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get version
run: |
VERSION=$(git describe --tags --dirty --match "v[0-9]*")
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "version: $VERSION"

- name: Configure Project with Demo
run: |
docker run --rm --user "$(id -u):$(id -g)" -v ${{ github.workspace }}:/workspace ${{ needs.build_docker.outputs.image_tag }} \
bash -c " \
set -e \
&& cmake -B build -S . \
-DCMAKE_BUILD_TYPE=Debug \
-DENABLE_DEMO_APP=ON \
"

- name: Build Project with cpp_test
run: |
docker run --rm --user "$(id -u):$(id -g)" -v ${{ github.workspace }}:/workspace ${{ needs.build_docker.outputs.image_tag }} \
bash -c " \
set -e \
&& cmake --build build --parallel \
"

- name: Run cpp_test executable
run: |
chmod +x ${{ github.workspace }}/build/test/cpp_test/cpp_test
docker run --rm --user "$(id -u):$(id -g)" -v ${{ github.workspace }}:/workspace ${{ needs.build_docker.outputs.image_tag }} \
bash -c " \
set -e \
&& cd /workspace/build/test/cpp_test \
&& ./cpp_test \
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cpp_test executable is being run without any arguments, but it appears to require a connection to a WebSocket server at ws://127.0.0.1:9998 (see main.cpp line 90). The test will likely fail because no mock server or actual server is set up in the CI environment. Consider either adding the -auto flag for automated testing, setting up a mock server, or handling connection failures gracefully in CI.

Suggested change
&& ./cpp_test \
&& ./cpp_test -auto \

Copilot uses AI. Check for mistakes.
"

Comment on lines +304 to +305
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a trailing tab character at the end of this line. This should be removed to maintain consistent whitespace in the file.

Suggested change
"
"

Copilot uses AI. Check for mistakes.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,10 @@ add_subdirectory(src)

if (ENABLE_DEMO_APP)
add_subdirectory(demo)
add_subdirectory(test/cpp_test) #for now
endif()

if (ENABLE_TESTS)
add_subdirectory(test)
Comment on lines +94 to 98
Copy link

Copilot AI Jan 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment "for now" suggests this is a temporary change. If this test directory should be built as part of the demo app conditionally, the comment should clarify the future plan, or this should be added under ENABLE_TESTS instead of ENABLE_DEMO_APP.

Suggested change
add_subdirectory(test/cpp_test) #for now
endif()
if (ENABLE_TESTS)
add_subdirectory(test)
endif()
if (ENABLE_TESTS)
add_subdirectory(test)
add_subdirectory(test/cpp_test)

Copilot uses AI. Check for mistakes.
endif()

54 changes: 54 additions & 0 deletions test/cpp_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
cmake_minimum_required(VERSION 3.10)
project(cpp_test)

set(CMAKE_CXX_STANDARD 17)

add_executable(cpp_test
main.cpp
cpp/advertisingDemo.cpp
cpp/accessibilityDemo.cpp
cpp/chooseInterface.cpp
cpp/deviceDemo.cpp
cpp/displayDemo.cpp
cpp/fireboltdemo.cpp
cpp/lifecycleDemo.cpp
cpp/localizationDemo.cpp
cpp/presentationDemo.cpp
cpp/statsDemo.cpp
cpp/utils.cpp
)

list(APPEND CMAKE_PREFIX_PATH ${SYSROOT_PATH})

find_package(FireboltTransport)
find_package(nlohmann_json REQUIRED)
find_package(nlohmann_json_schema_validator REQUIRED)
find_package(CURL REQUIRED)

# Generate header file with embedded JSON content
file(READ "../../docs/openrpc/the-spec/firebolt-open-rpc.json" JSON_CONTENT)
configure_file(
cpp/firebolt-open-rpc.json.in
"${CMAKE_BINARY_DIR}/generated/firebolt-open-rpc_json.h"
@ONLY
)

# Make sure your target can find the generated header
target_include_directories(cpp_test PRIVATE ${CMAKE_BINARY_DIR}/generated)

target_include_directories(cpp_test PRIVATE
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include/>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src/>
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/test/>
)

add_compile_definitions(UT_OPEN_RPC_FILE="firebolt-open-rpc.json")

target_link_libraries(cpp_test
FireboltClient
FireboltTransport::FireboltTransport
nlohmann_json::nlohmann_json
nlohmann_json_schema_validator::validator
CURL::libcurl
)
84 changes: 84 additions & 0 deletions test/cpp_test/cpp/accessibilityDemo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/**
* Copyright 2025 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 "accessibilityDemo.h"
#include <iostream>
#include <string>
#include <vector>

#include "json_types/jsondata_device_types.h"

#include "outputstream.h"
extern OutputStream gOutput;

using namespace Firebolt;
using namespace Firebolt::Accessibility;

AccessibilityDemo::AccessibilityDemo()
: IFireboltDemo()
{
methodsFromRpc("Accessibility");
}

void AccessibilityDemo::runOption(const int index)
{
std::string key = names_[index];

outStream_ << "Running Accessibility method: " << key << std::endl;

if (key == "Accessibility.closedCaptionsSettings")
{
Result<ClosedCaptionsSettings> r =
Firebolt::IFireboltAccessor::Instance().AccessibilityInterface().closedCaptionsSettings();
if (validateResult(r))
{
ClosedCaptionsSettings settings = r.value();
gOutput << "Closed Captions Settings - Enabled: " << (settings.enabled ? "true" : "false") << std::endl;
}
}
else if (key == "Accessibility.audioDescription")
{
Result<bool> r = Firebolt::IFireboltAccessor::Instance().AccessibilityInterface().audioDescription();
if (validateResult(r))
{
bool enabled = r.value();
gOutput << "Audio Description Enabled: " << (enabled ? "true" : "false") << std::endl;
}
}
else if (key == "Accessibility.highContrastUI")
{
Result<bool> r = Firebolt::IFireboltAccessor::Instance().AccessibilityInterface().highContrastUI();
if (validateResult(r))
{
bool enabled = r.value();

gOutput << "High Contrast UI Enabled: " << (enabled ? "true" : "false") << std::endl;
}
}
else if (key == "Accessibility.voiceGuidanceSettings")
{
Result<VoiceGuidanceSettings> r =
Firebolt::IFireboltAccessor::Instance().AccessibilityInterface().voiceGuidanceSettings();
if (validateResult(r))
{
VoiceGuidanceSettings settings = r.value();
gOutput << "Voice Guidance Settings - Enabled: " << (settings.enabled ? "true" : "false")
<< ", Rate: " << settings.rate << std::endl;
}
}
}
31 changes: 31 additions & 0 deletions test/cpp_test/cpp/accessibilityDemo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* Copyright 2025 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 <string>
#include <vector>
#include "fireboltdemo.h"

class AccessibilityDemo : public IFireboltDemo
{
public:
AccessibilityDemo();
~AccessibilityDemo() = default;
void runOption(const int index);
};
54 changes: 54 additions & 0 deletions test/cpp_test/cpp/advertisingDemo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* Copyright 2025 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 "advertisingDemo.h"
#include <iostream>
#include <string>
#include <vector>

#include "outputstream.h"
extern OutputStream gOutput;

// #include "json_types/jsondata_device_types.h"

using namespace Firebolt;
using namespace Firebolt::Advertising;

AdvertisingDemo::AdvertisingDemo()
: IFireboltDemo()
{
methodsFromRpc("Advertising");
}

void AdvertisingDemo::runOption(const int index)
{
std::string key = names_[index];

if (key == "Advertising.advertisingId")
{
Result<Ifa> result = Firebolt::IFireboltAccessor::Instance().AdvertisingInterface().advertisingId();
if (validateResult(result))
{
Ifa ifa = result.value();
gOutput << "IFA: " << ifa.ifa << std::endl;
gOutput << "IFA Type: " << ifa.ifa_type << std::endl;
gOutput << "LMT: " << ifa.lmt << std::endl;
}
}
}
31 changes: 31 additions & 0 deletions test/cpp_test/cpp/advertisingDemo.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* Copyright 2025 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 <string>
#include <vector>
#include "fireboltdemo.h"

class AdvertisingDemo : public IFireboltDemo
{
public:
AdvertisingDemo();
~AdvertisingDemo() = default;
void runOption(const int index);
};
Loading