Skip to content

Commit

Permalink
Core/Manage: update in test app
Browse files Browse the repository at this point in the history
  • Loading branch information
HaseenaSainul committed Dec 1, 2023
1 parent a6e7427 commit 6e00ace
Show file tree
Hide file tree
Showing 6 changed files with 234 additions and 84 deletions.
2 changes: 1 addition & 1 deletion src/sdks/core/src/cpp/sdk/cpptest/CoreSDKTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ void CoreSDKTest::GetDeviceModel()
}
}

void CoreSDKTest::GetDeviceSKU()
void CoreSDKTest::GetDeviceSku()
{
Firebolt::Error error = Firebolt::Error::None;
const std::string sku = Firebolt::IFireboltAccessor::Instance().DeviceInterface().sku(&error);
Expand Down
2 changes: 1 addition & 1 deletion src/sdks/core/src/cpp/sdk/cpptest/CoreSDKTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class CoreSDKTest {
static void SubscribeDeviceNameChanged();
static void UnsubscribeDeviceNameChanged();
static void GetDeviceModel();
static void GetDeviceSKU();
static void GetDeviceSku();
static void GetDeviceAudio();
static void SubscribeDeviceAudioChanged();
static void UnsubscribeDeviceAudioChanged();
Expand Down
142 changes: 76 additions & 66 deletions src/sdks/core/src/cpp/sdk/cpptest/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,26 @@
void ShowMenu()
{
printf("Enter\n"
"\tD : Get Device Name\n"
"\tN : Subscribe/Unsubscribe for Device Name Change\n"
"\tA : Get Device Audio Profiles\n"
"\tS : Subscribe/Unsubscribe for Device Audio Profiles Change\n"
"\tR : Get Device Screen Resolution\n"
"\tU : Subscribe/Unsubscribe for Device Screen Resolution\n"
"\tL : Get Localization Preferred AudioLanguages\n"
"\tP : Subscribe/Unsubscribe for Localization Preferred AudioLanguages Change\n"
"\tC : Get Closed Caption Settings\n"
"\tB : Subscribe/Unsubscribe for Closed Caption Settings\n"
"\tK : Invoke keyboard methods email/password/standard\n"
"\tM : Get Device Model\n"
"\tE : Get Device sku\n"
"\tS : Get Device Sku\n"
"\tN : Get/Subscribe/Unsubscribe Device Name\n"
"\tA : 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"
"\tQ : Quit\n\n"
);
}

void ShowPropertyMenu(std::string& module, std::string& property)
{
printf("%s:%s property options \n"
"\tG : Get value\n"
"\tR : Show subscribe/unscribe event menu\n"
"\tQ : Quit\n", module.c_str(), property.c_str());
}

void ShowKeyboardMenu()
{
printf("Enter\n"
Expand All @@ -38,6 +41,57 @@ void ShowEventMenu()
"\tQ : Quit\n");
}

#define VALUE(string) #string
#define TO_STRING(string) VALUE(string)

#define HandleEventListener(Module, eventFuncName) \
{ \
int opt; \
do { \
getchar(); \
ShowEventMenu(); \
printf("Enter option : "); \
opt = toupper(getchar()); \
switch (opt) { \
case 'S': { \
CoreSDKTest::Subscribe##Module##eventFuncName(); \
break; \
} \
case 'U': { \
CoreSDKTest::Unsubscribe##Module##eventFuncName(); \
break; \
} \
default: \
break; \
} \
} while (opt != 'Q'); \
}

#define HandleProperty(Module, Property) \
{ \
int opt; \
do { \
getchar(); \
std::string module = TO_STRING(Module); \
std::string property = TO_STRING(Property); \
ShowPropertyMenu(module, property); \
printf("Enter option : "); \
opt = toupper(getchar()); \
switch (opt) { \
case 'G': { \
CoreSDKTest::Get##Module##Property(); \
break; \
} \
case 'R': { \
HandleEventListener(Module, Property##Changed) \
break; \
} \
default: \
break; \
} \
} while (opt != 'Q'); \
}

void HandleKeyboardMethodsInvokation()
{
int opt;
Expand Down Expand Up @@ -65,29 +119,6 @@ void HandleKeyboardMethodsInvokation()
} while (opt != 'Q');
}

#define HandleEventListener(Module, eventFuncName) \
{ \
int opt; \
do { \
getchar(); \
ShowEventMenu(); \
printf("Enter option : "); \
opt = toupper(getchar()); \
switch (opt) { \
case 'S': { \
CoreSDKTest::Subscribe##Module##eventFuncName(); \
break; \
} \
case 'U': { \
CoreSDKTest::Unsubscribe##Module##eventFuncName(); \
break; \
} \
default: \
break; \
} \
} while (opt != 'Q'); \
}

#define options ":hu:"
int main (int argc, char* argv[])
{
Expand Down Expand Up @@ -116,59 +147,38 @@ int main (int argc, char* argv[])
printf("Enter option : ");
option = toupper(getchar());
switch (option) {
case 'D': {
CoreSDKTest::GetDeviceName();
break;
}
case 'N': {
HandleEventListener(Device, NameChanged)
HandleProperty(Device, Name)
break;
}
case 'A': {
CoreSDKTest::GetDeviceAudio();
case 'M': {
CoreSDKTest::GetDeviceModel();
break;
}
case 'S': {
HandleEventListener(Device, AudioChanged)
CoreSDKTest::GetDeviceSku();
break;
}
case 'R': {
CoreSDKTest::GetDeviceScreenResolution();
case 'A': {
HandleProperty(Device, Audio)
break;
}
case 'U': {
HandleEventListener(Device, ScreenResolutionChanged)
case 'R': {
HandleProperty(Device, ScreenResolution)
break;
}
case 'L': {
CoreSDKTest::GetLocalizationPreferredAudioLanguages();
break;
}
case 'P': {
HandleEventListener(Localization, PreferredAudioLanguagesChanged)
HandleProperty(Localization, PreferredAudioLanguages)
break;
}
case 'C': {
CoreSDKTest::GetAccessibilityClosedCaptionsSettings();
break;
}
case 'B': {
HandleEventListener(Accessibility, ClosedCaptionsSettingsChanged)
HandleProperty(Accessibility, ClosedCaptionsSettings)
break;
}
case 'K': {
HandleKeyboardMethodsInvokation();
break;
}
case 'M': {
CoreSDKTest::GetDeviceModel();
break;
}
case 'E': {
CoreSDKTest::GetDeviceSKU();
break;
}

default:
break;
}
Expand Down
70 changes: 59 additions & 11 deletions src/sdks/manage/src/cpp/sdk/cpptest/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,44 +12,88 @@ void ShowMenu()
"\tA : 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"
"\tU : Grant/Deny/Clear permission on App\n"
"\tQ : Quit\n\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"
"\tG : Get Permission\n"
"\tR : Grant Permission\n"
"\tD : Deny Permission\n"
"\tC : Clear Permission\n"
"\tQ : Quit\n");
}

void ShowAdditionalInfoMenu()
{
printf("Options \n"
"\tG: Get Additional Info\n"
"\tA: Add Additional Info\n"
"\tR: Remove Additional Info\n"
"\tG : Get Additional Info\n"
"\tA : Add Additional Info\n"
"\tR : Remove Additional Info\n"
"\tQ : Quit\n");
}

void ShowPropertyMenu(std::string& module, std::string& property)
{
printf("%s:%s property options \n"
"\tG: Get value\n"
"\tS: Set value\n"
"\tR: Show subscribe/unscribe event menu\n"
"\tG : Get value\n"
"\tS : Set value\n"
"\tR : Show subscribe/unscribe event menu\n"
"\tQ : Quit\n", module.c_str(), property.c_str());
}

void ShowProviderMenu(std::string& module)
{
printf("Invoke %s onRequest sequence from other entity and press\n"
"\tR: To Send Response\n"
"\tE: To Send Error\n"
printf("Invoke lifecyclesession management from postman and api sequence from other entity for %s and press\n"
"\tR : To Send Response\n"
"\tE : To Send Error\n"
"\tQ : Quit\n", module.c_str());
}

void ShowEventMenu()
{
printf("Options \n"
"\tS: Subscribe Event\n"
"\tU: Unsubscribe Event\n"
"\tS : Subscribe Event\n"
"\tU : Unsubscribe Event\n"
"\tQ : Quit\n");
}

void HandleUserGrants()
{
int opt;
do {
getchar();
ShowUserGrantsMenu();
printf("Enter option : ");
opt = toupper(getchar());
switch (opt) {
case 'G': {
ManageSDKTest::GetUserGrantsPermission();
break;
}
case 'R': {
ManageSDKTest::GrantUserGrantsPermission();
break;
}
case 'D': {
ManageSDKTest::DenyUserGrantsPermission();
break;
}
case 'C': {
ManageSDKTest::ClearUserGrantsPermission();
break;
}
default:
break;
}
} while (opt != 'Q');
}

void HandleAdditionalInfo()
{
int opt;
Expand Down Expand Up @@ -219,6 +263,10 @@ int main (int argc, char* argv[])
HandleAdditionalInfo();
break;
}
case 'U': {
HandleUserGrants();
break;
}
default:
break;
}
Expand Down
Loading

0 comments on commit 6e00ace

Please sign in to comment.