Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add global subscribe & HDMI tests to manage test app #320

Merged
merged 5 commits into from
Sep 19, 2024
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
9 changes: 9 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,15 @@ void RunAllTests() {
runTest(ManageSDKTest::SendResponseMessageToPinChallengeProvider, "SendResponseMessageToPinChallengeProvider");
runTest(ManageSDKTest::SendErrorMessageToPinChallengeProvider, "SendErrorMessageToPinChallengeProvider");

runTest(ManageSDKTest::GlobalSubscribeHdmiAutoLowLatencyModeCapableChanged, "GlobalSubscribeHdmiAutoLowLatencyModeCapableChanged");
runTest(ManageSDKTest::GlobalUnsubscribeHdmiAutoLowLatencyModeCapableChanged, "GlobalUnsubscribeHdmiAutoLowLatencyModeCapableChanged");

runTest(ManageSDKTest::GetAutoLowLatencyModeCapable, "GetAutoLowLatencyModeCapable");
runTest(ManageSDKTest::SetAutoLowLatencyModeCapable, "SetAutoLowLatencyModeCapable");
runTest(ManageSDKTest::GetEdidVersion, "GetEdidVersion");
runTest(ManageSDKTest::SetEdidVersion, "SetEdidVersion");
runTest(ManageSDKTest::GetHdmiPortInfo, "GetHdmiPortInfo");

if (allTestsPassed) {
cout << "============================" << endl;
cout << "ALL MANAGE SDK TESTS SUCCEEDED!" << endl;
Expand Down
102 changes: 102 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,104 @@ 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 << "Global Subscribe for HDMIInput AutoLowLatencyModeCapable is a 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 << "Global Unsubscribe for HDMIInput AutoLowLatencyModeCapable is a success." << endl;
} else {
std::string errorMessage = "Error: " + std::to_string(static_cast<int>(error));
throw std::runtime_error("UnsubscribeHDMIInputAutoLowLatencyModeCapable failed." + errorMessage);
}
}

void ManageSDKTest::GetAutoLowLatencyModeCapable()
{
Firebolt::Error error = Firebolt::Error::None;
std::string port = "HDMI1";
bool result = Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().autoLowLatencyModeCapable(port, &error);

if (error == Firebolt::Error::None) {
cout << "GetAutoLowLatencyModeCapable is a success." << endl;
} else {
std::string errorMessage = "Error: " + std::to_string(static_cast<int>(error));
throw std::runtime_error("GetAutoLowLatencyModeCapable failed. " + errorMessage);
}
}

void ManageSDKTest::SetAutoLowLatencyModeCapable()
{
Firebolt::Error error = Firebolt::Error::None;
std::string port = "HDMI1";
bool value = false;
Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().setAutoLowLatencyModeCapable(port, value, &error);

if (error == Firebolt::Error::None) {
cout << "SetAutoLowLatencyModeCapable is a success." << endl;
} else {
std::string errorMessage = "Error: " + std::to_string(static_cast<int>(error));
throw std::runtime_error("SetAutoLowLatencyModeCapable failed. " + errorMessage);
}
}

void ManageSDKTest::GetEdidVersion()
{
Firebolt::Error error = Firebolt::Error::None;
std::string port = "HDMI1";
Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().edidVersion(port, &error);

if (error == Firebolt::Error::None) {
cout << "GetEdidVersion is a success." << endl;
} else {
std::string errorMessage = "Error: " + std::to_string(static_cast<int>(error));
throw std::runtime_error("GetEdidVersion failed. " + errorMessage);
}
}

void ManageSDKTest::SetEdidVersion()
{
Firebolt::Error error = Firebolt::Error::None;
std::string port = "HDMI1";
Firebolt::HDMIInput::EDIDVersion value = Firebolt::HDMIInput::EDIDVersion::V1_4;
Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().setEdidVersion(port, value, &error);

if (error == Firebolt::Error::None) {
cout << "SetEdidVersion is a success." << endl;
} else {
std::string errorMessage = "Error: " + std::to_string(static_cast<int>(error));
throw std::runtime_error("SetEdidVersionfailed. " + errorMessage);
}
}

void ManageSDKTest::GetHdmiPortInfo()
{
Firebolt::Error error = Firebolt::Error::None;
std::string portId = "HDMI1";
Firebolt::IFireboltAccessor::Instance().HDMIInputInterface().port(portId, &error);

if (error == Firebolt::Error::None) {
cout << "GetHdmiPortInfo is a success." << endl;
} else {
std::string errorMessage = "Error: " + std::to_string(static_cast<int>(error));
throw std::runtime_error("GetHdmiPortInfo failed. " + errorMessage);
}
}
15 changes: 15 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,15 @@ class ManageSDKTest {
static void WifiConnect();
static void WifiDisconnect();

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

static void GetAutoLowLatencyModeCapable();
static void SetAutoLowLatencyModeCapable();
static void GetEdidVersion();
static void SetEdidVersion();
static void GetHdmiPortInfo();

static bool WaitOnConnectionReady();

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

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