From b177af05a401933dabc3719dab3c5084224a88da Mon Sep 17 00:00:00 2001 From: "jihwan.seo" Date: Mon, 25 Jul 2016 20:30:34 +0900 Subject: [PATCH] Modified eCode checker in callback method related PUT/POST of SampleApps. as OC_STACK_RESOURCE_CHANGED result is added, sample application which use callback related put/post will include checker about OC_STACK_RESOURCE_CHANGED result. Change-Id: Ifa958fa30f943c93dfce76029d30be6744355d37 Signed-off-by: jihwan.seo Reviewed-on: https://gerrit.iotivity.org/gerrit/9695 Reviewed-by: Hyuna Jo Reviewed-by: Ziran Sun Tested-by: jenkins-iotivity Reviewed-by: David Antler Reviewed-by: Phil Coval Reviewed-by: Neil Wong Reviewed-by: Ashok Babu Channa --- resource/examples/garageclient.cpp | 2 +- resource/examples/simpleclient.cpp | 8 +++++--- resource/examples/simpleclientHQ.cpp | 4 ++-- resource/examples/simpleclientserver.cpp | 2 +- resource/examples/winuiclient.cpp | 5 +++-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/resource/examples/garageclient.cpp b/resource/examples/garageclient.cpp index 45e59b4..9fbc446 100644 --- a/resource/examples/garageclient.cpp +++ b/resource/examples/garageclient.cpp @@ -164,7 +164,7 @@ void printRepresentation(const OCRepresentation& rep) // callback handler on PUT request void onPut(const HeaderOptions& /*headerOptions*/, const OCRepresentation& rep, const int eCode) { - if(eCode == SUCCESS_RESPONSE) + if(eCode == SUCCESS_RESPONSE || eCode == OC_STACK_RESOURCE_CHANGED) { std::cout << "PUT request was successful" << std::endl; diff --git a/resource/examples/simpleclient.cpp b/resource/examples/simpleclient.cpp index 3301a3e..6f7b91d 100644 --- a/resource/examples/simpleclient.cpp +++ b/resource/examples/simpleclient.cpp @@ -128,7 +128,8 @@ void onPost2(const HeaderOptions& /*headerOptions*/, { try { - if(eCode == OC_STACK_OK || eCode == OC_STACK_RESOURCE_CREATED) + if(eCode == OC_STACK_OK || eCode == OC_STACK_RESOURCE_CREATED + || eCode == OC_STACK_RESOURCE_CHANGED) { std::cout << "POST request was successful" << std::endl; @@ -174,7 +175,8 @@ void onPost(const HeaderOptions& /*headerOptions*/, { try { - if(eCode == OC_STACK_OK || eCode == OC_STACK_RESOURCE_CREATED) + if(eCode == OC_STACK_OK || eCode == OC_STACK_RESOURCE_CREATED + || eCode == OC_STACK_RESOURCE_CHANGED) { std::cout << "POST request was successful" << std::endl; @@ -243,7 +245,7 @@ void onPut(const HeaderOptions& /*headerOptions*/, const OCRepresentation& rep, { try { - if(eCode == OC_STACK_OK) + if (eCode == OC_STACK_OK || eCode == OC_STACK_RESOURCE_CHANGED) { std::cout << "PUT request was successful" << std::endl; diff --git a/resource/examples/simpleclientHQ.cpp b/resource/examples/simpleclientHQ.cpp index bb6283d..b8a571c 100644 --- a/resource/examples/simpleclientHQ.cpp +++ b/resource/examples/simpleclientHQ.cpp @@ -119,7 +119,7 @@ void onObserve(const HeaderOptions /*headerOptions*/, const OCRepresentation& re void onPost2(const HeaderOptions& /*headerOptions*/, const OCRepresentation& rep, const int eCode) { - if(eCode == SUCCESS_RESPONSE) + if(eCode == SUCCESS_RESPONSE || eCode == OC_STACK_RESOURCE_CHANGED) { std::cout << "POST request was successful" << std::endl; @@ -158,7 +158,7 @@ void onPost2(const HeaderOptions& /*headerOptions*/, const OCRepresentation& rep void onPost(const HeaderOptions& /*headerOptions*/, const OCRepresentation& rep, const int eCode) { - if(eCode == SUCCESS_RESPONSE) + if(eCode == SUCCESS_RESPONSE || eCode == OC_STACK_RESOURCE_CHANGED) { std::cout << "POST request was successful" << std::endl; diff --git a/resource/examples/simpleclientserver.cpp b/resource/examples/simpleclientserver.cpp index 939e5f1..2c8f0ac 100644 --- a/resource/examples/simpleclientserver.cpp +++ b/resource/examples/simpleclientserver.cpp @@ -51,7 +51,7 @@ private: std::cout <<"Clientside Put response to get was: "<