Delete client callback for error response.
[platform/upstream/iotivity.git] / resource / examples / simpleclientHQ.cpp
index 86081f8..6d631d3 100644 (file)
 
 // OCClient.cpp : Defines the entry point for the console application.
 //
+#include "iotivity_config.h"
+
 #include <set>
 #include <string>
 #include <cstdlib>
-#include <pthread.h>
 #include <mutex>
 #include <condition_variable>
 #include "OCPlatform.h"
 #include "OCApi.h"
 
+#if defined(HAVE_PTHREAD_H)
+#include <pthread.h>
+#endif
+#if defined(HAVE_WINDOWS_H)
+#include <windows.h>
+#endif
+
 using namespace OC;
 
 struct dereference_compare
@@ -114,7 +122,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;
 
@@ -153,7 +161,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;
 
@@ -215,7 +223,7 @@ void postLightRepresentation(std::shared_ptr<OCResource> resource)
 // 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;