From: Jihun Ha Date: Wed, 25 Mar 2015 12:04:51 +0000 (+0900) Subject: Update a way of user interaction in con-server application X-Git-Tag: 1.2.0+RC1~1878 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9a046dda10771f057e72d5df74a34d5795925436;p=platform%2Fupstream%2Fiotivity.git Update a way of user interaction in con-server application If an user hits a "enter" key, the application will give a menu to the user, again. Reference: [IOT-335] Change-Id: Ie32b6f705b76e7ab455f3208d08f8c8be14dc685 Signed-off-by: Jihun Ha Reviewed-on: https://gerrit.iotivity.org/gerrit/571 Tested-by: jenkins-iotivity Reviewed-by: Uze Choi --- diff --git a/service/things-manager/sampleapp/linux/configuration/con-client.cpp b/service/things-manager/sampleapp/linux/configuration/con-client.cpp index 5e84817..5099ae1 100755 --- a/service/things-manager/sampleapp/linux/configuration/con-client.cpp +++ b/service/things-manager/sampleapp/linux/configuration/con-client.cpp @@ -262,6 +262,7 @@ void onFoundCandidateResource(std::vector< std::shared_ptr< OCResource > > resou int main(int argc, char* argv[]) { + std::string str_steps; //************************************************************** // STEP 0 @@ -290,8 +291,21 @@ int main(int argc, char* argv[]) cout << "(6) Reboot (for the group)" << std::endl; cout << "(10) Show Configuration Units" << std::endl; - cin >> g_Steps; - // + try + { + std::getline (std::cin, str_steps); + + if(str_steps == "") + continue; + else + g_Steps = std::stoi(str_steps); + } + catch(std::invalid_argument&) + { + std::cout << "Please put a digit, not string" << std::endl; + continue; + } + if (g_Steps == 0) break; else if (g_Steps == 1)