From 6d92ae4ec27b529873fd5de240e4144713eb5e36 Mon Sep 17 00:00:00 2001 From: Keaton Sentak Date: Mon, 16 Sep 2024 11:00:12 -0400 Subject: [PATCH] feat: add globalSubscribe tests to manage test app --- src/sdks/manage/src/cpp/sdk/cpptest/Main.cpp | 3 ++ .../src/cpp/sdk/cpptest/ManageSDKTest.cpp | 30 +++++++++++++++++++ .../src/cpp/sdk/cpptest/ManageSDKTest.h | 9 ++++++ 3 files changed, 42 insertions(+) diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/Main.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/Main.cpp index 4d2698dbe..978211dcf 100644 --- a/src/sdks/manage/src/cpp/sdk/cpptest/Main.cpp +++ b/src/sdks/manage/src/cpp/sdk/cpptest/Main.cpp @@ -121,6 +121,9 @@ void RunAllTests() { runTest(ManageSDKTest::SendResponseMessageToPinChallengeProvider, "SendResponseMessageToPinChallengeProvider"); runTest(ManageSDKTest::SendErrorMessageToPinChallengeProvider, "SendErrorMessageToPinChallengeProvider"); + runTest(ManageSDKTest::GlobalSubscribeHdmiAutoLowLatencyModeCapableChanged, "GlobalSubscribeHdmiAutoLowLatencyModeCapableChanged"); + runTest(ManageSDKTest::GlobalUnsubscribeHdmiAutoLowLatencyModeCapableChanged, "GlobalUnsubscribeHdmiAutoLowLatencyModeCapableChanged"); + if (allTestsPassed) { cout << "============================" << endl; cout << "ALL MANAGE SDK TESTS SUCCEEDED!" << endl; diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.cpp index 6dde2c9c2..594dc9a19 100644 --- a/src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.cpp +++ b/src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.cpp @@ -31,6 +31,7 @@ ManageSDKTest::OnPreferredAudioLanguagesChangedNotification ManageSDKTest::_pref ManageSDKTest::OnAllowACRCollectionChangedNotification ManageSDKTest::_allowACRCollectionChangedNotification; ManageSDKTest::OnSignInNotification ManageSDKTest::_signInNotification; ManageSDKTest::OnSignOutNotification ManageSDKTest::_signOutNotification; +ManageSDKTest::OnAutoLowLatencyModeCapableChangedNotification ManageSDKTest::_autoLowLatencyModeCapableChangedNotification; ManageSDKTest::KeyboardProvider ManageSDKTest::_keyboardProvider; ManageSDKTest::AcknowledgeChallengeProvider ManageSDKTest::_acknowledgeChallengeProvider; ManageSDKTest::PinChallengeProvider ManageSDKTest::_pinChallengeProvider; @@ -1012,3 +1013,32 @@ void ManageSDKTest::WifiDisconnect() throw std::runtime_error("WifiDisconnect failed. " + errorMessage); } } + +void ManageSDKTest::OnAutoLowLatencyModeCapableChangedNotification::onAutoLowLatencyModeCapableChanged( const Firebolt::HDMIInput::AutoLowLatencyModeCapableChangedInfo& info) +{ + cout << "Low latency capable changed" << endl; +} + +void ManageSDKTest::GlobalSubscribeHdmiAutoLowLatencyModeCapableChanged() +{ + Firebolt::Error error = Firebolt::Error::None; + Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().globalSubscribe(_autoLowLatencyModeCapableChangedNotification, &error); + if (error == Firebolt::Error::None) { + cout << "Subscribe HDMIInput AutoLowLatencyModeCapable is success" << endl; + } else { + std::string errorMessage = "Error: " + std::to_string(static_cast(error)); + throw std::runtime_error("SubscribeHDMIInputAutoLowLatencyModeCapable failed. " + errorMessage); + } +} + +void ManageSDKTest::GlobalUnsubscribeHdmiAutoLowLatencyModeCapableChanged() +{ + Firebolt::Error error = Firebolt::Error::None; + Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().globalUnsubscribe(_autoLowLatencyModeCapableChangedNotification, &error); + if (error == Firebolt::Error::None) { + cout << "Unsubscribe HDMIInput AutoLowLatencyModeCapable is success" << endl; + } else { + std::string errorMessage = "Error: " + std::to_string(static_cast(error)); + throw std::runtime_error("UnsubscribeHDMIInputAutoLowLatencyModeCapable failed. " + errorMessage); + } +} diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.h b/src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.h index 2f8be7145..7266e019a 100644 --- a/src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.h +++ b/src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.h @@ -108,6 +108,11 @@ class ManageSDKTest { bool _challengeInput; }; + class OnAutoLowLatencyModeCapableChangedNotification : public Firebolt::HDMIInput::IHDMIInput::IOnAutoLowLatencyModeCapableChangedNotification { + public: + void onAutoLowLatencyModeCapableChanged( const Firebolt::HDMIInput::AutoLowLatencyModeCapableChangedInfo& ) override; + }; + public: ManageSDKTest() = default; virtual ~ManageSDKTest() = default; @@ -183,6 +188,9 @@ class ManageSDKTest { static void WifiConnect(); static void WifiDisconnect(); + static void GlobalSubscribeHdmiAutoLowLatencyModeCapableChanged(); + static void GlobalUnsubscribeHdmiAutoLowLatencyModeCapableChanged(); + static bool WaitOnConnectionReady(); private: @@ -199,6 +207,7 @@ class ManageSDKTest { static PinChallengeProvider _pinChallengeProvider; static OnSignInNotification _signInNotification; static OnSignOutNotification _signOutNotification; + static OnAutoLowLatencyModeCapableChangedNotification _autoLowLatencyModeCapableChangedNotification; static Firebolt::Wifi::AccessPointList _apList; };