Skip to content

Commit

Permalink
CPPSDK: test updates based on interface name changes + disable rpc-on…
Browse files Browse the repository at this point in the history
…ly based methods/events
  • Loading branch information
HaseenaSainul committed Nov 6, 2023
1 parent ae1cd80 commit 67afaf0
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 31 deletions.
5 changes: 4 additions & 1 deletion src/sdks/manage/src/cpp/sdk/cpptest/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ void ShowMenu()
"\tL : Get Localization Preferred AudioLanguages\n"
"\tA : Set Localization Preferred AudioLanguages\n"
"\tR : Subscribe/Unsubscribe for Localization Preferred AudioLanguages Change\n"
#ifdef RPC_ONLY
"\tP : Subscribe/Unsubscribe for PinChallenge RequestChallenge\n"
#endif
"\tQ : Quit\n\n"
);
}
Expand Down Expand Up @@ -123,11 +125,12 @@ int main (int argc, char* argv[])
HandleEventListener(Localization, PreferredAudioLanguagesChanged)
break;
}
#ifdef RPC_ONLY
case 'P': {
HandleEventListener(PinChallenge, RequestChallenge)
break;
}

#endif
default:
break;
}
Expand Down
51 changes: 27 additions & 24 deletions src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ ManageSDKTest::OnDeviceNameChangedNotification ManageSDKTest::_deviceNameChanged
ManageSDKTest::OnFontFamilyChangedNotification ManageSDKTest::_fontFamilyChangedNotification;
ManageSDKTest::OnBackgroundOpacityChangedNotification ManageSDKTest::_backgroundOpacityChangedNotification;
ManageSDKTest::OnPreferredAudioLanguagesChangedNotification ManageSDKTest::_preferredAudioLanguagesChangedNotification;
#ifdef RPC_ONLY
ManageSDKTest::OnRequestChallengeNotification ManageSDKTest::_requestChallengeNotification;
#endif

