diff --git a/src/sdks/core/src/cpp/sdk/cpptest/CoreSDKTest.cpp b/src/sdks/core/src/cpp/sdk/cpptest/CoreSDKTest.cpp index 443618035..946490508 100644 --- a/src/sdks/core/src/cpp/sdk/cpptest/CoreSDKTest.cpp +++ b/src/sdks/core/src/cpp/sdk/cpptest/CoreSDKTest.cpp @@ -22,6 +22,7 @@ using namespace std; bool CoreSDKTest::_connected; +CoreSDKTest::OnPolicyChangedNotification CoreSDKTest::_policyChangedNotification; CoreSDKTest::OnDeviceNameChangedNotification CoreSDKTest::_deviceNameChangedNotification; CoreSDKTest::OnAudioChangedNotification CoreSDKTest::_audioChangedNotification; CoreSDKTest::OnScreenResolutionChangedNotification CoreSDKTest::_screenResolutionChangedNotification; @@ -72,6 +73,124 @@ bool CoreSDKTest::WaitOnConnectionReady() return _connected; } +void CoreSDKTest::GetAccountId() +{ + Firebolt::Error error = Firebolt::Error::None; + const std::string id = Firebolt::IFireboltAccessor::Instance().AccountInterface().id(&error); + if (error == Firebolt::Error::None) { + cout << "Get Account Id = " << id.c_str() << endl; + } else { + cout << "Get Account Id status = " << static_cast(error) << endl; + } +} +void CoreSDKTest::GetAccountUid() +{ + Firebolt::Error error = Firebolt::Error::None; + const std::string uid = Firebolt::IFireboltAccessor::Instance().AccountInterface().uid(&error); + if (error == Firebolt::Error::None) { + cout << "Get Account Uid = " << uid.c_str() << endl; + } else { + cout << "Get Account Uid status = " << static_cast(error) << endl; + } +} + +template +using EnumMap = std::unordered_map; +template +inline const string& ConvertFromEnum(EnumMap enumMap, T type) +{ + return enumMap[type]; +} +template +inline const T ConvertToEnum(EnumMap enumMap, const string& str) +{ + T value; + for (auto element: enumMap) { + if (element.second == str) { + value = element.first; + break; + } + } + return value; +} + +EnumMap skipRestrictionMap = { + { Firebolt::Advertising::SkipRestriction::NONE, "none" }, + { Firebolt::Advertising::SkipRestriction::ADS_UNWATCHED, "adsUnwatched" }, + { Firebolt::Advertising::SkipRestriction::ADS_ALL, "adsAll" }, + { Firebolt::Advertising::SkipRestriction::ALL, "all" }}; + +void PrintAdvertisingPolicy(const Firebolt::Advertising::AdPolicy& policy) +{ + if (policy.skipRestriction.has_value()) { + cout << "\tskipRestriction : " << ConvertFromEnum(skipRestrictionMap, policy.skipRestriction.value()) << endl; + } + if (policy.limitAdTracking.has_value()) { + cout << "\tlimitAdTracking : " << policy.limitAdTracking.value() << endl; + } +} +void CoreSDKTest::GetAdvertisingPolicy() +{ + Firebolt::Error error = Firebolt::Error::None; + const Firebolt::Advertising::AdPolicy policy = Firebolt::IFireboltAccessor::Instance().AdvertisingInterface().policy(&error); + if (error == Firebolt::Error::None) { + cout << "Get Advertising policy --> " << endl; + PrintAdvertisingPolicy(policy); + } else { + cout << "Get Advertising policy status = " << static_cast(error) << endl; + } +} +void CoreSDKTest::OnPolicyChangedNotification::onPolicyChanged( const Firebolt::Advertising::AdPolicy& policy ) +{ + cout << "New policy --> " << endl; + PrintAdvertisingPolicy(policy); +} +void CoreSDKTest::SubscribeAdvertisingPolicyChanged() +{ + Firebolt::Error error = Firebolt::Error::None; + Firebolt::IFireboltAccessor::Instance().AdvertisingInterface().subscribe(_policyChangedNotification, &error); + if (error == Firebolt::Error::None) { + cout << "Subscribe Advertising PolicyChange is success" << endl; + } else { + cout << "Subscribe Advertising PolicyChange status = " << static_cast(error) << endl; + } +} +void CoreSDKTest::UnsubscribeAdvertisingPolicyChanged() +{ + Firebolt::Error error = Firebolt::Error::None; + Firebolt::IFireboltAccessor::Instance().AdvertisingInterface().unsubscribe(_policyChangedNotification, &error); + if (error == Firebolt::Error::None) { + cout << "Unsubscribe Advertising PolicyChange is success" << endl; + } else { + cout << "Unsubscribe Advertising PolicyChange status = " << static_cast(error) << endl; + } +} +void CoreSDKTest::BuildAdvertisingConfiguration() +{ + Firebolt::Error error = Firebolt::Error::None; + Firebolt::Advertising::AdConfigurationOptions options; + options.coppa = true; + options.environment = Firebolt::Advertising::AdConfigurationOptionsEnvironment::TEST; + options.authenticationEntity = "MVPD"; + + Firebolt::Advertising::AdFrameworkConfig adFrameworkConfig = Firebolt::IFireboltAccessor::Instance().AdvertisingInterface().config(options, &error); + if (error == Firebolt::Error::None) { + cout << "Build AdvertisingConfiguration is success, adFrameworkConfig : " << adFrameworkConfig << endl; + } else { + cout << "Build AdvertisingConfiguration status = " << static_cast(error) << endl; + } +} +void CoreSDKTest::GetAdvertisingDeviceAttributes() +{ + Firebolt::Error error = Firebolt::Error::None; + Firebolt::Advertising::DeviceAttributes deviceAttributes = Firebolt::IFireboltAccessor::Instance().AdvertisingInterface().deviceAttributes(&error); + if (error == Firebolt::Error::None) { + cout << "Get Advertising DeviceAttributes is success, deviceAttributes : " << deviceAttributes << endl; + } else { + cout << "Get Advertising DeviceAttributes status = " << static_cast(error) << endl; + } +} + void CoreSDKTest::GetDeviceName() { Firebolt::Error error = Firebolt::Error::None; @@ -142,7 +261,6 @@ void PrintDeviceAudioProfiles( const Firebolt::Device::AudioProfiles& audioProfi cout << "Profile: " << static_cast(item.first) << " status: " << item.second << endl; } } - void CoreSDKTest::GetDeviceAudio() { Firebolt::Error error = Firebolt::Error::None; @@ -153,13 +271,11 @@ void CoreSDKTest::GetDeviceAudio() cout << "Get Device AudioProfiles status = " << static_cast(error) << endl; } } - void CoreSDKTest::OnAudioChangedNotification::onAudioChanged( const Firebolt::Device::AudioProfiles& audioProfiles ) { cout << "onAudioChanged event " << endl; PrintDeviceAudioProfiles(audioProfiles); } - void CoreSDKTest::SubscribeDeviceAudioChanged() { Firebolt::Error error = Firebolt::Error::None; @@ -170,7 +286,6 @@ void CoreSDKTest::SubscribeDeviceAudioChanged() cout << "Subscribe Device Audio Change status = " << static_cast(error) << endl; } } - void CoreSDKTest::UnsubscribeDeviceAudioChanged() { Firebolt::Error error = Firebolt::Error::None; @@ -187,7 +302,6 @@ void PrintDeviceScreenResolution( const Firebolt::Device::Resolution& resolution cout << "Get Device ScreenResolution :-> " << endl; cout << resolution.first << " X " << resolution.second << endl; } - void CoreSDKTest::GetDeviceScreenResolution() { Firebolt::Error error = Firebolt::Error::None; @@ -198,13 +312,11 @@ void CoreSDKTest::GetDeviceScreenResolution() cout << "Get Device ScreenResolution status = " << static_cast(error) << endl; } } - void CoreSDKTest::OnScreenResolutionChangedNotification::onScreenResolutionChanged( const Firebolt::Device::Resolution& resolution ) { cout << "onScreenResolutionChanged event " << endl; PrintDeviceScreenResolution(resolution); } - void CoreSDKTest::SubscribeDeviceScreenResolutionChanged() { Firebolt::Error error = Firebolt::Error::None; @@ -215,7 +327,6 @@ void CoreSDKTest::SubscribeDeviceScreenResolutionChanged() cout << "Subscribe Device ScreenResolution Change status = " << static_cast(error) << endl; } } - void CoreSDKTest::UnsubscribeDeviceScreenResolutionChanged() { Firebolt::Error error = Firebolt::Error::None; @@ -274,7 +385,6 @@ void PrintClosedCaptionsSettings( const Firebolt::Accessibility::ClosedCaptionsS } cout << endl; } - void CoreSDKTest::GetAccessibilityClosedCaptionsSettings() { Firebolt::Error error = Firebolt::Error::None; @@ -285,13 +395,11 @@ void CoreSDKTest::GetAccessibilityClosedCaptionsSettings() cout << "Get Accessibility ClosedCaptionsSettings status = " << static_cast(error) << endl; } } - void CoreSDKTest::OnClosedCaptionsSettingsChangedNotification::onClosedCaptionsSettingsChanged( const Firebolt::Accessibility::ClosedCaptionsSettings& closedCaptionsSettings ) { cout << "ClosedCaptionsSettingsChanged event " << endl; PrintClosedCaptionsSettings(closedCaptionsSettings); } - void CoreSDKTest::SubscribeAccessibilityClosedCaptionsSettingsChanged() { Firebolt::Error error = Firebolt::Error::None; @@ -302,7 +410,6 @@ void CoreSDKTest::SubscribeAccessibilityClosedCaptionsSettingsChanged() cout << "Subscribe Accessibilty ClosedCaptionSettings Change status = " << static_cast(error) << endl; } } - void CoreSDKTest::UnsubscribeAccessibilityClosedCaptionsSettingsChanged() { Firebolt::Error error = Firebolt::Error::None; @@ -328,7 +435,6 @@ void CoreSDKTest::GetLocalizationPreferredAudioLanguages() cout << "Get Localization PreferredAudioLanguages status = " << static_cast(error) << endl; } } - void CoreSDKTest::OnPreferredAudioLanguagesChangedNotification::onPreferredAudioLanguagesChanged( const std::vector& languages) { cout << "PreferredAudioLanguages Changed, new languages --> " << endl; @@ -336,7 +442,6 @@ void CoreSDKTest::OnPreferredAudioLanguagesChangedNotification::onPreferredAudio cout << " -> " << language << endl; } } - void CoreSDKTest::SubscribeLocalizationPreferredAudioLanguagesChanged() { Firebolt::Error error = Firebolt::Error::None; @@ -347,7 +452,6 @@ void CoreSDKTest::SubscribeLocalizationPreferredAudioLanguagesChanged() cout << "Subscribe Localization PreferredAudioLanguagesChange status = " << static_cast(error) << endl; } } - void CoreSDKTest::UnsubscribeLocalizationPreferredAudioLanguagesChanged() { Firebolt::Error error = Firebolt::Error::None; @@ -370,7 +474,6 @@ void CoreSDKTest::InvokeKeyboardStandard() cout << "Error while invoking keyboard.standard method, error = " << static_cast(error) << endl; } } - void CoreSDKTest::InvokeKeyboardPassword() { Firebolt::Error error = Firebolt::Error::None; @@ -383,7 +486,6 @@ void CoreSDKTest::InvokeKeyboardPassword() } } - void CoreSDKTest::InvokeKeyboardEmail() { Firebolt::Error error = Firebolt::Error::None; @@ -397,3 +499,36 @@ void CoreSDKTest::InvokeKeyboardEmail() } } +void CoreSDKTest::VerifyProfileApproveContentRating() +{ + Firebolt::Error error = Firebolt::Error::None; + bool allow = Firebolt::IFireboltAccessor::Instance().ProfileInterface().approveContentRating(&error); + if (error == Firebolt::Error::None) { + cout << "Verify Profile ApproveContentRating is success value : " << allow << endl; + } else { + cout << "Verify Profile ApproveContentRating status : " << static_cast(error) << endl; + } +} +void CoreSDKTest::VerifyProfileApprovePurchase() +{ + Firebolt::Error error = Firebolt::Error::None; + bool allow = Firebolt::IFireboltAccessor::Instance().ProfileInterface().approvePurchase(&error); + if (error == Firebolt::Error::None) { + cout << "Verify Profile ApprovePurchase is success value : " << allow << endl; + } else { + cout << "Verify Profile ApprovePurchase status : " << static_cast(error) << endl; + } +} +void CoreSDKTest::GetProfileFlags() +{ + Firebolt::Error error = Firebolt::Error::None; + Firebolt::Types::FlatMap flatMap = Firebolt::IFireboltAccessor::Instance().ProfileInterface().flags(&error); + if (error == Firebolt::Error::None) { + cout << "Get Profile flags is success value : " << endl; + for (const auto& item : flatMap) { + cout << "\t" << item.first << " : " << item.second << endl; + } + } else { + cout << "Get Profile flags status : " << static_cast(error) << endl; + } +} diff --git a/src/sdks/core/src/cpp/sdk/cpptest/CoreSDKTest.h b/src/sdks/core/src/cpp/sdk/cpptest/CoreSDKTest.h index d5ee900d4..9c0196999 100644 --- a/src/sdks/core/src/cpp/sdk/cpptest/CoreSDKTest.h +++ b/src/sdks/core/src/cpp/sdk/cpptest/CoreSDKTest.h @@ -22,7 +22,10 @@ #include "firebolt.h" class CoreSDKTest { - + class OnPolicyChangedNotification : public Firebolt::Advertising::IAdvertising::IOnPolicyChangedNotification { + public: + void onPolicyChanged( const Firebolt::Advertising::AdPolicy& ) override; + }; class OnDeviceNameChangedNotification : public Firebolt::Device::IDevice::IOnDeviceNameChangedNotification { public: void onDeviceNameChanged( const std::string& ) override; @@ -50,6 +53,8 @@ class CoreSDKTest { static void CreateFireboltInstance(const std::string& url); static void DestroyFireboltInstance(); static void TestCoreStaticSDK(); + static void GetAccountId(); + static void GetAccountUid(); static void GetDeviceName(); static void SubscribeDeviceNameChanged(); static void UnsubscribeDeviceNameChanged(); @@ -68,14 +73,23 @@ class CoreSDKTest { static void GetAccessibilityClosedCaptionsSettings(); static void SubscribeAccessibilityClosedCaptionsSettingsChanged(); static void UnsubscribeAccessibilityClosedCaptionsSettingsChanged(); + static void GetAdvertisingPolicy(); + static void SubscribeAdvertisingPolicyChanged(); + static void UnsubscribeAdvertisingPolicyChanged(); + static void BuildAdvertisingConfiguration(); + static void GetAdvertisingDeviceAttributes(); static void InvokeKeyboardStandard(); static void InvokeKeyboardPassword(); static void InvokeKeyboardEmail(); + static void VerifyProfileApproveContentRating(); + static void VerifyProfileApprovePurchase(); + static void GetProfileFlags(); static bool WaitOnConnectionReady(); private: static void ConnectionChanged(const bool, const Firebolt::Error); static bool _connected; + static OnPolicyChangedNotification _policyChangedNotification; static OnDeviceNameChangedNotification _deviceNameChangedNotification; static OnAudioChangedNotification _audioChangedNotification; static OnScreenResolutionChangedNotification _screenResolutionChangedNotification; diff --git a/src/sdks/core/src/cpp/sdk/cpptest/Main.cpp b/src/sdks/core/src/cpp/sdk/cpptest/Main.cpp index 444bd7fb4..306d90f19 100644 --- a/src/sdks/core/src/cpp/sdk/cpptest/Main.cpp +++ b/src/sdks/core/src/cpp/sdk/cpptest/Main.cpp @@ -4,14 +4,18 @@ void ShowMenu() { printf("Enter\n" + "\tI : Get Account Id\n" + "\tU : Get Account Uid\n" "\tM : Get Device Model\n" "\tS : Get Device Sku\n" + "\tA : Handle Advertising methods\n" "\tN : Get/Subscribe/Unsubscribe Device Name\n" - "\tA : Get/Subscribe/Unsubscribe Device Audio Profiles\n" + "\tP : Get/Subscribe/Unsubscribe Device Audio Profiles\n" "\tR : Get/Subscribe/Unsubscribe Device Screen Resolution\n" "\tL : Get/Subscribe/Unsubscribe Localization Preferred AudioLanguages\n" "\tC : Get/Subscribe/Unsubscribe Closed Caption Settings\n" "\tK : Invoke keyboard methods email/password/standard\n" + "\tV : Handle Profile methods\n" "\tQ : Quit\n\n" ); } @@ -24,20 +28,38 @@ void ShowPropertyMenu(std::string& module, std::string& property) "\tQ : Quit\n", module.c_str(), property.c_str()); } +void ShowProfileMenu() +{ + printf("Options: \n" + "\tC : Verify ApproveContentRating\n" + "\tP : Verify ApprovePurchase\n" + "\tF : Get Flags\n" + "\tQ : Quit\n"); +} + +void ShowAdvertisingMenu() +{ + printf("Options: \n" + "\tP : Get/Subscribe/Unsubscribe Advertising Policy\n" + "\tC : Build configuration object for Ad Framework initialization\n" + "\tD : Get the device advertising device attributes\n" + "\tQ : Quit\n"); +} + void ShowKeyboardMenu() { printf("Enter\n" - "\tE: Invoke Email method\n" - "\tP: Invoke Password method\n" - "\tS: Invoke Standard method\n" + "\tE : Invoke Email method\n" + "\tP : Invoke Password method\n" + "\tS : Invoke Standard method\n" "\tQ : Quit\n"); } void ShowEventMenu() { printf("Enter\n" - "\tS: Subscribe Event\n" - "\tU: Unsubscribe Event\n" + "\tS : Subscribe Event\n" + "\tU : Unsubscribe Event\n" "\tQ : Quit\n"); } @@ -67,6 +89,7 @@ void ShowEventMenu() } while (opt != 'Q'); \ } + #define HandleProperty(Module, Property) \ { \ int opt; \ @@ -92,6 +115,60 @@ void ShowEventMenu() } while (opt != 'Q'); \ } +void HandleProfileMethod() +{ + int opt; + do { + getchar(); + ShowProfileMenu(); + printf("Enter option : "); + opt = toupper(getchar()); + switch (opt) { + case 'C': { + CoreSDKTest::VerifyProfileApproveContentRating(); // Error while testing, need to cross check + break; + } + case 'P': { + CoreSDKTest::VerifyProfileApprovePurchase(); // Error while testing, need to cross check + break; + } + case 'F': { + CoreSDKTest::GetProfileFlags(); + break; + } + default: + break; + } + } while (opt != 'Q'); +} + +void HandleAdvertisingMethod() +{ + int opt; + do { + getchar(); + ShowAdvertisingMenu(); + printf("Enter option : "); + opt = toupper(getchar()); + switch (opt) { + case 'P': { + HandleProperty(Advertising, Policy) + break; + } + case 'C': { + CoreSDKTest::BuildAdvertisingConfiguration(); // Error while testing need to check + break; + } + case 'D': { + CoreSDKTest::GetAdvertisingDeviceAttributes(); // Error while testing need to check + break; + } + default: + break; + } + } while (opt != 'Q'); +} + void HandleKeyboardMethodsInvokation() { int opt; @@ -147,6 +224,18 @@ int main (int argc, char* argv[]) printf("Enter option : "); option = toupper(getchar()); switch (option) { + case 'I' : { + CoreSDKTest::GetAccountId(); // Error while running need to cross check + break; + } + case 'U' : { + CoreSDKTest::GetAccountUid(); // Error while running need to cross check + break; + } + case 'A' : { + HandleAdvertisingMethod(); + break; + } case 'N': { HandleProperty(Device, Name) break; @@ -159,7 +248,7 @@ int main (int argc, char* argv[]) CoreSDKTest::GetDeviceSku(); break; } - case 'A': { + case 'P': { HandleProperty(Device, Audio) break; } @@ -179,6 +268,10 @@ int main (int argc, char* argv[]) HandleKeyboardMethodsInvokation(); break; } + case 'V': { + HandleProfileMethod(); + break; + } default: break; } diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/Main.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/Main.cpp index fbde8a98e..640231d36 100644 --- a/src/sdks/manage/src/cpp/sdk/cpptest/Main.cpp +++ b/src/sdks/manage/src/cpp/sdk/cpptest/Main.cpp @@ -4,24 +4,41 @@ void ShowMenu() { printf("Options ---- >\n" + "\tA : Get/Set Advertising skipRestriction\n" + "\tE : Get/Set/Subscribe/Unsubscribe AudioDescriptions Enabled\n" "\tN : Get/Set/Subscribe/Unsubscribe Device Name\n" "\tB : Get/Set/Subscribe/Unsubscribe ClosedCaption Background Opacity\n" "\tF : Get/Set/Subscribe/Unsubscribe ClosedCaption Font Family\n" "\tL : Get/Set/Subscribe/Unsubscribe Localization Preferred AudioLanguages\n" - "\tD : Register for Keyboard Provider and check sequence\n" - "\tA : Register for Acknowledge Challenge Provider and check sequence\n" + "\tC : Get/Set/Subscribe/Unsubscribe Privacy Allow ACR Collection\n" + "\tS : Get Privacy Settings\n" + "\tI : Subscribe/Unsubscribe SignIn notification\n" + "\tO : Subscribe/Unsubscribe SignOut notification\n" + "\tR : Reset Advertising Identifier\n" + "\tK : Register for Keyboard Provider and check sequence\n" + "\tG : Register for Acknowledge Challenge Provider and check sequence\n" "\tP : Register for Pin Challenge Provider and check sequence\n" - "\tI : Operate on Localization Additional Info\n" + "\tD : Operate on Localization Additional Info\n" "\tU : Grant/Deny/Clear permission on App\n" + "\tW : Scan Wifi on device\n" "\tQ : Quit\n\n" ); } +void ShowWifiOperationsMenu() +{ + printf("Options \n" + "\tS : Scan access points\n" + "\tC : Connect to selected access point \n" + "\tD : Disconnect from access point \n" + "\tQ : Quit\n"); +} + void ShowUserGrantsMenu() { printf("Invoke lifecyclesession management sequence from postman \n" "Once the permission granted/denies/cleared, please use provider + api test to validate it \n" - "Here capabilty used for the testing is hardcoded as device:model\n" + "Here capabilty used for the testing is hardcoded as device:model\n" "\tG : Get Permission\n" "\tR : Grant Permission\n" "\tD : Deny Permission\n" @@ -39,6 +56,14 @@ void ShowAdditionalInfoMenu() } void ShowPropertyMenu(std::string& module, std::string& property) +{ + printf("%s:%s property options \n" + "\tG : Get value\n" + "\tS : Set value\n" + "\tQ : Quit\n", module.c_str(), property.c_str()); +} + +void ShowPropertyWithEventMenu(std::string& module, std::string& property) { printf("%s:%s property options \n" "\tG : Get value\n" @@ -166,6 +191,32 @@ void HandleAdditionalInfo() ManageSDKTest::Set##Module##Property(); \ break; \ } \ + default: \ + break; \ + } \ + } while (opt != 'Q'); \ +} + + +#define HandlePropertyWithEvent(Module, Property) \ +{ \ + int opt; \ + do { \ + getchar(); \ + std::string module = TO_STRING(Module); \ + std::string property = TO_STRING(Property); \ + ShowPropertyWithEventMenu(module, property); \ + printf("Enter option : "); \ + opt = toupper(getchar()); \ + switch (opt) { \ + case 'G': { \ + ManageSDKTest::Get##Module##Property(); \ + break; \ + } \ + case 'S': { \ + ManageSDKTest::Set##Module##Property(); \ + break; \ + } \ case 'R': { \ HandleEventListener(Module, Property##Changed) \ break; \ @@ -200,6 +251,33 @@ void HandleAdditionalInfo() } while (opt != 'Q'); \ } +void HandleWifiOperations() +{ + int opt; + do { + getchar(); + ShowWifiOperationsMenu(); + printf("Enter option : "); + opt = toupper(getchar()); + switch (opt) { + case 'S': { + ManageSDKTest::WifiScan(); + break; + } + case 'C': { + ManageSDKTest::WifiConnect(); + break; + } + case 'D': { + ManageSDKTest::WifiDisconnect(); // Error while testing, return method not found + break; + } + default: + break; + } + } while (opt != 'Q'); +} + #define options ":hu:" int main (int argc, char* argv[]) { @@ -228,20 +306,48 @@ int main (int argc, char* argv[]) printf("Enter option : "); option = toupper(getchar()); switch (option) { + case 'A': { + HandleProperty(Advertising, SkipRestriction) + break; + } + case 'E': { + HandlePropertyWithEvent(AudioDescriptions, Enabled) // Error while testing AudioDescription.audioDescriptionEnabled is not available + break; + } case 'N': { - HandleProperty(Device, Name) + HandlePropertyWithEvent(Device, Name) break; } case 'B': { - HandleProperty(ClosedCaptions, BackgroundOpacity) + HandlePropertyWithEvent(ClosedCaptions, BackgroundOpacity) break; } case 'F': { - HandleProperty(ClosedCaptions, FontFamily) + HandlePropertyWithEvent(ClosedCaptions, FontFamily) break; } case 'L': { - HandleProperty(Localization, PreferredAudioLanguages) + HandlePropertyWithEvent(Localization, PreferredAudioLanguages) + break; + } + case 'C': { + HandlePropertyWithEvent(Privacy, AllowACRCollection) + break; + } + case 'S': { + ManageSDKTest::GetPrivacySettings(); + break; + } + case 'I': { + HandleEventListener(Discovery, SignInNotification) // Testing sequence needs to understand + break; + } + case 'O': { + HandleEventListener(Discovery, SignOutNotification) // Testing sequence needs to understand + break; + } + case 'R': { + ManageSDKTest::ResetAdvertisingIdentifier(); // Testing sequence needs to understand break; } case 'K': { @@ -249,7 +355,7 @@ int main (int argc, char* argv[]) HandleProviderSequence(Keyboard) break; } - case 'A': { + case 'G': { ManageSDKTest::RegisterAcknowledgeChallengeProvider(); HandleProviderSequence(AcknowledgeChallenge) break; @@ -259,7 +365,7 @@ int main (int argc, char* argv[]) HandleProviderSequence(PinChallenge) break; } - case 'I': { + case 'D': { HandleAdditionalInfo(); break; } @@ -267,6 +373,10 @@ int main (int argc, char* argv[]) HandleUserGrants(); break; } + case 'W': { + HandleWifiOperations(); + break; + } default: break; } diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.cpp b/src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.cpp index fed158c43..728a30842 100644 --- a/src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.cpp +++ b/src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.cpp @@ -22,16 +22,18 @@ using namespace std; bool ManageSDKTest::_connected; +ManageSDKTest::OnAudioDescriptionsEnabledChangedNotification ManageSDKTest::_audioDescriptionEnabledChangedNotification; ManageSDKTest::OnDeviceNameChangedNotification ManageSDKTest::_deviceNameChangedNotification; ManageSDKTest::OnFontFamilyChangedNotification ManageSDKTest::_fontFamilyChangedNotification; ManageSDKTest::OnBackgroundOpacityChangedNotification ManageSDKTest::_backgroundOpacityChangedNotification; ManageSDKTest::OnPreferredAudioLanguagesChangedNotification ManageSDKTest::_preferredAudioLanguagesChangedNotification; -#ifdef RPC_ONLY -ManageSDKTest::OnRequestChallengeNotification ManageSDKTest::_requestChallengeNotification; -#endif +ManageSDKTest::OnAllowACRCollectionChangedNotification ManageSDKTest::_allowACRCollectionChangedNotification; +ManageSDKTest::OnSignInNotification ManageSDKTest::_signInNotification; +ManageSDKTest::OnSignOutNotification ManageSDKTest::_signOutNotification; ManageSDKTest::KeyboardProvider ManageSDKTest::_keyboardProvider; ManageSDKTest::AcknowledgeChallengeProvider ManageSDKTest::_acknowledgeChallengeProvider; ManageSDKTest::PinChallengeProvider ManageSDKTest::_pinChallengeProvider; +Firebolt::Wifi::AccessPointList ManageSDKTest::_apList; void ManageSDKTest::ConnectionChanged(const bool connected, const Firebolt::Error error) { @@ -42,7 +44,7 @@ void ManageSDKTest::ConnectionChanged(const bool connected, const Firebolt::Erro void ManageSDKTest::CreateFireboltInstance(const std::string& url) { const std::string config = "{\ - \"waitTime\": 1000,\ + \"waitTime\": 100000,\ \"logLevel\": \"Info\",\ \"workerPool\":{\ \"queueSize\": 8,\ @@ -78,6 +80,119 @@ bool ManageSDKTest::WaitOnConnectionReady() return _connected; } +template +using EnumMap = std::unordered_map; +template +inline const string& ConvertFromEnum(EnumMap enumMap, T type) +{ + return enumMap[type]; +} +template +inline const T ConvertToEnum(EnumMap enumMap, const string& str) +{ + T value; + for (auto element: enumMap) { + if (element.second == str) { + value = element.first; + break; + } + } + return value; +} + +EnumMap skipRestrictionMap = { + { Firebolt::Advertising::SkipRestriction::NONE, "none" }, + { Firebolt::Advertising::SkipRestriction::ADS_UNWATCHED, "adsUnwatched" }, + { Firebolt::Advertising::SkipRestriction::ADS_ALL, "adsAll" }, + { Firebolt::Advertising::SkipRestriction::ALL, "all" }}; +void ManageSDKTest::GetAdvertisingSkipRestriction() +{ + Firebolt::Error error = Firebolt::Error::None; + Firebolt::Advertising::SkipRestriction skipRestriction = Firebolt::IFireboltAccessor::Instance().AdvertisingInterface().skipRestriction(&error); + if (error == Firebolt::Error::None) { + cout << "Get Advertising SkipRestriction is success : " << ConvertFromEnum(skipRestrictionMap, skipRestriction) << endl; + } else { + cout << "Get Advertising SkipRestriction status: " << static_cast(error) << endl; + } +} +void ManageSDKTest::SetAdvertisingSkipRestriction() +{ + Firebolt::Error error = Firebolt::Error::None; + cout << "Support SkipRestriction -> " << endl; + for (auto skipRestriction : skipRestrictionMap) { + cout << skipRestriction.second << endl; + } + std::string skipRestriction; + cout << "Enter new skipRestriction : "; + cin >> skipRestriction; + + Firebolt::IFireboltAccessor::Instance().AdvertisingInterface().setSkipRestriction(ConvertToEnum(skipRestrictionMap, skipRestriction), &error); + if (error == Firebolt::Error::None) { + cout << "Set Advertising SkipRestriction is success " << endl; + } else { + cout << "Set Advertising SkipRestriction status: " << static_cast(error) << endl; + } +} +void ManageSDKTest::ResetAdvertisingIdentifier() +{ + Firebolt::Error error = Firebolt::Error::None; + Firebolt::IFireboltAccessor::Instance().AdvertisingInterface().resetIdentifier(&error); + if (error == Firebolt::Error::None) { + cout << "Set Advertising Reset Identifier is success " << endl; + } else { + cout << "Set Advertising Reset Identifier status: " << static_cast(error) << endl; + } +} + +void ManageSDKTest::GetAudioDescriptionsEnabled() +{ + Firebolt::Error error = Firebolt::Error::None; + bool enabled = Firebolt::IFireboltAccessor::Instance().AudioDescriptionsInterface().enabled(&error); + if (error == Firebolt::Error::None) { + cout << "Get AudioDescriptions Enabled: " << (enabled ? "true" : "false") << endl; + } else { + cout << "Get AudioDescriptions Enabled status: " << static_cast(error) << endl; + } +} +void ManageSDKTest::SetAudioDescriptionsEnabled() +{ + Firebolt::Error error = Firebolt::Error::None; + std::string strEnabled; + cout << "Enter enabled or not (true/false): "; + cin >> strEnabled; + bool enabled = strEnabled == "true" ? true : false; + Firebolt::IFireboltAccessor::Instance().AudioDescriptionsInterface().setEnabled(enabled, &error); + if (error == Firebolt::Error::None) { + cout << "Set AudioDescriptions Enabled: " << endl; + } else { + cout << "Set AudioDescriptions Enabled status: " << static_cast(error) << endl; + } +} +void ManageSDKTest::OnAudioDescriptionsEnabledChangedNotification::onEnabledChanged( const bool enabled ) +{ + cout << "AudioDescriptions Enabled changed, new value --> " << (enabled ? "true" : "false") << endl; +} +void ManageSDKTest::SubscribeAudioDescriptionsEnabledChanged() +{ + Firebolt::Error error = Firebolt::Error::None; + Firebolt::IFireboltAccessor::Instance().AudioDescriptionsInterface().subscribe(_audioDescriptionEnabledChangedNotification, &error); + if (error == Firebolt::Error::None) { + cout << "Subscribe AudioDescriptions EnabledChange is success" << endl; + } else { + cout << "Subscribe AudioDescriptions EnabledChange status = " << static_cast(error) << endl; + } +} +void ManageSDKTest::UnsubscribeAudioDescriptionsEnabledChanged() +{ + Firebolt::Error error = Firebolt::Error::None; + Firebolt::IFireboltAccessor::Instance().AudioDescriptionsInterface().unsubscribe(_audioDescriptionEnabledChangedNotification, &error); + if (error == Firebolt::Error::None) { + cout << "Unsubscribe AudioDescriptions EnabledChange is success" << endl; + } else { + cout << "Unsubscribe AudioDescriptions EnabledChange status = " << static_cast(error) << endl; + } +} + void ManageSDKTest::GetDeviceName() { Firebolt::Error error = Firebolt::Error::None; @@ -89,7 +204,6 @@ void ManageSDKTest::GetDeviceName() cout << "Get Device Name status = " << static_cast(error) << endl; } } - void ManageSDKTest::SetDeviceName() { Firebolt::Error error = Firebolt::Error::None; @@ -106,12 +220,10 @@ void ManageSDKTest::SetDeviceName() } cin.putback('\n'); } - -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; @@ -122,7 +234,6 @@ void ManageSDKTest::SubscribeDeviceNameChanged() cout << "Subscribe Device NameChange status = " << static_cast(error) << endl; } } - void ManageSDKTest::UnsubscribeDeviceNameChanged() { Firebolt::Error error = Firebolt::Error::None; @@ -145,7 +256,6 @@ void ManageSDKTest::GetClosedCaptionsBackgroundOpacity() cout << "Get ClosedCaption BackgroundOpacity status = " << static_cast(error) << endl; } } - void ManageSDKTest::SetClosedCaptionsBackgroundOpacity() { Firebolt::Error error = Firebolt::Error::None; @@ -161,12 +271,10 @@ void ManageSDKTest::SetClosedCaptionsBackgroundOpacity() cout << "Set ClosedCaption BackgroundOpacity status = " << static_cast(error) << endl; } } - void ManageSDKTest::OnBackgroundOpacityChangedNotification::onBackgroundOpacityChanged( const float opacity ) { cout << "BackgroundOpacity changed, new value --> " << opacity << endl; } - void ManageSDKTest::SubscribeClosedCaptionsBackgroundOpacityChanged() { Firebolt::Error error = Firebolt::Error::None; @@ -177,7 +285,6 @@ void ManageSDKTest::SubscribeClosedCaptionsBackgroundOpacityChanged() cout << "Subscribe ClosedCaptions BackgroundOpacityChange status = " << static_cast(error) << endl; } } - void ManageSDKTest::UnsubscribeClosedCaptionsBackgroundOpacityChanged() { Firebolt::Error error = Firebolt::Error::None; @@ -189,45 +296,26 @@ void ManageSDKTest::UnsubscribeClosedCaptionsBackgroundOpacityChanged() } } -using FontFamilyMap = std::unordered_map; -FontFamilyMap fontFamilyMap = { +EnumMap fontFamilyMap = { { Firebolt::Accessibility::FontFamily::MONOSPACED_SERIF, "MonospacedSerif" }, { Firebolt::Accessibility::FontFamily::PROPORTIONAL_SERIF, "ProportionalSerif" }, { Firebolt::Accessibility::FontFamily::MONOSPACED_SANSERIF, "MonospacedSanserif" }, { Firebolt::Accessibility::FontFamily::PROPORTIONAL_SANSERIF, "ProportionalSanserif" }, { Firebolt::Accessibility::FontFamily::SMALLCAPS, "SmallCaps" }, { Firebolt::Accessibility::FontFamily::CURSIVE, "Cursive" }, - { Firebolt::Accessibility::FontFamily::CASUAL, "Casual" }}; -inline const string& ConvertToFontFamilyStr(Firebolt::Accessibility::FontFamily family) -{ - return fontFamilyMap[family]; -} - -inline const Firebolt::Accessibility::FontFamily ConvertFromFontFamilyStr(const string& family) -{ - Firebolt::Accessibility::FontFamily value; - for (auto element: fontFamilyMap) { - if (element.second == family) { - value = element.first; - break; - } - } - return value; -} - + { Firebolt::Accessibility::FontFamily::CASUAL, "Casual" } +}; void ManageSDKTest::GetClosedCaptionsFontFamily() { Firebolt::Error error = Firebolt::Error::None; const Firebolt::Accessibility::FontFamily value = Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().fontFamily(&error); if (error == Firebolt::Error::None) { - cout << "Get ClosedCaption FontFamily value = " << ConvertToFontFamilyStr(value) << endl; + cout << "Get ClosedCaption FontFamily value = " << ConvertFromEnum(fontFamilyMap, value) << endl; } else { cout << "Get ClosedCaption FontFamily status = " << static_cast(error) << endl; } } - - void ManageSDKTest::SetClosedCaptionsFontFamily() { Firebolt::Error error = Firebolt::Error::None; @@ -237,23 +325,19 @@ void ManageSDKTest::SetClosedCaptionsFontFamily() cout << family.second << endl; } cout << "Enter new font family : "; - getchar(); - getline(cin, fontFamily); + cin >> fontFamily; - Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().setFontFamily(ConvertFromFontFamilyStr(fontFamily), &error); + Firebolt::IFireboltAccessor::Instance().ClosedCaptionsInterface().setFontFamily(ConvertToEnum(fontFamilyMap, fontFamily), &error); if (error == Firebolt::Error::None) { cout << "Set ClosedCaption FontFamily is success" << endl; } else { cout << "Set ClosedCaption FontFamily status = " << static_cast(error) << endl; } - cin.putback('\n'); } - void ManageSDKTest::OnFontFamilyChangedNotification::onFontFamilyChanged( const Firebolt::Accessibility::FontFamily& family ) { - cout << "FontFamily changed, new code --> " << ConvertToFontFamilyStr(family) << endl; + cout << "FontFamily changed, new code --> " << ConvertFromEnum(fontFamilyMap, family) << endl; } - void ManageSDKTest::SubscribeClosedCaptionsFontFamilyChanged() { Firebolt::Error error = Firebolt::Error::None; @@ -264,7 +348,6 @@ void ManageSDKTest::SubscribeClosedCaptionsFontFamilyChanged() cout << "Subscribe ClosedCaptions FontFamilyChange status = " << static_cast(error) << endl; } } - void ManageSDKTest::UnsubscribeClosedCaptionsFontFamilyChanged() { Firebolt::Error error = Firebolt::Error::None; @@ -290,7 +373,6 @@ void ManageSDKTest::GetLocalizationPreferredAudioLanguages() cout << "Get Localization PreferredAudioLanguages status = " << static_cast(error) << endl; } } - void ManageSDKTest::SetLocalizationPreferredAudioLanguages() { Firebolt::Error error = Firebolt::Error::None; @@ -321,7 +403,6 @@ void ManageSDKTest::SetLocalizationPreferredAudioLanguages() } cin.putback('\n'); } - void ManageSDKTest::OnPreferredAudioLanguagesChangedNotification::onPreferredAudioLanguagesChanged( const std::vector& languages) { cout << "PreferredAudioLanguages Changed, new languages --> " << endl; @@ -329,7 +410,6 @@ void ManageSDKTest::OnPreferredAudioLanguagesChangedNotification::onPreferredAud cout << " -> " << language << endl; } } - void ManageSDKTest::SubscribeLocalizationPreferredAudioLanguagesChanged() { Firebolt::Error error = Firebolt::Error::None; @@ -340,7 +420,6 @@ void ManageSDKTest::SubscribeLocalizationPreferredAudioLanguagesChanged() cout << "Subscribe Localization PreferredAudioLanguagesChange status = " << static_cast(error) << endl; } } - void ManageSDKTest::UnsubscribeLocalizationPreferredAudioLanguagesChanged() { Firebolt::Error error = Firebolt::Error::None; @@ -352,48 +431,130 @@ void ManageSDKTest::UnsubscribeLocalizationPreferredAudioLanguagesChanged() } } -#ifdef RPC_ONLY -using PinSpaceMap = std::unordered_map; -PinSpaceMap pinSpaceMap = { - { Firebolt::PinChallenge::PinChallengePinSpace::PURCHASE, "Purchase" }, - { Firebolt::PinChallenge::PinChallengePinSpace::CONTENT, "Content" }}; -inline const string& ConvertToPinSpaceStr(Firebolt::PinChallenge::PinChallengePinSpace pinSpace) +void ManageSDKTest::GetPrivacyAllowACRCollection() { - return pinSpaceMap[pinSpace]; + Firebolt::Error error = Firebolt::Error::None; + bool allowACRCollection = Firebolt::IFireboltAccessor::Instance().PrivacyInterface().allowACRCollection(&error); + + if (error == Firebolt::Error::None) { + cout << "Get Privacy AllowACRCollection : " << (allowACRCollection ? "true" : "false") << endl; + } else { + cout << "Get Privacy AllowACRCollection status = " << static_cast(error) << endl; + } } +void ManageSDKTest::SetPrivacyAllowACRCollection() +{ + Firebolt::Error error = Firebolt::Error::None; + std::string strAllowACRCollection; + cout << "Enter new allowACRCollection (true/false): "; + cin >> strAllowACRCollection; + bool allowACRCollection = strAllowACRCollection == "true" ? true : false; + Firebolt::IFireboltAccessor::Instance().PrivacyInterface().setAllowACRCollection(allowACRCollection , &error); -void ManageSDKTest::OnRequestChallengeNotification::onRequestChallenge( const Firebolt::PinChallenge::PinChallengeProviderRequest& pinChallenge ) + if (error == Firebolt::Error::None) { + cout << "Set Privacy AllowACRCollection is success" << endl; + } else { + cout << "Get Privacy AllowACRCollection status = " << static_cast(error) << endl; + } +} +void ManageSDKTest::OnAllowACRCollectionChangedNotification::onAllowACRCollectionChanged( const bool allowACRCollection ) +{ + cout << "AllowACRCollection Changed, new value of allowACRCollection : " << (allowACRCollection ? "true" : "false") << endl; +} +void ManageSDKTest::SubscribePrivacyAllowACRCollectionChanged() +{ + Firebolt::Error error = Firebolt::Error::None; + Firebolt::IFireboltAccessor::Instance().PrivacyInterface().subscribe(_allowACRCollectionChangedNotification, &error); + if (error == Firebolt::Error::None) { + cout << "Subscribe Privacy AllowACRCollectionChanged is success" << endl; + } else { + cout << "Subscribe Privacy AllowACRCollectionChanged status = " << static_cast(error) << endl; + } +} +void ManageSDKTest::UnsubscribePrivacyAllowACRCollectionChanged() +{ + Firebolt::Error error = Firebolt::Error::None; + Firebolt::IFireboltAccessor::Instance().PrivacyInterface().unsubscribe(_allowACRCollectionChangedNotification, &error); + if (error == Firebolt::Error::None) { + cout << "Unsubscribe Privacy AllowACRCollectionChanged is success" << endl; + } else { + cout << "Unsubscribe Privacy AllowACRCollectionChanged status = " << static_cast(error) << endl; + } +} +void ManageSDKTest::GetPrivacySettings() { - cout << "RequestChallenge, new challenge --> " << endl; - cout << "CorrelationId : " << pinChallenge.correlationId << endl; - cout << "PinChallenge.ChallengeRequestor.Id : " << pinChallenge.parameters.requestor.id << endl; - cout << "PinChallenge.ChallengeRequestor.Name : " << pinChallenge.parameters.requestor.name << endl; - cout << "PinChallenge.PinChallengePinSpace : " << ConvertToPinSpaceStr(pinChallenge.parameters.pinSpace) << endl; - cout << "PinChallenge.Capability : " << *(pinChallenge.parameters.capability) << endl; + Firebolt::Error error = Firebolt::Error::None; + Firebolt::Privacy::PrivacySettings privacySettings = Firebolt::IFireboltAccessor::Instance().PrivacyInterface().settings(&error); + + if (error == Firebolt::Error::None) { + cout << "Get Privacy Settings -> " << endl; + cout << "\tallowACRCollection : " << privacySettings.allowACRCollection << endl; + cout << "\tallowResumePoints : " << privacySettings.allowResumePoints << endl; + cout << "\tallowAppContentAdTargeting : " << privacySettings.allowAppContentAdTargeting << endl; + cout << "\tallowCameraAnalytics : " << privacySettings.allowCameraAnalytics << endl; + cout << "\tallowPersonalization : " << privacySettings.allowPersonalization << endl; + cout << "\tallowPrimaryBrowseAdTargeting : " << privacySettings.allowPrimaryBrowseAdTargeting << endl; + cout << "\tallowPrimaryContentAdTargeting : " << privacySettings.allowPrimaryContentAdTargeting << endl; + cout << "\tallowProductAnalytics : " << privacySettings.allowProductAnalytics << endl; + cout << "\tallowRemoteDiagnostics : " << privacySettings.allowRemoteDiagnostics << endl; + cout << "\tallowUnentitledPersonalization : " << privacySettings.allowUnentitledPersonalization << endl; + cout << "\tallowUnentitledResumePoints : " << privacySettings.allowUnentitledResumePoints << endl; + cout << "\tallowWatchHistory : " << privacySettings.allowWatchHistory << endl; + } else { + cout << "Get Privacy Settings status = " << static_cast(error) << endl; + } + } -void ManageSDKTest::SubscribePinChallengeRequestChallenge() +void ManageSDKTest::OnSignInNotification::onSignIn( const Firebolt::Discovery::Event& event ) +{ + cout << "Discovery SignIn Event for appId --> " << event.appId << endl; +} +void ManageSDKTest::SubscribeDiscoverySignInNotification() +{ + Firebolt::Error error = Firebolt::Error::None; + Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().subscribe(_signInNotification, &error); + if (error == Firebolt::Error::None) { + cout << "Subscribe Discovery SignIn Notification is success" << endl; + } else { + cout << "Subscribe Discovery SignIn Notification status = " << static_cast(error) << endl; + } +} +void ManageSDKTest::UnsubscribeDiscoverySignInNotification() { Firebolt::Error error = Firebolt::Error::None; - Firebolt::IFireboltAccessor::Instance().PinChallengeInterface().subscribe(_requestChallengeNotification, &error); + Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().unsubscribe(_signInNotification, &error); if (error == Firebolt::Error::None) { - cout << "Subscribe PinChallenge RequestChallenge is success" << endl; + cout << "Unsubscribe Discovery SignIn Notification is success" << endl; } else { - cout << "Subscribe PinChallenge RequestChallenge status = " << static_cast(error) << endl; + cout << "Unsubscribe Discovery SignIn Notification status = " << static_cast(error) << endl; } } -void ManageSDKTest::UnsubscribePinChallengeRequestChallenge() +void ManageSDKTest::OnSignOutNotification::onSignOut( const Firebolt::Discovery::Event& event ) +{ + cout << "Discovery SignOut Event for appId --> " << event.appId << endl; +} +void ManageSDKTest::SubscribeDiscoverySignOutNotification() +{ + Firebolt::Error error = Firebolt::Error::None; + Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().subscribe(_signOutNotification, &error); + if (error == Firebolt::Error::None) { + cout << "Subscribe Discovery SignOut Notification is success" << endl; + } else { + cout << "Subscribe Discovery SignOut Notification status = " << static_cast(error) << endl; + } +} +void ManageSDKTest::UnsubscribeDiscoverySignOutNotification() { Firebolt::Error error = Firebolt::Error::None; - Firebolt::IFireboltAccessor::Instance().PinChallengeInterface().unsubscribe(_requestChallengeNotification, &error); + Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().unsubscribe(_signOutNotification, &error); if (error == Firebolt::Error::None) { - cout << "Unsubscribe PinChallenge RequestChallenge is success" << endl; + cout << "Unsubscribe Discovery SignOut Notification is success" << endl; } else { - cout << "Unsubscribe PinChallenge RequestChallenge status = " << static_cast(error) << endl; + cout << "Unsubscribe Discovery SignOut Notification status = " << static_cast(error) << endl; } } -#endif ManageSDKTest::KeyboardProvider::KeyboardProvider() : _session(nullptr) @@ -401,7 +562,6 @@ ManageSDKTest::KeyboardProvider::KeyboardProvider() , _keyInput(false) { } - void ManageSDKTest::KeyboardProvider::SendMessage(bool response) { if (_keyInput) { @@ -432,42 +592,35 @@ void ManageSDKTest::KeyboardProvider::SendMessage(bool response) cout << " there is no active keyboard input session " << endl; } } - void ManageSDKTest::KeyboardProvider::standard(const Firebolt::Keyboard::KeyboardParameters& parameters, std::unique_ptr session) { cout << "KeyboardProvider Standard is invoked" << endl; startKeyboardSession(parameters, std::move(session)); } - void ManageSDKTest::KeyboardProvider::password(const Firebolt::Keyboard::KeyboardParameters& parameters, std::unique_ptr session) { cout << "KeyboardProvider Password is invoked" << endl; startKeyboardSession(parameters, std::move(session)); } - void ManageSDKTest::KeyboardProvider::email(const Firebolt::Keyboard::KeyboardParameters& parameters, std::unique_ptr session) { cout << "KeyboardProvider Email is invoked" << endl; startKeyboardSession(parameters, std::move(session)); } - void ManageSDKTest::KeyboardProvider::startKeyboardSession( const Firebolt::Keyboard::KeyboardParameters& parameters, std::unique_ptr session ) { _session = std::move(session); _parameters = parameters; _keyInput = true; } - void ManageSDKTest::RegisterKeyboardProvider() { Firebolt::IFireboltAccessor::Instance().KeyboardInterface().provide(_keyboardProvider); } - void ManageSDKTest::SendResponseMessageToKeyboardProvider() { _keyboardProvider.SendMessage(true); } - void ManageSDKTest::SendErrorMessageToKeyboardProvider() { _keyboardProvider.SendMessage(false); @@ -479,7 +632,6 @@ ManageSDKTest::AcknowledgeChallengeProvider::AcknowledgeChallengeProvider() , _challengeInput(false) { } - void ManageSDKTest::AcknowledgeChallengeProvider::SendMessage(bool response) { if (_challengeInput) { @@ -510,30 +662,25 @@ void ManageSDKTest::AcknowledgeChallengeProvider::SendMessage(bool response) cout << " there is no active acknowledge challenge input session " << endl; } } - void ManageSDKTest::AcknowledgeChallengeProvider::challenge(const Firebolt::AcknowledgeChallenge::Challenge& parameters, std::unique_ptr session) { cout << "AcknowledgeChallengeProvider challenge is invoked" << endl; startAcknowledgeChallengeSession(parameters, std::move(session)); } - void ManageSDKTest::AcknowledgeChallengeProvider::startAcknowledgeChallengeSession( const Firebolt::AcknowledgeChallenge::Challenge& parameters, std::unique_ptr session ) { _session = std::move(session); _parameters = parameters; _challengeInput = true; } - void ManageSDKTest::RegisterAcknowledgeChallengeProvider() { Firebolt::IFireboltAccessor::Instance().AcknowledgeChallengeInterface().provide(_acknowledgeChallengeProvider); } - void ManageSDKTest::SendResponseMessageToAcknowledgeChallengeProvider() { _acknowledgeChallengeProvider.SendMessage(true); } - void ManageSDKTest::SendErrorMessageToAcknowledgeChallengeProvider() { _acknowledgeChallengeProvider.SendMessage(false); @@ -545,7 +692,6 @@ ManageSDKTest::PinChallengeProvider::PinChallengeProvider() , _challengeInput(false) { } - void ManageSDKTest::PinChallengeProvider::SendMessage(bool response) { if (_challengeInput) { @@ -581,30 +727,25 @@ void ManageSDKTest::PinChallengeProvider::SendMessage(bool response) cout << " there is no active pin challenge input session " << endl; } } - void ManageSDKTest::PinChallengeProvider::challenge(const Firebolt::PinChallenge::PinChallenge& parameters, std::unique_ptr session) { cout << "PinChallengeProvider challenge is invoked" << endl; startPinChallengeSession(parameters, std::move(session)); } - void ManageSDKTest::PinChallengeProvider::startPinChallengeSession( const Firebolt::PinChallenge::PinChallenge& parameters, std::unique_ptr session ) { _session = std::move(session); _parameters = parameters; _challengeInput = true; } - void ManageSDKTest::RegisterPinChallengeProvider() { Firebolt::IFireboltAccessor::Instance().PinChallengeInterface().provide(_pinChallengeProvider); } - void ManageSDKTest::SendResponseMessageToPinChallengeProvider() { _pinChallengeProvider.SendMessage(true); } - void ManageSDKTest::SendErrorMessageToPinChallengeProvider() { _pinChallengeProvider.SendMessage(false); @@ -623,7 +764,6 @@ void ManageSDKTest::GetLocalizationAdditionalInfo() cout << "AdditionalInfo call status = " << static_cast(error) << endl; } } - void ManageSDKTest::AddLocalizationAdditionalInfo() { Firebolt::Error error = Firebolt::Error::None; @@ -644,7 +784,6 @@ void ManageSDKTest::AddLocalizationAdditionalInfo() cin.putback('\n'); } - void ManageSDKTest::RemoveLocalizationAdditionalInfo() { Firebolt::Error error = Firebolt::Error::None; @@ -661,7 +800,6 @@ void ManageSDKTest::RemoveLocalizationAdditionalInfo() } cin.putback('\n'); - } void ManageSDKTest::GetUserGrantsPermission() @@ -690,7 +828,6 @@ void ManageSDKTest::GetUserGrantsPermission() cin.putback('\n'); } - void ManageSDKTest::GrantUserGrantsPermission() { Firebolt::Error error = Firebolt::Error::None; @@ -710,7 +847,6 @@ void ManageSDKTest::GrantUserGrantsPermission() cin.putback('\n'); } - void ManageSDKTest::DenyUserGrantsPermission() { Firebolt::Error error = Firebolt::Error::None; @@ -730,7 +866,6 @@ void ManageSDKTest::DenyUserGrantsPermission() cin.putback('\n'); } - void ManageSDKTest::ClearUserGrantsPermission() { Firebolt::Error error = Firebolt::Error::None; @@ -751,3 +886,83 @@ void ManageSDKTest::ClearUserGrantsPermission() cin.putback('\n'); } +void PrintAP(const Firebolt::Wifi::AccessPoint ap) +{ + if (ap.ssid.has_value()) { + cout << " SSID : " << ap.ssid.value() << endl; + } + if (ap.securityMode.has_value()) { + cout << " SecurityMode : " << static_cast(ap.securityMode.value()) << endl; + } + if (ap.signalStrength.has_value()) { + cout << " SignalStrength : " << ap.signalStrength.value() << endl; + } + if (ap.frequency.has_value()) { + cout << " Frequency : " << ap.frequency.value() << endl; + } +} +void PrintAPList(const Firebolt::Wifi::AccessPointList& apList) +{ + if (apList.list.has_value()) { + cout<< "list ---->" << endl; + uint32_t index = 0; + for (const auto ap : apList.list.value()) { + cout << index << ". " << endl; + PrintAP(ap); + cout << endl; + index++; + } + } else { + cout << "empty list " << endl; + } +} +void ManageSDKTest::WifiScan() +{ + Firebolt::Error error = Firebolt::Error::None; + int32_t timeout = -1; + _apList = Firebolt::IFireboltAccessor::Instance().WifiInterface().scan(timeout, &error); + if (error == Firebolt::Error::None) { + cout << "Wifi Scan is success, "; + PrintAPList(_apList); + } else { + cout << "Wifi Scan status = " << static_cast(error) << endl; + } +} +void ManageSDKTest::WifiConnect() +{ + Firebolt::Error error = Firebolt::Error::None; + if (_apList.list.has_value()) { + cout << "Scanned access pointlist : " << endl; + PrintAPList(_apList); + cout << "Select access point from the list: enter index : "; + int32_t index; + cin >> index; + Firebolt::Wifi::AccessPoint ap = _apList.list.value()[index]; + std::string passphrase; + cout << "Enter passphrase to connect "; + cin >> passphrase; + + string ssid = ap.ssid.has_value() ? ap.ssid.value() : ""; + printf("%s:%s:%d _apList.list.value()[index] = %s\n", __FILE__, __func__, __LINE__, ssid.c_str()); + Firebolt::Wifi::WifiSecurityMode securityMode = ap.securityMode.has_value() ? ap.securityMode.value() : Firebolt::Wifi::WifiSecurityMode::NONE; + Firebolt::Wifi::AccessPoint connectedAP = Firebolt::IFireboltAccessor::Instance().WifiInterface().connect(ssid, passphrase, securityMode , &error); + if (error == Firebolt::Error::None) { + cout << "Wifi Connect is success, "; + PrintAP(connectedAP); + } else { + cout << "Wifi Connect status = " << static_cast(error) << endl; + } + } else { + cout << "Empty AP list, please initiate scan before trying connect " << endl; + } +} +void ManageSDKTest::WifiDisconnect() +{ + Firebolt::Error error = Firebolt::Error::None; + Firebolt::IFireboltAccessor::Instance().WifiInterface().disconnect(&error); + if (error == Firebolt::Error::None) { + cout << "Wifi Disconnect is success, "; + } else { + cout << "Wifi Disconnect status = " << static_cast(error) << endl; + } +} diff --git a/src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.h b/src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.h index 3d3752eda..1fc29c6e5 100644 --- a/src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.h +++ b/src/sdks/manage/src/cpp/sdk/cpptest/ManageSDKTest.h @@ -22,6 +22,10 @@ #include "firebolt.h" class ManageSDKTest { + class OnAudioDescriptionsEnabledChangedNotification : public Firebolt::AudioDescriptions::IAudioDescriptions::IOnEnabledChangedNotification { + public: + void onEnabledChanged( const bool ) override; + }; class OnDeviceNameChangedNotification : public Firebolt::Device::IDevice::IOnDeviceNameChangedNotification { public: @@ -41,12 +45,21 @@ class ManageSDKTest { void onPreferredAudioLanguagesChanged( const std::vector& ) override; }; -#ifdef RPC_ONLY - class OnRequestChallengeNotification : public Firebolt::PinChallenge::IPinChallenge::IOnRequestChallengeNotification { + class OnAllowACRCollectionChangedNotification : public Firebolt::Privacy::IPrivacy::IOnAllowACRCollectionChangedNotification { + public: + void onAllowACRCollectionChanged( const bool ) override; + }; + + class OnSignInNotification : public Firebolt::Discovery::IDiscovery::IOnSignInNotification { public: - void onRequestChallenge( const Firebolt::PinChallenge::PinChallengeProviderRequest& ) override; + void onSignIn( const Firebolt::Discovery::Event& ) override; }; -#endif + + class OnSignOutNotification : public Firebolt::Discovery::IDiscovery::IOnSignOutNotification { + public: + void onSignOut( const Firebolt::Discovery::Event& ) override; + }; + class KeyboardProvider : public Firebolt::Keyboard::IKeyboardProvider { public: KeyboardProvider(); @@ -102,26 +115,47 @@ class ManageSDKTest { static void CreateFireboltInstance(const std::string& url); static void DestroyFireboltInstance(); static void TestManageStaticSDK(); + + static void GetAdvertisingSkipRestriction(); + static void SetAdvertisingSkipRestriction(); + static void ResetAdvertisingIdentifier(); + + static void GetAudioDescriptionsEnabled(); + static void SetAudioDescriptionsEnabled(); + static void SubscribeAudioDescriptionsEnabledChanged(); + static void UnsubscribeAudioDescriptionsEnabledChanged(); + static void GetDeviceName(); static void SetDeviceName(); static void SubscribeDeviceNameChanged(); static void UnsubscribeDeviceNameChanged(); + static void GetClosedCaptionsBackgroundOpacity(); static void SetClosedCaptionsBackgroundOpacity(); static void SubscribeClosedCaptionsBackgroundOpacityChanged(); static void UnsubscribeClosedCaptionsBackgroundOpacityChanged(); + static void GetClosedCaptionsFontFamily(); static void SetClosedCaptionsFontFamily(); static void SubscribeClosedCaptionsFontFamilyChanged(); static void UnsubscribeClosedCaptionsFontFamilyChanged(); + static void GetLocalizationPreferredAudioLanguages(); static void SetLocalizationPreferredAudioLanguages(); static void SubscribeLocalizationPreferredAudioLanguagesChanged(); static void UnsubscribeLocalizationPreferredAudioLanguagesChanged(); -#ifdef RPC_ONLY - static void SubscribePinChallengeRequestChallenge(); - static void UnsubscribePinChallengeRequestChallenge(); -#endif + + static void GetPrivacyAllowACRCollection(); + static void SetPrivacyAllowACRCollection(); + static void SubscribePrivacyAllowACRCollectionChanged(); + static void UnsubscribePrivacyAllowACRCollectionChanged(); + static void GetPrivacySettings(); + + static void SubscribeDiscoverySignInNotification(); + static void UnsubscribeDiscoverySignInNotification(); + static void SubscribeDiscoverySignOutNotification(); + static void UnsubscribeDiscoverySignOutNotification(); + static void RegisterKeyboardProvider(); static void SendResponseMessageToKeyboardProvider(); static void SendErrorMessageToKeyboardProvider(); @@ -129,6 +163,7 @@ class ManageSDKTest { static void RegisterAcknowledgeChallengeProvider(); static void SendResponseMessageToAcknowledgeChallengeProvider(); static void SendErrorMessageToAcknowledgeChallengeProvider(); + static void RegisterPinChallengeProvider(); static void SendResponseMessageToPinChallengeProvider(); static void SendErrorMessageToPinChallengeProvider(); @@ -142,20 +177,27 @@ class ManageSDKTest { static void DenyUserGrantsPermission(); static void ClearUserGrantsPermission(); + static void WifiScan(); + static void WifiConnect(); + static void WifiDisconnect(); + static bool WaitOnConnectionReady(); private: static void ConnectionChanged(const bool, const Firebolt::Error); static bool _connected; + static OnAudioDescriptionsEnabledChangedNotification _audioDescriptionEnabledChangedNotification; static OnDeviceNameChangedNotification _deviceNameChangedNotification; static OnFontFamilyChangedNotification _fontFamilyChangedNotification; static OnBackgroundOpacityChangedNotification _backgroundOpacityChangedNotification; static OnPreferredAudioLanguagesChangedNotification _preferredAudioLanguagesChangedNotification; -#ifdef RPC_ONLY - static OnRequestChallengeNotification _requestChallengeNotification; -#endif + static OnAllowACRCollectionChangedNotification _allowACRCollectionChangedNotification; static KeyboardProvider _keyboardProvider; static AcknowledgeChallengeProvider _acknowledgeChallengeProvider; static PinChallengeProvider _pinChallengeProvider; + static OnSignInNotification _signInNotification; + static OnSignOutNotification _signOutNotification; + + static Firebolt::Wifi::AccessPointList _apList; };