Skip to content

Commit

Permalink
feat: add globalSubscribe tests to manage test app
Browse files Browse the repository at this point in the history
  • Loading branch information
ksentak committed Sep 16, 2024
1 parent 002c77d commit 6d92ae4
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/sdks/manage/src/cpp/sdk/cpptest/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
30 changes: 30 additions & 0 deletions src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<int>(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<int>(error));
throw std::runtime_error("UnsubscribeHDMIInputAutoLowLatencyModeCapable failed. " + errorMessage);
}
}
9 changes: 9 additions & 0 deletions src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -183,6 +188,9 @@ class ManageSDKTest {
static void WifiConnect();
static void WifiDisconnect();

static void GlobalSubscribeHdmiAutoLowLatencyModeCapableChanged();
static void GlobalUnsubscribeHdmiAutoLowLatencyModeCapableChanged();

static bool WaitOnConnectionReady();

private:
Expand All @@ -199,6 +207,7 @@ class ManageSDKTest {
static PinChallengeProvider _pinChallengeProvider;
static OnSignInNotification _signInNotification;
static OnSignOutNotification _signOutNotification;
static OnAutoLowLatencyModeCapableChangedNotification _autoLowLatencyModeCapableChangedNotification;

static Firebolt::Wifi::AccessPointList _apList;
};
Expand Down

0 comments on commit 6d92ae4

Please sign in to comment.