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

Filter by extension

Filter by extension

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

### Changed
- Added protocol selection to the API Test App: `[--legacy | --rpc-v2]`

## [0.5.2](https://github.com/rdkcentral/firebolt-cpp-client/compare/v0.5.1...v0.5.2)

### Changed
Expand Down
8 changes: 7 additions & 1 deletion test/api_test_app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The app binary name is:
## Command Line Usage

```bash
api-test-app [--auto] [--mock] [--platform] [--url <URL>] [--dbg] [--help]
api-test-app [--auto] [--mock] [--platform] [--url <URL>] [--legacy | --rpc-v2] [--dbg] [--help]
```

### Options
Expand All @@ -34,6 +34,12 @@ api-test-app [--auto] [--mock] [--platform] [--url <URL>] [--dbg] [--help]
- `--url URL`
Set the WebSocket endpoint to the specified URL.

- `--legacy`
Override default protocol communication to legacy.

- `--rpc-v2`
Override default protocol communication to JSON-RPC compliant.

- `--dbg`
Enable debug logging.

Expand Down
17 changes: 17 additions & 0 deletions test/api_test_app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,17 @@
#include <cstdlib>
#include <future>
#include <ios>
#include <optional>
#include <unistd.h>
#include <vector>

int main(int argc, char** argv)
{
auto& appConfig = GetAppConfig();

Firebolt::LogLevel logLevel = Firebolt::LogLevel::Notice;
std::string url;
std::optional<bool> legacyRPCv1;

for (int i = 1; i < argc; ++i)
{
Expand All @@ -66,6 +69,14 @@ int main(int argc, char** argv)
}
url = argv[++i];
}
else if (std::string(argv[i]) == "--legacy")
{
legacyRPCv1 = true;
}
else if (std::string(argv[i]) == "--rpc-v2")
{
legacyRPCv1 = false;
}
else if (std::string(argv[i]) == "--dbg")
{
logLevel = Firebolt::LogLevel::Debug;
Expand All @@ -81,6 +92,8 @@ int main(int argc, char** argv)
std::cout << " --mock Connect to a local mock server instead of the default Firebolt Demo Service" << std::endl;
std::cout << " --platform Connect to the platform's Firebolt service (default if available)" << std::endl;
std::cout << " --url <URL> Specify a custom URL for the Firebolt service" << std::endl;
std::cout << " --legacy Use legacy communication" << std::endl;
std::cout << " --rpc-v2 Use JSON-RPC compliant communication" << std::endl;
std::cout << " --dbg Enable debug logging" << std::endl;
std::cout << " --help Show this help message" << std::endl;
/* clang-format on */
Expand All @@ -106,6 +119,10 @@ int main(int argc, char** argv)
config.wsUrl = url;
config.waitTime_ms = 1000;
config.log.level = logLevel;
if (legacyRPCv1.has_value())
{
config.legacyRPCv1 = legacyRPCv1.value();
}

std::promise<bool> connectionPromise;
std::once_flag connectionOnce;
Expand Down