X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=service%2Fresource-container%2Fexamples%2FContainerSample.cpp;h=4d1c2df243ff701bd114d23478078b63ffb3cb90;hb=0395af52e09cf8a745e0e8aae4e1fa77af74f36d;hp=2240510255088fccd5d002a34d0e993c6a6c2f51;hpb=b32f68877abda123144238d8aab343cf0a933199;p=platform%2Fupstream%2Fiotivity.git diff --git a/service/resource-container/examples/ContainerSample.cpp b/service/resource-container/examples/ContainerSample.cpp index 2240510..4d1c2df 100644 --- a/service/resource-container/examples/ContainerSample.cpp +++ b/service/resource-container/examples/ContainerSample.cpp @@ -46,7 +46,9 @@ namespace EXIT = 11 } APPMenu; - struct CloseApp {}; + struct CloseApp + { + }; const int MAX_PATH = 2048; @@ -69,7 +71,9 @@ void getCurrentPath(std::string *pPath) char buffer[MAX_PATH]; if (!pPath->empty()) + { pPath->clear(); + } #if defined(__linux__) char *strPath = NULL; @@ -81,7 +85,9 @@ void getCurrentPath(std::string *pPath) strPath = strrchr(buffer, '/'); if (strPath != NULL) + { *strPath = '\0'; + } } #endif pPath->append(buffer); @@ -94,7 +100,9 @@ int processUserInput(int min, int max) std::cin >> input; if (!std::cin.fail() && min <= input && input <= max) + { return input; + } std::cin.clear(); std::cin.ignore(std::numeric_limits::max(), '\n'); @@ -141,7 +149,9 @@ bool checkBundleRegistered(std::string bundleId) for (auto &bundle : bundleList) { if (bundle->getID().compare(bundleId) == 0) + { return true; + } } } @@ -160,7 +170,9 @@ bool checkResourceRegistered(std::string bundleId, std::string resourceUri) for (auto &resource : resourceList) { if (resource.compare(resourceUri) == 0) + { return true; + } } } @@ -174,6 +186,7 @@ void StartContainer(std::string configPath) { g_pResourceContainer->startContainer(configPath); g_bContainerStarted = true; + std::cout << "Container started." << std::endl; } else { @@ -236,7 +249,9 @@ void StopSampleBundle() g_bSampleBundleStarted = false; } else + { std::cout << "Sample Bundle is not started." << std::endl; + } } else { @@ -249,7 +264,9 @@ void RemoveSampleBundle() if (g_pResourceContainer && g_bContainerStarted) { if (checkBundleRegistered(EXAMPLE_BUNDLE_ID)) + { g_pResourceContainer->removeBundle(EXAMPLE_BUNDLE_ID); + } } else { @@ -272,7 +289,9 @@ void AddSampleBundleResource() resourceParams); } else + { std::cout << "Sample Bundle is not started." << std::endl; + } } else { @@ -286,9 +305,13 @@ void RemoveSampleBundleResource() { if (checkResourceRegistered(EXAMPLE_BUNDLE_ID, EXAMPLE_RESOURCE_URI) && g_bSampleBundleStarted) + { g_pResourceContainer->removeResourceConfig(EXAMPLE_BUNDLE_ID, EXAMPLE_RESOURCE_URI); + } else + { std::cout << "Sample Bundle is not started." << std::endl; + } } else { @@ -433,9 +456,11 @@ int main() } if (g_bContainerStarted) + { g_pResourceContainer->stopContainer(); + } g_pResourceContainer = nullptr; return 0; -} \ No newline at end of file +}