feat: Add basic implementation of C++ Client#5
Conversation
* feature: draft cpp api * chore: Update NOTICE with Sky Copyright section * device api changed to comply with openrpc api --------- Co-authored-by: Adam Czynszak <adam.czynszak@sky.uk> Co-authored-by: Marcin Wojciechowski <marcin.wojciechowski@sky.uk>
This PR contains all changes present in PR #:392 * feat: Split CPP-SDK into separate repositories Transport abstraction has been moved into separate repository as the same abstraction is being used by other SDKs. * feat: Set unique name for demo app * feat: Enable Demo App from the main cmake * fix: Build demo app from the main cmake and separately * feat: Do not reference to IModule * fix: Update to new namespaces introduced in firebolt-native-transport * feat: Move json types to separate dir
There was a problem hiding this comment.
Pull request overview
This PR adds a comprehensive C++ client implementation for the Firebolt SDK, introducing core functionality for device management, lifecycle control, secure storage, localization, HDMI input handling, metrics, and closed captions management.
Key Changes:
- Complete C++ SDK implementation with interface abstractions and implementations for multiple Firebolt modules
- Comprehensive test suite including unit tests and integration tests using GoogleTest
- Demo application showcasing SDK usage patterns
- Build system setup using CMake with support for both static and shared libraries
Reviewed changes
Copilot reviewed 57 out of 58 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| include/*.h | Public API headers defining interfaces for Device, HDMIInput, Lifecycle, Localization, Metrics, SecureStorage, and ClosedCaptions modules |
| src/*_impl.{h,cpp} | Implementation classes for all SDK modules with JSON serialization/deserialization |
| src/json_types/* | JSON data type converters for translating between C++ types and WPEFramework JSON types |
| src/firebolt.cpp | Main accessor implementation providing unified interface to all SDK modules |
| test/unit/*Test.cpp | Unit tests for all major SDK modules using GoogleTest framework |
| test/CoreSDKTest.{h,cpp} | Integration test suite with comprehensive coverage of SDK functionality |
| test/Main.cpp, test/Unit.cpp | Test harness implementations for both manual and automated test execution |
| demo/FireboltDemoService.{h,cpp} | Demo service showcasing SDK initialization, device queries, and event subscriptions |
| demo/main.cpp | Demo application entry point |
| CMakeLists.txt, src/CMakeLists.txt, test/CMakeLists.txt, demo/CMakeLists.txt | Build configuration for all project components |
| build.sh, demo/build.sh | Build scripts for streamlined compilation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| else | ||
| { | ||
| std::cout << "Get device video resolution failed, error: << " << videoResolution.error() << std::endl; |
There was a problem hiding this comment.
Typo in error message: "error: << " has an extra space between colon and "<<". Should be "error: " << "
| std::cout << "Get device video resolution failed, error: << " << videoResolution.error() << std::endl; | |
| std::cout << "Get device video resolution failed, error: " << videoResolution.error() << std::endl; |
| else | ||
| { | ||
| std::string errorMessage = "Error: " + std::to_string(static_cast<int>(result.error())); | ||
| throw std::runtime_error("SetEdidVersionfailed. " + errorMessage); |
There was a problem hiding this comment.
Typo in error message: "SetEdidVersionfailed" is missing a space. Should be "SetEdidVersion failed".
| std::cout << "Get device model failed, error: << " << model.error() << std::endl; | ||
| } | ||
| if (auto name = Firebolt::IFireboltAccessor::Instance().DeviceInterface().name()) | ||
| { | ||
| std::cout << "Device name is: " << *name << std::endl; | ||
| result.name = *name; | ||
| currentDeviceName_ = *name; | ||
| } | ||
| else | ||
| { | ||
| std::cout << "Get device name failed, error: << " << name.error() << std::endl; | ||
| } | ||
| if (auto platform = Firebolt::IFireboltAccessor::Instance().DeviceInterface().platform()) | ||
| { | ||
| std::cout << "Device platform is: " << *platform << std::endl; | ||
| result.platform = *platform; | ||
| } | ||
| else | ||
| { | ||
| std::cout << "Get device platform failed, error: << " << platform.error() << std::endl; | ||
| } | ||
| if (auto type = Firebolt::IFireboltAccessor::Instance().DeviceInterface().type()) | ||
| { | ||
| std::cout << "Device type is: " << *type << std::endl; | ||
| result.type = *type; | ||
| } | ||
| else | ||
| { | ||
| std::cout << "Get device type failed, error: << " << type.error() << std::endl; | ||
| } | ||
| if (auto uid = Firebolt::IFireboltAccessor::Instance().DeviceInterface().uid()) | ||
| { | ||
| std::cout << "Device uid is: " << *uid << std::endl; | ||
| result.uid = *uid; | ||
| } | ||
| else | ||
| { | ||
| std::cout << "Get device uid failed, error: << " << uid.error() << std::endl; | ||
| } | ||
| if (auto version = Firebolt::IFireboltAccessor::Instance().DeviceInterface().version()) | ||
| { | ||
| std::cout << "SDL version is: " << version->sdk.major << "." << version->sdk.minor << "." << version->sdk.patch | ||
| << " " << version->sdk.readable << std::endl; | ||
| std::cout << "API version is: " << version->api.major << "." << version->api.minor << "." << version->api.patch | ||
| << " " << version->api.readable << std::endl; | ||
| std::cout << "Firmware version is: " << version->firmware.major << "." << version->firmware.minor << "." | ||
| << version->firmware.patch << " " << version->firmware.readable << std::endl; | ||
| std::cout << "Debug version info is: " << version->debug << std::endl; | ||
| } | ||
| else | ||
| { | ||
| std::cout << "Device version failed, error: << " << version.error() << std::endl; | ||
| } | ||
| if (auto networkInfo = Firebolt::IFireboltAccessor::Instance().DeviceInterface().network()) | ||
| { | ||
| std::cout << "Device network is: state: " << static_cast<int>(networkInfo->state) << ", type: " << static_cast<int>(networkInfo->type) | ||
| << std::endl; | ||
| } | ||
| else | ||
| { | ||
| std::cout << "Get device network failed, error: << " << networkInfo.error() << std::endl; |
There was a problem hiding this comment.
Multiple error messages have the same typo: "error: << " with an extra space between colon and "<<". All should be corrected to "error: " << ". This occurs on lines 220, 230, 239, 248, 257, 271, and 280.
| @@ -0,0 +1,19 @@ | |||
| #!/usr/bin/env bash | |||
|
|
|||
| set -e | |||
There was a problem hiding this comment.
The script should use set -eu for strict error handling instead of just set -e. This is consistent with the repository's convention for bash scripts as seen in other scripts.
| set -e | |
| set -eu |
| auto result = Firebolt::IFireboltAccessor::Instance() | ||
| .SecureStorageInterface() | ||
| .clearForApp("foo", Firebolt::SecureStorage::StorageScope::ACCOUNT); | ||
| EXPECT_EQ(result.error(), Firebolt::Error::None) << "Error on calling SecureStorage.removeForApp() method"; |
There was a problem hiding this comment.
The error message incorrectly references "SecureStorage.removeForApp()" but this test is for "clearForApp()". The error message should say "Error on calling SecureStorage.clearForApp() method".
| } | ||
| else | ||
| { | ||
| std::cout << "Get device id failed, error: << " << id.error() << std::endl; |
There was a problem hiding this comment.
Typo in error message: "error: << " has an extra space between colon and "<<". Should be "error: " << "
| } | ||
| else | ||
| { | ||
| std::cout << "Get device manufacturer failed, error: << " << manufacturer.error() << std::endl; |
There was a problem hiding this comment.
Typo in error message: "error: << " has an extra space between colon and "<<". Should be "error: " << "
| } | ||
| else | ||
| { | ||
| std::cout << "Get device screen resolution failed, error: << " << screenResolution.error() << std::endl; |
There was a problem hiding this comment.
Typo in error message: "error: << " has an extra space between colon and "<<". Should be "error: " << "
|
Copilot suggestions were ignored since the code was cherry-picked from firebolt-apis and should remain intact. |
|
🎉 This PR is included in version 0.1.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
No description provided.