Update garageclient status checking
authorDavid Antler <david.a.antler@intel.com>
Wed, 27 Jul 2016 16:22:16 +0000 (09:22 -0700)
committerJon A. Cruz <jon@joncruz.org>
Wed, 3 Aug 2016 20:47:16 +0000 (20:47 +0000)
OC_STACK_OK is the eCode that should really be matched.  STATUS_SUCCESS
was only coincidentially set to the same value.

Also added whitespace after 'if' keyword.

Change-Id: I2f9ccb19d2da0911acbef0a420fecd8ed6199177
Signed-off-by: David Antler <david.a.antler@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/9799
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Jon A. Cruz <jon@joncruz.org>
resource/examples/garageclient.cpp

index 9fbc4463dd36f4688f77ed10c52c731cacfce2e0..9a91da98e0548cfe71d6a68cb17764750913b8ee 100644 (file)
@@ -30,7 +30,6 @@
 
 using namespace OC;
 
-const int SUCCESS_RESPONSE = 0;
 std::shared_ptr<OCResource> curResource;
 std::mutex curResourceLock;
 
@@ -164,7 +163,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 || eCode == OC_STACK_RESOURCE_CHANGED)
+    if (eCode == OC_STACK_OK || eCode == OC_STACK_RESOURCE_CHANGED)
     {
         std::cout << "PUT request was successful" << std::endl;
 
@@ -201,7 +200,7 @@ void putLightRepresentation(std::shared_ptr<OCResource> resource)
 // Callback handler on GET request
 void onGet(const HeaderOptions& /*headerOptions*/, const OCRepresentation& rep, const int eCode)
 {
-    if(eCode == SUCCESS_RESPONSE)
+    if (eCode == OC_STACK_OK)
     {
         std::cout << "GET request was successful" << std::endl;
         std::cout << "Resource URI: " << rep.getUri() << std::endl;