void ManageSDKTest::ConnectionChanged(const bool connected, const Firebolt::Error error)
{
Expand Down Expand Up @@ -76,7 +78,7 @@ bool ManageSDKTest::WaitOnConnectionReady()
void ManageSDKTest::GetDeviceName()
{
Firebolt::Error error = Firebolt::Error::None;
const std::string name = Firebolt::IFireboltAccessor::Instance().DeviceInterface().Name(&error);
const std::string name = Firebolt::IFireboltAccessor::Instance().DeviceInterface().name(&error);

if (error == Firebolt::Error::None) {
cout << "Get Device Name = " << name.c_str() << endl;
Expand All @@ -88,7 +90,7 @@ void ManageSDKTest::GetDeviceName()
void ManageSDKTest::SetDeviceName()
{
Firebolt::Error error = Firebolt::Error::None;
Firebolt::IFireboltAccessor::Instance().DeviceInterface().SetName("Hello", &error);
Firebolt::IFireboltAccessor::Instance().DeviceInterface().setName("Hello", &error);

if (error == Firebolt::Error::None) {
cout << "Set Device Name is success" << endl;
Expand All @@ -97,15 +99,15 @@ void ManageSDKTest::SetDeviceName()
}
}

void ManageSDKTest::OnDeviceNameChangedNotification::OnDeviceNameChanged( const std::string& name)
void ManageSDKTest::OnDeviceNameChangedNotification::onDeviceNameChanged( const std::string& name )
{
cout << "Name changed, new name --> " << name << endl;
}

void ManageSDKTest::SubscribeDeviceNameChanged()
{
Firebolt::Error error = Firebolt::Error::None;
Firebolt::IFireboltAccessor::Instance().DeviceInterface().Subscribe(_deviceNameChangedNotification, &error);
Firebolt::IFireboltAccessor::Instance().DeviceInterface().subscribe(_deviceNameChangedNotification, &error);
if (error == Firebolt::Error::None) {
cout << "Subscribe Device NameChange is success" << endl;
} else {
Expand All @@ -116,7 +118,7 @@ void ManageSDKTest::SubscribeDeviceNameChanged()
void ManageSDKTest::UnsubscribeDeviceNameChanged()
{
Firebolt::Error error = Firebolt::Error::None;
Firebolt::IFireboltAccessor::Instance().DeviceInterface().Unsubscribe(_deviceNameChangedNotification, &error);
Firebolt::IFireboltAccessor::Instance().DeviceInterface().unsubscribe(_deviceNameChangedNotification, &error);
if (error == Firebolt::Error::None) {
cout << "Unsubscribe Device NameChange is success" << endl;
} else {
Expand All @@ -127,7 +129,7 @@ void ManageSDKTest::UnsubscribeDeviceNameChanged()
void ManageSDKTest::GetClosedCaptionBackgroundOpacity()
{
Firebolt::Error error = Firebolt::Error::None;
const float value = Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().BackgroundOpacity(&error);
const float value = Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().backgroundOpacity(&error);

if (error == Firebolt::Error::None) {
cout << "Get ClosedCaption BackgroundOpacity = " << value << endl;
Expand All @@ -139,7 +141,7 @@ void ManageSDKTest::GetClosedCaptionBackgroundOpacity()
void ManageSDKTest::SetClosedCaptionBackgroundOpacity()
{
Firebolt::Error error = Firebolt::Error::None;
Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().SetBackgroundOpacity(2.0, &error);
Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().setBackgroundOpacity(2.0, &error);

if (error == Firebolt::Error::None) {
cout << "Set ClosedCaption BackgroundOpacity is success" << endl;
Expand All @@ -148,15 +150,15 @@ void ManageSDKTest::SetClosedCaptionBackgroundOpacity()
}
}

void ManageSDKTest::OnBackgroundOpacityChangedNotification::OnBackgroundOpacityChanged( const float opacity )
void ManageSDKTest::OnBackgroundOpacityChangedNotification::onBackgroundOpacityChanged( const float opacity )
{
cout << "BackgroundOpacity changed, new value --> " << opacity << endl;
}

void ManageSDKTest::SubscribeClosedCaptionsBackgroundOpacityChanged()
{
Firebolt::Error error = Firebolt::Error::None;
Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().Subscribe(_backgroundOpacityChangedNotification, &error);
Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(_backgroundOpacityChangedNotification, &error);
if (error == Firebolt::Error::None) {
cout << "Subscribe ClosedCaptions BackgroundOpacityChange is success" << endl;
} else {
Expand All @@ -167,7 +169,7 @@ void ManageSDKTest::SubscribeClosedCaptionsBackgroundOpacityChanged()
void ManageSDKTest::UnsubscribeClosedCaptionsBackgroundOpacityChanged()
{
Firebolt::Error error = Firebolt::Error::None;
Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().Unsubscribe(_backgroundOpacityChangedNotification, &error);
Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(_backgroundOpacityChangedNotification, &error);
if (error == Firebolt::Error::None) {
cout << "Unsubscribe ClosedCaptions BackgroundOpacityChange is success" << endl;
} else {
Expand All @@ -192,7 +194,7 @@ inline const string& ConvertToFontFamilyStr(Firebolt::Accessibility::FontFamily
void ManageSDKTest::GetClosedCaptionFontFamily()
{
Firebolt::Error error = Firebolt::Error::None;
const Firebolt::Accessibility::FontFamily value = Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().FontFamily(&error);
const Firebolt::Accessibility::FontFamily value = Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().fontFamily(&error);

if (error == Firebolt::Error::None) {
cout << "Get ClosedCaption FontFamily value = " << ConvertToFontFamilyStr(value) << endl;
Expand All @@ -204,7 +206,7 @@ void ManageSDKTest::GetClosedCaptionFontFamily()
void ManageSDKTest::SetClosedCaptionFontFamily()
{
Firebolt::Error error = Firebolt::Error::None;
Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().SetFontFamily(Firebolt::Accessibility::FontFamily::PROPORTIONAL_SANSERIF, &error);
Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().setFontFamily(Firebolt::Accessibility::FontFamily::PROPORTIONAL_SANSERIF, &error);

if (error == Firebolt::Error::None) {
cout << "Set ClosedCaption FontFamily is success" << endl;
Expand All @@ -213,15 +215,15 @@ void ManageSDKTest::SetClosedCaptionFontFamily()
}
}

void ManageSDKTest::OnFontFamilyChangedNotification::OnFontFamilyChanged( const Firebolt::Accessibility::FontFamily& family )
void ManageSDKTest::OnFontFamilyChangedNotification::onFontFamilyChanged( const Firebolt::Accessibility::FontFamily& family )
{
cout << "FontFamily changed, new code --> " << ConvertToFontFamilyStr(family) << endl;
}

void ManageSDKTest::SubscribeClosedCaptionsFontFamilyChanged()
{
Firebolt::Error error = Firebolt::Error::None;
Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().Subscribe(_fontFamilyChangedNotification, &error);
Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().subscribe(_fontFamilyChangedNotification, &error);
if (error == Firebolt::Error::None) {
cout << "Subscribe ClosedCaptions FontFamilyChange is success" << endl;
} else {
Expand All @@ -232,7 +234,7 @@ void ManageSDKTest::SubscribeClosedCaptionsFontFamilyChanged()
void ManageSDKTest::UnsubscribeClosedCaptionsFontFamilyChanged()
{
Firebolt::Error error = Firebolt::Error::None;
Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().Unsubscribe(_fontFamilyChangedNotification, &error);
Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().unsubscribe(_fontFamilyChangedNotification, &error);
if (error == Firebolt::Error::None) {
cout << "Unsubscribe ClosedCaptions FontFamilyChange is success" << endl;
} else {
Expand All @@ -243,7 +245,7 @@ void ManageSDKTest::UnsubscribeClosedCaptionsFontFamilyChanged()
void ManageSDKTest::GetLocalizationPreferredAudioLanguages()
{
Firebolt::Error error = Firebolt::Error::None;
const std::vector<std::string> languages = Firebolt::IFireboltAccessor::Instance().LocalizationInterface().PreferredAudioLanguages(&error);
const std::vector<std::string> languages = Firebolt::IFireboltAccessor::Instance().LocalizationInterface().preferredAudioLanguages(&error);

if (error == Firebolt::Error::None) {
cout << "Get Localization PreferredAudioLanguages : " << endl;
Expand All @@ -259,7 +261,7 @@ void ManageSDKTest::SetLocalizationPreferredAudioLanguages()
{
Firebolt::Error error = Firebolt::Error::None;
const std::vector<std::string> languages = { "ara", "jpn", "hin" };
Firebolt::IFireboltAccessor::Instance().LocalizationInterface().SetPreferredAudioLanguages(languages, &error);
Firebolt::IFireboltAccessor::Instance().LocalizationInterface().setPreferredAudioLanguages(languages, &error);

if (error == Firebolt::Error::None) {
cout << "Set Localization PreferredAudioLanguages is success" << endl;
Expand All @@ -268,7 +270,7 @@ void ManageSDKTest::SetLocalizationPreferredAudioLanguages()
}
}

void ManageSDKTest::OnPreferredAudioLanguagesChangedNotification::OnPreferredAudioLanguagesChanged( const std::vector<std::string>& languages)
void ManageSDKTest::OnPreferredAudioLanguagesChangedNotification::onPreferredAudioLanguagesChanged( const std::vector<std::string>& languages )
{
cout << "PreferredAudioLanguages Changed, new languages --> " << endl;
for (auto language : languages) {
Expand All @@ -279,7 +281,7 @@ void ManageSDKTest::OnPreferredAudioLanguagesChangedNotification::OnPreferredAud
void ManageSDKTest::SubscribeLocalizationPreferredAudioLanguagesChanged()
{
Firebolt::Error error = Firebolt::Error::None;
Firebolt::IFireboltAccessor::Instance().LocalizationInterface().Subscribe(_preferredAudioLanguagesChangedNotification, &error);
Firebolt::IFireboltAccessor::Instance().LocalizationInterface().subscribe(_preferredAudioLanguagesChangedNotification, &error);
if (error == Firebolt::Error::None) {
cout << "Subscribe Localization PreferredAudioLanguagesChange is success" << endl;
} else {
Expand All @@ -290,14 +292,15 @@ void ManageSDKTest::SubscribeLocalizationPreferredAudioLanguagesChanged()
void ManageSDKTest::UnsubscribeLocalizationPreferredAudioLanguagesChanged()
{
Firebolt::Error error = Firebolt::Error::None;
Firebolt::IFireboltAccessor::Instance().LocalizationInterface().Unsubscribe(_preferredAudioLanguagesChangedNotification, &error);
Firebolt::IFireboltAccessor::Instance().LocalizationInterface().unsubscribe(_preferredAudioLanguagesChangedNotification, &error);
if (error == Firebolt::Error::None) {
cout << "Unsubscribe Localization PreferredAudioLanguagesChange is success" << endl;
} else {
cout << "Unsubscribe Localization PreferredAudioLanguagesChange status = " << static_cast<int>(error) << endl;
}
}

#ifdef RPC_ONLY
using PinSpaceMap = std::unordered_map<Firebolt::PinChallenge::PinChallengePinSpace, string>;
PinSpaceMap pinSpaceMap = {
{ Firebolt::PinChallenge::PinChallengePinSpace::PURCHASE, "Purchase" },
Expand All @@ -307,8 +310,7 @@ inline const string& ConvertToPinSpaceStr(Firebolt::PinChallenge::PinChallengePi
return pinSpaceMap[pinSpace];
}


void ManageSDKTest::OnRequestChallengeNotification::OnRequestChallenge( const Firebolt::PinChallenge::PinChallengeProviderRequest& pinChallenge )
void ManageSDKTest::OnRequestChallengeNotification::onRequestChallenge( const Firebolt::PinChallenge::PinChallengeProviderRequest& pinChallenge )
{
cout << "RequestChallenge, new challenge --> " << endl;
cout << "CorrelationId : " << pinChallenge.correlationId << endl;
Expand All @@ -321,7 +323,7 @@ void ManageSDKTest::OnRequestChallengeNotification::OnRequestChallenge( const Fi
void ManageSDKTest::SubscribePinChallengeRequestChallenge()
{
Firebolt::Error error = Firebolt::Error::None;
Firebolt::IFireboltAccessor::Instance().PinChallengeInterface().Subscribe(_requestChallengeNotification, &error);
Firebolt::IFireboltAccessor::Instance().PinChallengeInterface().subscribe(_requestChallengeNotification, &error);
if (error == Firebolt::Error::None) {
cout << "Subscribe PinChallenge RequestChallenge is success" << endl;
} else {
Expand All @@ -332,10 +334,11 @@ void ManageSDKTest::SubscribePinChallengeRequestChallenge()
void ManageSDKTest::UnsubscribePinChallengeRequestChallenge()
{
Firebolt::Error error = Firebolt::Error::None;
Firebolt::IFireboltAccessor::Instance().PinChallengeInterface().Unsubscribe(_requestChallengeNotification, &error);
Firebolt::IFireboltAccessor::Instance().PinChallengeInterface().unsubscribe(_requestChallengeNotification, &error);
if (error == Firebolt::Error::None) {
cout << "Unsubscribe PinChallenge RequestChallenge is success" << endl;
} else {
cout << "Unsubscribe PinChallenge RequestChallenge status = " << static_cast<int>(error) << endl;
}
}
#endif
17 changes: 11 additions & 6 deletions src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,28 @@ class ManageSDKTest {

class OnDeviceNameChangedNotification : public Firebolt::Device::IDevice::IOnDeviceNameChangedNotification {
public:
void OnDeviceNameChanged( const std::string& ) override;
void onDeviceNameChanged( const std::string& ) override;
};

class OnFontFamilyChangedNotification : public Firebolt::ClosedCaptions::IClosedCaptions::IOnFontFamilyChangedNotification {
void OnFontFamilyChanged( const Firebolt::Accessibility::FontFamily& ) override;
void onFontFamilyChanged( const Firebolt::Accessibility::FontFamily& ) override;
};

class OnBackgroundOpacityChangedNotification : public Firebolt::ClosedCaptions::IClosedCaptions::IOnBackgroundOpacityChangedNotification {
void OnBackgroundOpacityChanged( const float ) override;
void onBackgroundOpacityChanged( const float ) override;
};

class OnPreferredAudioLanguagesChangedNotification : public Firebolt::Localization::ILocalization::IOnPreferredAudioLanguagesChangedNotification {
public:
void OnPreferredAudioLanguagesChanged( const std::vector<std::string>& ) override;
void onPreferredAudioLanguagesChanged( const std::vector<std::string>& ) override;
};

#ifdef RPC_ONLY
struct OnRequestChallengeNotification : public Firebolt::PinChallenge::IPinChallenge::IOnRequestChallengeNotification {
public:
void OnRequestChallenge( const Firebolt::PinChallenge::PinChallengeProviderRequest& ) override;
void onRequestChallenge( const Firebolt::PinChallenge::PinChallengeProviderRequest& ) override;
};
#endif
public:
ManageSDKTest() = default;
virtual ~ManageSDKTest() = default;
Expand All @@ -68,9 +70,10 @@ class ManageSDKTest {
static void SetLocalizationPreferredAudioLanguages();
static void SubscribeLocalizationPreferredAudioLanguagesChanged();
static void UnsubscribeLocalizationPreferredAudioLanguagesChanged();
#ifdef RPC_ONLY
static void SubscribePinChallengeRequestChallenge();
static void UnsubscribePinChallengeRequestChallenge();

#endif
static bool WaitOnConnectionReady();

private:
Expand All @@ -80,6 +83,8 @@ class ManageSDKTest {
static OnFontFamilyChangedNotification _fontFamilyChangedNotification;
static OnBackgroundOpacityChangedNotification _backgroundOpacityChangedNotification;
static OnPreferredAudioLanguagesChangedNotification _preferredAudioLanguagesChangedNotification;
#ifdef RPC_ONLY
static OnRequestChallengeNotification _requestChallengeNotification;
#endif
};

0 comments on commit 67afaf0

Please sign in to comment.