Remove unnecessary setter/getter related errorcode for response 51/13151/10
authorjihwan.seo <jihwan.seo@samsung.com>
Wed, 12 Oct 2016 09:41:05 +0000 (18:41 +0900)
committerUze Choi <uzchoi@samsung.com>
Tue, 25 Oct 2016 05:37:07 +0000 (05:37 +0000)
There are invalid APIs setErrorCode/getErrorCode in C++ layer.
It can be caused a big confusion to user.
Since the value never transfer on network. it just set in class inside.
Thur, It is better to remove the methods.

Change-Id: Iab863b1c16095ec77b9733bd3ff0ea38167b2dba
Signed-off-by: jihwan.seo <jihwan.seo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/13151
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Dave Thaler <dthaler@microsoft.com>
Reviewed-by: Jaewook Jung <jw0213.jung@samsung.com>
Reviewed-by: JungYong KIM <jyong2.kim@samsung.com>
Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
Reviewed-by: Ziran Sun <ziran.sun@samsung.com>
Reviewed-by: Jaehong Jo <jaehong.jo@samsung.com>
Reviewed-by: Rick Bell <richard.s.bell@intel.com>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
44 files changed:
android/android_api/base/jni/JniOcResourceResponse.cpp
android/android_api/base/jni/JniOcResourceResponse.h
android/android_api/base/src/androidTest/java/org/iotivity/base/SmokeTest.java
android/android_api/base/src/main/java/org/iotivity/base/OcResourceResponse.java
android/examples/fridgegroupserver/src/main/java/org/iotivity/base/examples/DoorResource.java
android/examples/fridgegroupserver/src/main/java/org/iotivity/base/examples/LightResource.java
android/examples/fridgeserver/src/main/java/org/iotivity/base/examples/fridgeserver/DeviceResource.java
android/examples/fridgeserver/src/main/java/org/iotivity/base/examples/fridgeserver/DoorResource.java
android/examples/fridgeserver/src/main/java/org/iotivity/base/examples/fridgeserver/LightResource.java
android/examples/simplebase/src/main/java/org/iotivity/base/examples/CloudFragment.java
android/examples/simpleserver/src/main/java/org/iotivity/base/examples/Light.java
cloud/samples/client/airconditioner/aircon_controlee.cpp
examples/OICMiddle/Server.cpp
examples/OICSensorBoard/server.cpp
resource/examples/fridgeserver.cpp
resource/examples/garageserver.cpp
resource/examples/lightserver.cpp
resource/examples/mediaserver.cpp
resource/examples/roomserver.cpp
resource/examples/simpleclientserver.cpp
resource/examples/simpleserver.cpp
resource/examples/simpleserverHQ.cpp
resource/examples/threadingsample.cpp
resource/include/OCResourceResponse.h
resource/unittests/OCResourceResponseTest.cpp
service/notification/cpp-wrapper/unittest/NSProviderServiceSimulator.h
service/notification/unittest/NSProviderSimulator.h
service/resource-container/examples/BMISensorBundle/src/inputSensors/HeightSensorApp/src/HeightSensorApp.cpp
service/resource-container/examples/BMISensorBundle/src/inputSensors/WeightSensorApp/src/WeightSensorApp.cpp
service/resource-container/examples/DiscomfortIndexSensorBundle/src/inputSensors/THSensorApp/src/ThingResourceServer.cpp
service/resource-container/examples/DiscomfortIndexSensorBundle/src/inputSensors/THSensorApp1/src/ThingResourceServer1.cpp
service/resource-encapsulation/src/serverBuilder/src/RCSResourceObject.cpp
service/resource-encapsulation/src/serverBuilder/unittests/RCSResourceObjectTest.cpp
service/resource-hosting/SampleApp/android/SampleProviderApp/src/com/example/sample/provider/TemperatureResource.java
service/resource-hosting/SampleApp/linux/sampleProvider/SampleProvider.cpp
service/scene-manager/sampleapp/linux/fanserver.cpp
service/scene-manager/sampleapp/linux/lightserver.cpp
service/simulator/src/server/simulator_collection_resource_impl.cpp
service/simulator/src/server/simulator_single_resource_impl.cpp
service/things-manager/sampleapp/android/con-server/src/com/example/con_server/ConfigurationServer.java
service/things-manager/sampleapp/linux/configuration/bootstrapserver.cpp
service/things-manager/sampleapp/linux/configuration/con-server.cpp
service/things-manager/sampleapp/tizen/ConServerApp/src/conserverapp.cpp
service/things-manager/unittests/ThingsManagerTest.cpp

index 8189073..4ea4beb 100644 (file)
@@ -38,11 +38,6 @@ JniOcResourceResponse::~JniOcResourceResponse()
 {
 }
 
-void JniOcResourceResponse::setErrorCode(const int eCode)
-{
-    this->m_response->setErrorCode(eCode);
-}
-
 std::string JniOcResourceResponse::getNewResourceUri(void)
 {
     return this->m_response->getNewResourceUri();
@@ -104,22 +99,6 @@ JniOcResourceResponse* JniOcResourceResponse::getJniOcResourceResponsePtr
     }
     return request;
 }
-/*
-* Class:     org_iotivity_base_OcResourceResponse
-* Method:    setErrorCode
-* Signature: (I)V
-*/
-JNIEXPORT void JNICALL Java_org_iotivity_base_OcResourceResponse_setErrorCode
-(JNIEnv *env, jobject thiz, jint eCode)
-{
-    LOGD("OcResourceResponse_setErrorCode");
-    JniOcResourceResponse *response = JniOcResourceResponse::getJniOcResourceResponsePtr(env, thiz);
-    if (!response)
-    {
-        return;
-    }
-    response->setErrorCode(static_cast<int>(eCode));
-}
 
 /*
 * Class:     org_iotivity_base_OcResourceResponse
index 2fc5768..9f00698 100644 (file)
@@ -32,7 +32,6 @@ class JniOcResourceResponse
 public:
     JniOcResourceResponse(std::shared_ptr<OCResourceResponse> resourceResponse);
     ~JniOcResourceResponse();
-    void setErrorCode(const int eCode);
     std::string getNewResourceUri(void);
     void setNewResourceUri(const std::string newResourceUri);
     void setHeaderOptions(const HeaderOptions& headerOptions);
@@ -51,14 +50,6 @@ private:
 extern "C" {
 #endif
 
-    /*
-    * Class:     org_iotivity_base_OcResourceResponse
-    * Method:    setErrorCode
-    * Signature: (I)V
-    */
-    JNIEXPORT void JNICALL Java_org_iotivity_base_OcResourceResponse_setErrorCode
-        (JNIEnv *, jobject, jint);
-
     /*
     * Class:     org_iotivity_base_OcResourceResponse
     * Method:    getNewResourceUri
@@ -141,4 +132,4 @@ extern "C" {
 #ifdef __cplusplus
 }
 #endif
-#endif
\ No newline at end of file
+#endif
index a3a2ba7..0c26ab3 100644 (file)
@@ -313,7 +313,6 @@ public class SmokeTest extends InstrumentationTestCase {
                                             assertTrue(false);
                                         }
 
-                                        ocResourceResponse.setErrorCode(200);
                                         ocResourceResponse.setResponseResult(EntityHandlerResult.OK);
                                         ocResourceResponse.setResourceRepresentation(
                                                 getRepresentation(74));
@@ -488,7 +487,6 @@ public class SmokeTest extends InstrumentationTestCase {
                                         Log.i(TAG, "URI: " + rep.getUri());
 
                                         ocResourceResponse.setResponseResult(EntityHandlerResult.OK);
-                                        ocResourceResponse.setErrorCode(200);
                                         ocResourceResponse.setResourceRepresentation(rep);
                                         break;
                                     case POST:
@@ -668,7 +666,6 @@ public class SmokeTest extends InstrumentationTestCase {
                                         }
                                         Log.i(TAG, "URI: " + rep.getUri());
 
-                                        ocResourceResponse.setErrorCode(200);
                                         ocResourceResponse.setResponseResult(EntityHandlerResult.OK);
                                         ocResourceResponse.setResourceRepresentation(
                                                 getRepresentation(44));
@@ -787,7 +784,6 @@ public class SmokeTest extends InstrumentationTestCase {
 
                                 switch (requestType) {
                                     case DELETE:
-                                        ocResourceResponse.setErrorCode(200);
                                         ocResourceResponse.setResponseResult(
                                                 EntityHandlerResult.RESOURCE_DELETED);
                                         break;
@@ -956,22 +952,18 @@ public class SmokeTest extends InstrumentationTestCase {
 
                                 switch (requestType) {
                                     case GET:
-                                        ocResourceResponse.setErrorCode(200);
                                         ocResourceResponse.setResponseResult(
                                                 EntityHandlerResult.ERROR);
                                         break;
                                     case PUT:
-                                        ocResourceResponse.setErrorCode(200);
                                         ocResourceResponse.setResponseResult(
                                                 EntityHandlerResult.ERROR);
                                         break;
                                     case POST:
-                                        ocResourceResponse.setErrorCode(200);
-                                        ocResourceResponse.setResponseResult(
+                                         ocResourceResponse.setResponseResult(
                                                 EntityHandlerResult.ERROR);
                                         break;
                                     case DELETE:
-                                        ocResourceResponse.setErrorCode(200);
                                         ocResourceResponse.setResponseResult(
                                                 EntityHandlerResult.ERROR);
                                         break;
@@ -1552,7 +1544,6 @@ public class SmokeTest extends InstrumentationTestCase {
 
                     switch (requestType) {
                         case GET:
-                            ocResourceResponse.setErrorCode(200);
                             ocResourceResponse.setResponseResult(EntityHandlerResult.OK);
                             ocResourceResponse.setResourceRepresentation(
                                     getRepresentation(
index 4e0879f..b078061 100644 (file)
@@ -44,13 +44,6 @@ public class OcResourceResponse {
         this.mNativeHandle = nativeHandle;
     }
 
-    /**
-     * This API sets the error code for this response
-     *
-     * @param eCode error code to set
-     */
-    public native void setErrorCode(int eCode);
-
     /**
      * Gets new resource uri
      *
index dd3ce9d..17afabe 100755 (executable)
@@ -88,14 +88,12 @@ public class DoorResource extends Resource implements OcPlatform.EntityHandler {
 
                     switch (ocResourceRequest.getRequestType()) {
                         case GET:
-                            response.setErrorCode(Resource.SUCCESS);
                             updateRepresentationValues();
                             response.setResourceRepresentation(mRepresentation);
                             response.setResponseResult(EntityHandlerResult.OK);
                             OcPlatform.sendResponse(response);
                             break;
                         case PUT:
-                            response.setErrorCode(Resource.SUCCESS);
                             put(ocResourceRequest.getResourceRepresentation());
                             updateRepresentationValues();
                             response.setResourceRepresentation(mRepresentation);
@@ -104,7 +102,6 @@ public class DoorResource extends Resource implements OcPlatform.EntityHandler {
                             break;
                         case DELETE:
                             response.setResponseResult(EntityHandlerResult.RESOURCE_DELETED);
-                            response.setErrorCode(204);
                             OcPlatform.sendResponse(response);
                             break;
                     }
index 79f8347..3cccd87 100755 (executable)
@@ -86,7 +86,6 @@ public class LightResource extends Resource implements OcPlatform.EntityHandler
                     response.setResourceHandle(ocResourceRequest.getResourceHandle());
                     switch (ocResourceRequest.getRequestType()) {
                         case GET:
-                            response.setErrorCode(Resource.SUCCESS);
                             updateRepresentationValues();
                             response.setResourceRepresentation(mRepresentation);
                             response.setResponseResult(EntityHandlerResult.OK);
@@ -94,7 +93,6 @@ public class LightResource extends Resource implements OcPlatform.EntityHandler
                             result = EntityHandlerResult.OK;
                             break;
                         case PUT:
-                            response.setErrorCode(Resource.SUCCESS);
                             put(ocResourceRequest.getResourceRepresentation());
                             updateRepresentationValues();
                             response.setResourceRepresentation(mRepresentation);
index b4338fa..46acda4 100755 (executable)
@@ -121,7 +121,6 @@ public class DeviceResource extends Resource implements OcPlatform.EntityHandler
 
                         switch (ocResourceRequest.getRequestType()) {
                             case GET:
-                                response.setErrorCode(SUCCESS);
                                 response.setResponseResult(EntityHandlerResult.OK);
                                 updateRepresentationValues();
                                 response.setResourceRepresentation(mRepresentation);
index 86e83fe..4f90e11 100755 (executable)
@@ -95,14 +95,12 @@ public class DoorResource extends Resource implements OcPlatform.EntityHandler {
 
                     switch (ocResourceRequest.getRequestType()) {
                         case GET:
-                            response.setErrorCode(SUCCESS);
                             updateRepresentationValues();
                             response.setResourceRepresentation(mRepresentation);
                             response.setResponseResult(EntityHandlerResult.OK);
                             OcPlatform.sendResponse(response);
                             break;
                         case PUT:
-                            response.setErrorCode(SUCCESS);
                             put(ocResourceRequest.getResourceRepresentation());
                             updateRepresentationValues();
                             response.setResourceRepresentation(mRepresentation);
@@ -111,7 +109,6 @@ public class DoorResource extends Resource implements OcPlatform.EntityHandler {
                             break;
                         case DELETE:
                             response.setResponseResult(EntityHandlerResult.RESOURCE_DELETED);
-                            response.setErrorCode(204);
                             OcPlatform.sendResponse(response);
                             break;
                     }
index cf3d549..40dc55a 100755 (executable)
@@ -91,7 +91,6 @@ public class LightResource extends Resource implements OcPlatform.EntityHandler
 
                     switch (ocResourceRequest.getRequestType()) {
                         case GET:
-                            response.setErrorCode(SUCCESS);
                             updateRepresentationValues();
                             response.setResourceRepresentation(mRepresentation);
                             response.setResponseResult(EntityHandlerResult.OK);
@@ -99,7 +98,6 @@ public class LightResource extends Resource implements OcPlatform.EntityHandler
                             result = EntityHandlerResult.OK;
                             break;
                         case PUT:
-                            response.setErrorCode(SUCCESS);
                             put(ocResourceRequest.getResourceRepresentation());
                             updateRepresentationValues();
                             response.setResourceRepresentation(mRepresentation);
index be394f9..7f7c534 100644 (file)
@@ -785,7 +785,6 @@ public class CloudFragment extends Fragment implements
         OcResourceResponse response = new OcResourceResponse();
         response.setRequestHandle(request.getRequestHandle());
         response.setResourceHandle(request.getResourceHandle());
-        response.setErrorCode(Common.SUCCESS);
         response.setResponseResult(EntityHandlerResult.OK);
         response.setResourceRepresentation(getOcRepresentation());
         return sendResponse(response);
@@ -799,7 +798,6 @@ public class CloudFragment extends Fragment implements
         setOcRepresentation(request.getResourceRepresentation());
         response.setResourceRepresentation(getOcRepresentation());
         response.setResponseResult(EntityHandlerResult.OK);
-        response.setErrorCode(Common.SUCCESS);
         return sendResponse(response);
     }
 
index bb7107e..1657881 100644 (file)
@@ -168,7 +168,6 @@ public class Light implements OcPlatform.EntityHandler {
             }).start();
             ehResult = EntityHandlerResult.SLOW;
         } else { // normal response case.
-            response.setErrorCode(SUCCESS);
             response.setResponseResult(EntityHandlerResult.OK);
             response.setResourceRepresentation(getOcRepresentation());
             ehResult = sendResponse(response);
@@ -184,7 +183,6 @@ public class Light implements OcPlatform.EntityHandler {
         setOcRepresentation(request.getResourceRepresentation());
         response.setResourceRepresentation(getOcRepresentation());
         response.setResponseResult(EntityHandlerResult.OK);
-        response.setErrorCode(SUCCESS);
         return sendResponse(response);
     }
 
@@ -204,7 +202,6 @@ public class Light implements OcPlatform.EntityHandler {
             Log.e(TAG, e.toString());
         }
         response.setResourceRepresentation(rep_post);
-        response.setErrorCode(SUCCESS);
         response.setNewResourceUri(newUri);
         response.setResponseResult(EntityHandlerResult.RESOURCE_CREATED);
         return sendResponse(response);
@@ -228,7 +225,6 @@ public class Light implements OcPlatform.EntityHandler {
         response.setRequestHandle(request.getRequestHandle());
         response.setResourceHandle(request.getResourceHandle());
 
-        response.setErrorCode(SUCCESS);
         response.setResponseResult(EntityHandlerResult.OK);
         response.setResourceRepresentation(getOcRepresentation());
         sendResponse(response);
@@ -273,7 +269,6 @@ public class Light implements OcPlatform.EntityHandler {
             try {
                 if (mIsListOfObservers) {
                     OcResourceResponse response = new OcResourceResponse();
-                    response.setErrorCode(SUCCESS);
                     response.setResourceRepresentation(getOcRepresentation());
                     OcPlatform.notifyListOfObservers(
                             mResourceHandle,
index 0a1a2dd..2916fdf 100644 (file)
@@ -85,7 +85,6 @@ class Resource
                 pResponse->setResourceRepresentation(getRepresentation(), DEFAULT_INTERFACE);
             }
 
-            pResponse->setErrorCode(200);
             pResponse->setResponseResult(OC_EH_OK);
 
             return OCPlatform::sendResponse(pResponse);
@@ -98,7 +97,6 @@ class Resource
                 shared_ptr<OCResourceResponse> resourceResponse =
                 { make_shared<OCResourceResponse>() };
 
-                resourceResponse->setErrorCode(200);
                 resourceResponse->setResourceRepresentation(getRepresentation(), DEFAULT_INTERFACE);
 
                 return OCPlatform::notifyListOfObservers(m_handle,
index b729a48..6d1de84 100644 (file)
@@ -62,7 +62,6 @@ OCEntityHandlerResult MiddleServer::entityHandler(const std::shared_ptr<OCResour
         auto response = std::make_shared<OC::OCResourceResponse>();
         response->setRequestHandle(request->getRequestHandle());
         response->setResourceHandle(request->getResourceHandle());
-        response->setErrorCode(200);
         response->setResponseResult(OC_EH_OK);
         if (OC_STACK_OK != OCPlatform::sendResponse(response)) {
             return OC_EH_ERROR;
index a8b7a23..82967c6 100644 (file)
@@ -106,7 +106,6 @@ void IoTServer::temperatureObserverLoop()
     usleep(1500000);
     cout << "Temperature Observer Callback" << endl;
     shared_ptr<OCResourceResponse> resourceResponse(new OCResourceResponse());
-    resourceResponse->setErrorCode(200);
     resourceResponse->setResourceRepresentation(getTemperatureRepresentation(),
     EDISON_RESOURCE_INTERFACE);
     OCStackResult result = OCPlatform::notifyListOfObservers(m_temperatureResource,
@@ -124,7 +123,6 @@ void IoTServer::lightObserverLoop()
     usleep(1500000);
     cout << "Light Observer Callback" << endl;
     shared_ptr<OCResourceResponse> resourceResponse(new OCResourceResponse());
-    resourceResponse->setErrorCode(200);
     resourceResponse->setResourceRepresentation(getLightRepresentation(),
     EDISON_RESOURCE_INTERFACE);
     OCStackResult result = OCPlatform::notifyListOfObservers(m_ambientLightResource,
@@ -166,7 +164,6 @@ OCEntityHandlerResult IoTServer::lightEntityHandler(shared_ptr<OCResourceRequest
                 cout << "GET request for ambient light reading" << endl;
                 if (Response)
                 {
-                    Response->setErrorCode(200);
                     Response->setResponseResult(OC_EH_OK);
                     Response->setResourceRepresentation(getLightRepresentation());
                     if (OCPlatform::sendResponse(Response) == OC_STACK_OK)
@@ -221,7 +218,6 @@ OCEntityHandlerResult IoTServer::temperatureEntityHandler(shared_ptr<OCResourceR
                 cout << "GET request for temperature sensor reading" << endl;
                 if (Response)
                 {
-                    Response->setErrorCode(200);
                     Response->setResponseResult(OC_EH_OK);
                     Response->setResourceRepresentation(getTemperatureRepresentation());
                     if (OCPlatform::sendResponse(Response) == OC_STACK_OK)
@@ -300,7 +296,6 @@ OCEntityHandlerResult IoTServer::LEDEntityHandler(shared_ptr<OCResourceRequest>
                 putLEDRepresentation();
                 if (Response)
                 {
-                    Response->setErrorCode(200);
                     Response->setResourceRepresentation(getLEDRepresentation());
                     Response->setResponseResult(OC_EH_OK);
                     if (OCPlatform::sendResponse(Response) == OC_STACK_OK)
@@ -314,7 +309,6 @@ OCEntityHandlerResult IoTServer::LEDEntityHandler(shared_ptr<OCResourceRequest>
                 cout << "GET request for platform LED" << endl;
                 if (Response)
                 {
-                    Response->setErrorCode(200);
                     Response->setResourceRepresentation(getLEDRepresentation());
                     Response->setResponseResult(OC_EH_OK);
                     if (OCPlatform::sendResponse(Response) == OC_STACK_OK)
index e981c90..05ed1d8 100644 (file)
@@ -188,7 +188,7 @@ class DeviceResource : public Resource
                     if(request->getRequestType() == "GET")
                     {
                         std::cout<<"DeviceResource Get Request"<<std::endl;
-                        pResponse->setErrorCode(200);
+
                         pResponse->setResponseResult(OC_EH_OK);
                         pResponse->setResourceRepresentation(get(), "");
                         if(OC_STACK_OK == OCPlatform::sendResponse(pResponse))
@@ -201,7 +201,7 @@ class DeviceResource : public Resource
                         std::cout<<"DeviceResource Delete Request"<<std::endl;
                         if(deleteDeviceResource() == OC_STACK_OK)
                         {
-                            pResponse->setErrorCode(200);
+
                             pResponse->setResponseResult(OC_EH_RESOURCE_DELETED);
                             ehResult = OC_EH_OK;
                         }
@@ -252,7 +252,7 @@ class DeviceResource : public Resource
                 if(request->getRequestType() == "GET")
                 {
                     std::cout<<"Default Entity Handler: Get Request"<<std::endl;
-                    pResponse->setErrorCode(200);
+
                     pResponse->setResourceRepresentation(get(), "");
                     if(OC_STACK_OK == OCPlatform::sendResponse(pResponse))
                     {
@@ -333,7 +333,7 @@ class LightResource : public Resource
                 if(request->getRequestType() == "GET")
                 {
                     std::cout<<"Light Get Request"<<std::endl;
-                    pResponse->setErrorCode(200);
+
                     pResponse->setResourceRepresentation(get(), "");
                     if(OC_STACK_OK == OCPlatform::sendResponse(pResponse))
                     {
@@ -344,7 +344,7 @@ class LightResource : public Resource
                 {
                     std::cout <<"Light Put Request"<<std::endl;
                     put(request->getResourceRepresentation());
-                    pResponse->setErrorCode(200);
+
                     pResponse->setResourceRepresentation(get(), "");
                     if(OC_STACK_OK == OCPlatform::sendResponse(pResponse))
                     {
@@ -433,7 +433,7 @@ class DoorResource : public Resource
                     // note that we know the side because std::bind gives us the
                     // appropriate object
                     std::cout<< m_side << " Door Get Request"<<std::endl;
-                    pResponse->setErrorCode(200);
+
                     pResponse->setResourceRepresentation(get(), "");
                     if(OC_STACK_OK == OCPlatform::sendResponse(pResponse))
                     {
@@ -444,7 +444,7 @@ class DoorResource : public Resource
                 {
                     std::cout << m_side <<" Door Put Request"<<std::endl;
                     put(request->getResourceRepresentation());
-                    pResponse->setErrorCode(200);
+
                     pResponse->setResourceRepresentation(get(),"");
                     if(OC_STACK_OK == OCPlatform::sendResponse(pResponse))
                     {
index 6f833d7..f176b7f 100644 (file)
@@ -203,7 +203,6 @@ OCStackResult sendResponse(std::shared_ptr<OCResourceRequest> pRequest)
     pResponse->setRequestHandle(pRequest->getRequestHandle());
     pResponse->setResourceHandle(pRequest->getResourceHandle());
     pResponse->setResourceRepresentation(myGarage.get());
-    pResponse->setErrorCode(200);
     pResponse->setResponseResult(OC_EH_OK);
 
     return OCPlatform::sendResponse(pResponse);
index ab7591f..1e9a2c1 100644 (file)
@@ -229,7 +229,7 @@ OCEntityHandlerResult entityHandler(std::shared_ptr<OCResourceRequest> request)
                 }
                 else // normal response case.
                 {
-                    pResponse->setErrorCode(200);
+
                     pResponse->setResponseResult(OC_EH_OK);
                     pResponse->setResourceRepresentation(get());
                     if(OC_STACK_OK == OCPlatform::sendResponse(pResponse))
@@ -246,7 +246,7 @@ OCEntityHandlerResult entityHandler(std::shared_ptr<OCResourceRequest> request)
                 // Do related operations related to PUT request
                 // Update the lightResource
                 put(rep);
-                pResponse->setErrorCode(200);
+
                 pResponse->setResponseResult(OC_EH_OK);
                 pResponse->setResourceRepresentation(get());
                 if(OC_STACK_OK == OCPlatform::sendResponse(pResponse))
@@ -263,7 +263,7 @@ OCEntityHandlerResult entityHandler(std::shared_ptr<OCResourceRequest> request)
                 // Do related operations related to POST request
                 OCRepresentation rep_post = post(rep);
                 pResponse->setResourceRepresentation(rep_post);
-                pResponse->setErrorCode(200);
+
                 if(rep_post.hasAttribute("createduri"))
                 {
                     pResponse->setResponseResult(OC_EH_RESOURCE_CREATED);
@@ -302,7 +302,7 @@ void * handleSlowResponse (void *param, std::shared_ptr<OCResourceRequest> pRequ
     pResponse->setRequestHandle(pRequest->getRequestHandle());
     pResponse->setResourceHandle(pRequest->getResourceHandle());
     pResponse->setResourceRepresentation(lightPtr->get());
-    pResponse->setErrorCode(200);
+
     pResponse->setResponseResult(OC_EH_OK);
 
     // Set the slow response flag back to false
index 37211ee..08184d0 100644 (file)
@@ -312,7 +312,7 @@ OCEntityHandlerResult entityHandler(std::shared_ptr<OCResourceRequest> request)
                 }
                 else // normal response case.
                 {
-                    pResponse->setErrorCode(200);
+
                     pResponse->setResponseResult(OC_EH_OK);
                     pResponse->setResourceRepresentation(get());
                     if(OC_STACK_OK == OCPlatform::sendResponse(pResponse))
@@ -329,7 +329,7 @@ OCEntityHandlerResult entityHandler(std::shared_ptr<OCResourceRequest> request)
                 // Do related operations related to PUT request
                 // Update the mediaResource
                 put(rep);
-                pResponse->setErrorCode(200);
+
                 pResponse->setResponseResult(OC_EH_OK);
                 pResponse->setResourceRepresentation(get());
                 if(OC_STACK_OK == OCPlatform::sendResponse(pResponse))
@@ -346,7 +346,7 @@ OCEntityHandlerResult entityHandler(std::shared_ptr<OCResourceRequest> request)
                 // Do related operations related to POST request
                 OCRepresentation rep_post = post(rep);
                 pResponse->setResourceRepresentation(rep_post);
-                pResponse->setErrorCode(200);
+
                 if(rep_post.hasAttribute("createduri"))
                 {
                     pResponse->setResponseResult(OC_EH_RESOURCE_CREATED);
@@ -448,7 +448,6 @@ void * ChangeMediaRepresentation (void *param)
                 std::shared_ptr<OCResourceResponse> resourceResponse =
                             {std::make_shared<OCResourceResponse>()};
 
-                resourceResponse->setErrorCode(200);
                 resourceResponse->setResourceRepresentation(mediaPtr->get(), DEFAULT_INTERFACE);
 
                 result = OCPlatform::notifyListOfObservers(  mediaPtr->getHandle(),
@@ -483,7 +482,7 @@ void * handleSlowResponse (void *param, std::shared_ptr<OCResourceRequest> pRequ
     pResponse->setRequestHandle(pRequest->getRequestHandle());
     pResponse->setResourceHandle(pRequest->getResourceHandle());
     pResponse->setResourceRepresentation(mediaPtr->get());
-    pResponse->setErrorCode(200);
+
     pResponse->setResponseResult(OC_EH_OK);
 
     // Set the slow response flag back to false
index 3fc30e9..a3091cc 100644 (file)
@@ -298,7 +298,7 @@ OCStackResult sendRoomResponse(std::shared_ptr<OCResourceRequest> pRequest)
         pResponse->setResourceRepresentation(rep, DEFAULT_INTERFACE);
     }
 
-    pResponse->setErrorCode(200);
+
     pResponse->setResponseResult(OC_EH_OK);
 
     return OCPlatform::sendResponse(pResponse);
@@ -478,7 +478,7 @@ OCStackResult sendLightResponse(std::shared_ptr<OCResourceRequest> pRequest)
     pResponse->setRequestHandle(pRequest->getRequestHandle());
     pResponse->setResourceHandle(pRequest->getResourceHandle());
     pResponse->setResourceRepresentation(myRoomResource.getLightRepresentation());
-    pResponse->setErrorCode(200);
+
     pResponse->setResponseResult(OC_EH_OK);
 
     return OCPlatform::sendResponse(pResponse);
@@ -515,7 +515,7 @@ OCStackResult sendFanResponse(std::shared_ptr<OCResourceRequest> pRequest)
     pResponse->setRequestHandle(pRequest->getRequestHandle());
     pResponse->setResourceHandle(pRequest->getResourceHandle());
     pResponse->setResourceRepresentation(myRoomResource.getFanRepresentation());
-    pResponse->setErrorCode(200);
+
     pResponse->setResponseResult(OC_EH_OK);
 
     return OCPlatform::sendResponse(pResponse);
index 2c8f0ac..596b37f 100644 (file)
@@ -235,7 +235,7 @@ struct FooResource
         pResponse->setRequestHandle(pRequest->getRequestHandle());
         pResponse->setResourceHandle(pRequest->getResourceHandle());
         pResponse->setResourceRepresentation(get(), "");
-        pResponse->setErrorCode(200);
+
         pResponse->setResponseResult(OC_EH_OK);
 
         return OCPlatform::sendResponse(pResponse);
index 11d4f54..0ca461d 100644 (file)
@@ -334,7 +334,7 @@ OCEntityHandlerResult entityHandler(std::shared_ptr<OCResourceRequest> request)
                 }
                 else // normal response case.
                 {
-                    pResponse->setErrorCode(200);
+
                     pResponse->setResponseResult(OC_EH_OK);
                     pResponse->setResourceRepresentation(get());
                     if(OC_STACK_OK == OCPlatform::sendResponse(pResponse))
@@ -351,7 +351,7 @@ OCEntityHandlerResult entityHandler(std::shared_ptr<OCResourceRequest> request)
                 // Do related operations related to PUT request
                 // Update the lightResource
                 put(rep);
-                pResponse->setErrorCode(200);
+
                 pResponse->setResponseResult(OC_EH_OK);
                 pResponse->setResourceRepresentation(get());
                 if(OC_STACK_OK == OCPlatform::sendResponse(pResponse))
@@ -368,7 +368,7 @@ OCEntityHandlerResult entityHandler(std::shared_ptr<OCResourceRequest> request)
                 // Do related operations related to POST request
                 OCRepresentation rep_post = post(rep);
                 pResponse->setResourceRepresentation(rep_post);
-                pResponse->setErrorCode(200);
+
                 if(rep_post.hasAttribute("createduri"))
                 {
                     pResponse->setResponseResult(OC_EH_RESOURCE_CREATED);
@@ -471,7 +471,6 @@ void * ChangeLightRepresentation (void *param)
                 std::shared_ptr<OCResourceResponse> resourceResponse =
                             {std::make_shared<OCResourceResponse>()};
 
-                resourceResponse->setErrorCode(200);
                 resourceResponse->setResourceRepresentation(lightPtr->get(), DEFAULT_INTERFACE);
 
                 result = OCPlatform::notifyListOfObservers(  lightPtr->getHandle(),
@@ -572,7 +571,7 @@ void * handleSlowResponse (void *param, std::shared_ptr<OCResourceRequest> pRequ
     pResponse->setRequestHandle(pRequest->getRequestHandle());
     pResponse->setResourceHandle(pRequest->getResourceHandle());
     pResponse->setResourceRepresentation(lightPtr->get());
-    pResponse->setErrorCode(200);
+
     pResponse->setResponseResult(OC_EH_OK);
 
     // Set the slow response flag back to false
index b50bc5b..ecfc2b4 100644 (file)
@@ -264,7 +264,7 @@ OCStackResult sendResponse(std::shared_ptr<OCResourceRequest> pRequest)
     pResponse->setRequestHandle(pRequest->getRequestHandle());
     pResponse->setResourceHandle(pRequest->getResourceHandle());
     pResponse->setResourceRepresentation(get());
-    pResponse->setErrorCode(200);
+
     pResponse->setResponseResult(OC_EH_OK);
 
     return OCPlatform::sendResponse(pResponse);
@@ -280,7 +280,7 @@ OCStackResult sendPostResponse(std::shared_ptr<OCResourceRequest> pRequest)
     OCRepresentation rep_post = post(rep);
 
     pResponse->setResourceRepresentation(rep_post);
-    pResponse->setErrorCode(200);
+
     pResponse->setResponseResult(OC_EH_OK);
 
     return OCPlatform::sendResponse(pResponse);
@@ -411,7 +411,6 @@ void * ChangeLightRepresentation (void *param)
                 std::shared_ptr<OCResourceResponse> resourceResponse =
                             std::make_shared<OCResourceResponse>();
 
-                resourceResponse->setErrorCode(200);
                 resourceResponse->setResourceRepresentation(lightPtr->get(), DEFAULT_INTERFACE);
 
                 result = OCPlatform::notifyListOfObservers(
index 46cfbec..3c61b71 100644 (file)
@@ -99,7 +99,7 @@ struct FooResource
         pResponse->setRequestHandle(pRequest->getRequestHandle());
         pResponse->setResourceHandle(pRequest->getResourceHandle());
         pResponse->setResourceRepresentation(get(), "");
-        pResponse->setErrorCode(200);
+
         pResponse->setResponseResult(OC_EH_OK);
 
         return OCPlatform::sendResponse(pResponse);
index b4b8c9f..4993340 100644 (file)
@@ -47,7 +47,6 @@ namespace OC
 
         OCResourceResponse():
             m_newResourceUri{},
-            m_errorCode{},
             m_headerOptions{},
             m_interface{},
             m_representation{},
@@ -60,7 +59,6 @@ namespace OC
 #if defined(_MSC_VER) && (_MSC_VER < 1900)
         OCResourceResponse(OCResourceResponse&& o):
             m_newResourceUri(std::move(o.m_newResourceUri)),
-            m_errorCode(o.m_errorCode),
             m_headerOptions(std::move(o.m_headerOptions)),
             m_interface(std::move(o.m_interface)),
             m_representation(std::move(o.m_representation)),
@@ -72,7 +70,6 @@ namespace OC
         OCResourceResponse& operator=(OCResourceResponse&& o)
         {
             m_newResourceUri = std::move(o.m_newResourceUri);
-            m_errorCode = o.m_errorCode;
             m_headerOptions = std::move(o.m_headerOptions);
             m_interface = std::move(o.m_interface);
             m_representation = std::move(o.m_representation);
@@ -86,12 +83,6 @@ namespace OC
 #endif
         virtual ~OCResourceResponse(void) {}
 
-        /**
-        *  This API sets the error code for this response
-        *  @param eCode error code to set
-        */
-        void setErrorCode(const int eCode) { m_errorCode = eCode; }
-
         /**
         *  gets new resource uri
         *  @return std::string new resource uri
@@ -188,7 +179,6 @@ namespace OC
         }
     private:
         std::string m_newResourceUri;
-        int m_errorCode;
         HeaderOptions m_headerOptions;
         std::string m_interface;
         OCRepresentation m_representation;
@@ -244,14 +234,6 @@ namespace OC
         }
     public:
 
-        /**
-        * Get error code
-        */
-        int getErrorCode() const
-        {
-            return m_errorCode;
-        }
-
         /**
          * Get the Response Representation
          */
index 3968948..e2678a0 100644 (file)
@@ -31,20 +31,6 @@ namespace OCResourceResponseTest
     using namespace OC;
     using namespace std;
 
-    TEST(ErrorCodeTest, SetGetErrorCodeValidCode)
-    {
-        OCResourceResponse response;
-        int setCode = 200;
-        EXPECT_NO_THROW(response.setErrorCode(setCode));
-        EXPECT_EQ(setCode, response.getErrorCode());
-        setCode = 500;
-        EXPECT_NO_THROW(response.setErrorCode(setCode));
-        EXPECT_EQ(setCode, response.getErrorCode());
-        setCode = 400;
-        EXPECT_NO_THROW(response.setErrorCode(setCode));
-        EXPECT_EQ(setCode, response.getErrorCode());
-    }
-
     TEST(NewResourceUriTest, SetGetNewResourceUriValidUri)
     {
         OCResourceResponse response;
index 2245567..7bc14a5 100644 (file)
@@ -111,7 +111,6 @@ private:
         {
             std::string request = requests->getRequestType();
 
-            response->setErrorCode(200);
             response->setResponseResult(OC_EH_OK);
 
             if (request == "GET")
@@ -241,7 +240,6 @@ private:
             auto response = std::make_shared<OC::OCResourceResponse>();
             response->setRequestHandle(requests->getRequestHandle());
             response->setResourceHandle(requests->getResourceHandle());
-            response->setErrorCode(200);
             response->setResponseResult(OC_EH_OK);
             response->setResourceRepresentation(rep);
 
index 6c4fdb3..e864abc 100644 (file)
@@ -111,7 +111,6 @@ private:
         {
             std::string request = requests->getRequestType();
 
-            response->setErrorCode(200);
             response->setResponseResult(OC_EH_OK);
 
             if (request == "GET")
@@ -241,7 +240,6 @@ private:
             auto response = std::make_shared<OC::OCResourceResponse>();
             response->setRequestHandle(requests->getRequestHandle());
             response->setResourceHandle(requests->getResourceHandle());
-            response->setErrorCode(200);
             response->setResponseResult(OC_EH_OK);
             response->setResourceRepresentation(rep);
 
index 801f8b9..9d43288 100644 (file)
@@ -160,8 +160,6 @@ OCEntityHandlerResult entityHandler(std::shared_ptr< OCResourceRequest > request
 
                 if (response)
                 {
-                    // TODO Error Code
-                    response->setErrorCode(200);
                     response->setResourceRepresentation(rep, DEFAULT_INTERFACE);
                 }
             }
index 2cf051b..07b8096 100644 (file)
@@ -161,8 +161,6 @@ OCEntityHandlerResult entityHandler(std::shared_ptr< OCResourceRequest > request
 
                 if (response)
                 {
-                    // TODO Error Code
-                    response->setErrorCode(200);
                     response->setResourceRepresentation(rep, DEFAULT_INTERFACE);
                 }
             }
index 2161f0e..0a11876 100644 (file)
@@ -152,8 +152,6 @@ OCEntityHandlerResult entityHandler(std::shared_ptr< OCResourceRequest > request
 
                 if (response)
                 {
-                    // TODO Error Code
-                    response->setErrorCode(200);
                     response->setResourceRepresentation(rep, DEFAULT_INTERFACE);
                 }
             }
index 6f2645e..fdcba11 100644 (file)
@@ -151,8 +151,6 @@ OCEntityHandlerResult entityHandler(std::shared_ptr< OCResourceRequest > request
 
                 if (response)
                 {
-                    // TODO Error Code
-                    response->setErrorCode(200);
                     response->setResourceRepresentation(rep, DEFAULT_INTERFACE);
                 }
             }
index f45ab77..4219388 100644 (file)
@@ -741,7 +741,6 @@ namespace OIC
             auto ocResponse = std::make_shared< OC::OCResourceResponse >();
 
             ocResponse->setResponseResult(OC_EH_OK);
-            ocResponse->setErrorCode(reqHandler->getErrorCode());
 
             if (reqHandler->hasCustomRepresentation())
             {
index 8aa958d..8733319 100644 (file)
@@ -445,52 +445,6 @@ TEST_F(ResourceObjectHandlingRequestTest, SendResponseWithSameHandlesPassedByReq
     ASSERT_EQ(OC_EH_OK, handler(createRequest()));
 }
 
-TEST_F(ResourceObjectHandlingRequestTest, SendResponseWithRCSResponseResults)
-{
-    constexpr int errorCode{ 1999 };
-
-    server->setGetRequestHandler(
-            [](const RCSRequest&, RCSResourceAttributes&) -> RCSGetResponse
-            {
-                return RCSGetResponse::create(errorCode);
-            }
-    );
-
-    mocks.ExpectCallFunc(OCPlatform::sendResponse).Match(
-            [](const shared_ptr<OCResourceResponse> response)
-            {
-                return response->getErrorCode() == errorCode;
-            }
-    ).Return(OC_STACK_OK);
-
-    ASSERT_EQ(OC_EH_OK, handler(createRequest()));
-}
-
-TEST_F(ResourceObjectHandlingRequestTest, SendSetResponseWithCustomAttrs)
-{
-    constexpr int errorCode{ 1999 };
-    constexpr char value[]{ "VALUE" };
-
-    server->setSetRequestHandler(
-            [](const RCSRequest&, RCSResourceAttributes&) -> RCSSetResponse
-            {
-                RCSResourceAttributes attrs;
-                attrs[KEY] = value;
-                return RCSSetResponse::create(attrs, errorCode);
-            }
-    );
-
-    mocks.ExpectCallFunc(OCPlatform::sendResponse).Match(
-            [](const shared_ptr<OCResourceResponse> response)
-            {
-                return value == response->getResourceRepresentation()[KEY].getValue<std::string>()
-                        && response->getErrorCode() == errorCode;
-            }
-    ).Return(OC_STACK_OK);
-
-    ASSERT_EQ(OC_EH_OK, handler(createRequest(OC_REST_POST)));
-}
-
 TEST_F(ResourceObjectHandlingRequestTest, SeparateResponseIsSlowResponse)
 {
     server->setGetRequestHandler(
index b581062..916cb1f 100644 (file)
@@ -156,8 +156,6 @@ public class TemperatureResource implements IMessageLogger {
                             logMessage("GET");
                             ocResourceResponse
                                     .setResponseResult(EntityHandlerResult.OK);
-                            ocResourceResponse
-                                    .setErrorCode(StringConstants.ERROR_CODE);
                             ocResourceResponse.setResourceRepresentation(get());
                             OcPlatform.sendResponse(ocResourceResponse);
                             break;
@@ -167,8 +165,6 @@ public class TemperatureResource implements IMessageLogger {
                             OcRepresentation rep = request
                                     .getResourceRepresentation();
                             put(rep);
-                            ocResourceResponse
-                                    .setErrorCode(StringConstants.ERROR_CODE);
                             ocResourceResponse
                                     .setResponseResult(EntityHandlerResult.OK);
                             ocResourceResponse.setResourceRepresentation(get());
@@ -229,7 +225,6 @@ public class TemperatureResource implements IMessageLogger {
             // if observationList is not empty, call notifyListOfObservers
             if (mObservationIds.size() > 0) {
                 OcResourceResponse ocResourceResponse = new OcResourceResponse();
-                ocResourceResponse.setErrorCode(StringConstants.ERROR_CODE);
                 ocResourceResponse.setResponseResult(EntityHandlerResult.OK);
                 OcRepresentation r = get();
                 ocResourceResponse.setResourceRepresentation(r,
index bb99443..928bf8d 100644 (file)
@@ -239,7 +239,6 @@ OCEntityHandlerResult entityHandler(std::shared_ptr< OCResourceRequest > request
             {
                 cout << "\t\trequestType : GET\n";
 
-                pResponse->setErrorCode(200);
                 pResponse->setResponseResult(OC_EH_OK);
                 pResponse->setResourceRepresentation(myResource.get());
                 if (OC_STACK_OK == OCPlatform::sendResponse(pResponse))
@@ -257,7 +256,6 @@ OCEntityHandlerResult entityHandler(std::shared_ptr< OCResourceRequest > request
 
                 if (pResponse)
                 {
-                    pResponse->setErrorCode(200);
                     pResponse->setResourceRepresentation(myResource.get());
                 }
                 if (OC_STACK_OK == OCPlatform::sendResponse(pResponse))
@@ -278,7 +276,6 @@ OCEntityHandlerResult entityHandler(std::shared_ptr< OCResourceRequest > request
 
                 if (pResponse)
                 {
-                    pResponse->setErrorCode(200);
                     pResponse->setResourceRepresentation(myResource.get());
                 }
                 if (OC_STACK_OK == OCPlatform::sendResponse(pResponse))
@@ -299,7 +296,6 @@ OCEntityHandlerResult entityHandler(std::shared_ptr< OCResourceRequest > request
                 if (myResource.deleteDeviceResource() == OC_STACK_OK)
                 {
                     cout << "\tSuccess DELETE\n";
-                    pResponse->setErrorCode(200);
                     pResponse->setResponseResult(OC_EH_RESOURCE_DELETED);
                     ehResult = OC_EH_OK;
                 }
index 4f6a3c7..e21b4db 100755 (executable)
@@ -208,7 +208,6 @@ private:
                     }
                     else // normal response case.
                     {
-                        pResponse->setErrorCode(200);
                         pResponse->setResponseResult(OC_EH_OK);
                         pResponse->setResourceRepresentation(get());
                         if (OC_STACK_OK == OCPlatform::sendResponse(pResponse))
@@ -225,7 +224,6 @@ private:
                     // Do related operations related to PUT request
                     // Update the lightResource
                     put(rep);
-                    pResponse->setErrorCode(200);
                     pResponse->setResponseResult(OC_EH_OK);
                     pResponse->setResourceRepresentation(get());
                     if (OC_STACK_OK == OCPlatform::sendResponse(pResponse))
@@ -242,7 +240,6 @@ private:
                     // Do related operations related to POST request
                     OCRepresentation rep_post = post(rep);
                     pResponse->setResourceRepresentation(rep_post);
-                    pResponse->setErrorCode(200);
                     if (rep_post.hasAttribute("createduri"))
                     {
                         pResponse->setResponseResult(OC_EH_RESOURCE_CREATED);
@@ -282,7 +279,6 @@ void * handleSlowResponse(void *param, std::shared_ptr< OCResourceRequest > pReq
     pResponse->setRequestHandle(pRequest->getRequestHandle());
     pResponse->setResourceHandle(pRequest->getResourceHandle());
     pResponse->setResourceRepresentation(fanPtr->get());
-    pResponse->setErrorCode(200);
     pResponse->setResponseResult(OC_EH_OK);
 
     // Set the slow response flag back to false
index 45ae0f0..58b515c 100755 (executable)
@@ -208,7 +208,6 @@ private:
                     }
                     else // normal response case.
                     {
-                        pResponse->setErrorCode(200);
                         pResponse->setResponseResult(OC_EH_OK);
                         pResponse->setResourceRepresentation(get());
                         if (OC_STACK_OK == OCPlatform::sendResponse(pResponse))
@@ -225,7 +224,6 @@ private:
                     // Do related operations related to PUT request
                     // Update the lightResource
                     put(rep);
-                    pResponse->setErrorCode(200);
                     pResponse->setResponseResult(OC_EH_OK);
                     pResponse->setResourceRepresentation(get());
                     if (OC_STACK_OK == OCPlatform::sendResponse(pResponse))
@@ -242,7 +240,6 @@ private:
                     // Do related operations related to POST request
                     OCRepresentation rep_post = post(rep);
                     pResponse->setResourceRepresentation(rep_post);
-                    pResponse->setErrorCode(200);
                     if (rep_post.hasAttribute("createduri"))
                     {
                         pResponse->setResponseResult(OC_EH_RESOURCE_CREATED);
@@ -282,7 +279,6 @@ void * handleSlowResponse(void *param, std::shared_ptr< OCResourceRequest > pReq
     pResponse->setRequestHandle(pRequest->getRequestHandle());
     pResponse->setResourceHandle(pRequest->getResourceHandle());
     pResponse->setResourceRepresentation(lightPtr->get());
-    pResponse->setErrorCode(200);
     pResponse->setResponseResult(OC_EH_OK);
 
     // Set the slow response flag back to false
index f7b1a2a..56c88d9 100755 (executable)
@@ -500,7 +500,6 @@ std::shared_ptr<OC::OCResourceResponse> SimulatorCollectionResourceImpl::request
         // Construct the representation
         OC::OCRepresentation ocRep = m_resModel.asOCRepresentation();
         response = std::make_shared<OC::OCResourceResponse>();
-        response->setErrorCode(200);
         response->setResponseResult(OC_EH_OK);
         response->setResourceRepresentation(ocRep);
         std::string resPayload = getPayloadString(ocRep);
@@ -542,7 +541,6 @@ std::shared_ptr<OC::OCResourceResponse> SimulatorCollectionResourceImpl::request
         response = std::make_shared<OC::OCResourceResponse>();
         response->setRequestHandle(request->getRequestHandle());
         response->setResourceHandle(request->getResourceHandle());
-        response->setErrorCode(200);
         response->setResponseResult(OC_EH_OK);
         response->setResourceRepresentation(ocRep);
         std::string resPayload = getPayloadString(ocRep);
@@ -563,7 +561,6 @@ void SimulatorCollectionResourceImpl::sendNotification(OC::ObservationIds &obser
 {
     std::lock_guard<std::recursive_mutex> lock(m_objectLock);
     std::shared_ptr<OC::OCResourceResponse> response(new OC::OCResourceResponse());
-    response->setErrorCode(200);
     response->setResponseResult(OC_EH_OK);
 
     OC::OCRepresentation ocRep = m_resModel.asOCRepresentation();
@@ -637,7 +634,6 @@ OCEntityHandlerResult SimulatorCollectionResourceImpl::sendResponse(
     std::shared_ptr<OC::OCResourceResponse> response(new OC::OCResourceResponse());
     response->setRequestHandle(request->getRequestHandle());
     response->setResourceHandle(request->getResourceHandle());
-    response->setErrorCode(errorCode);
     response->setResponseResult(responseResult);
     if (OC_STACK_OK != OC::OCPlatform::sendResponse(response))
     {
@@ -666,4 +662,4 @@ bool SimulatorCollectionResourceImpl::isValidInterface(const std::string &interf
     }
 
     return true;
-}
\ No newline at end of file
+}
index 2539d22..44023a3 100755 (executable)
@@ -605,7 +605,6 @@ void SimulatorSingleResourceImpl::notify(int observerID, const SimulatorResource
         return;
 
     std::shared_ptr<OC::OCResourceResponse> response(new OC::OCResourceResponse);
-    response->setErrorCode(200);
     response->setResponseResult(OC_EH_OK);
     response->setResourceRepresentation(resModel.asOCRepresentation(), m_interfaces[0]);
 
@@ -629,7 +628,6 @@ void SimulatorSingleResourceImpl::notifyAll(const SimulatorResourceModel &resMod
         return;
 
     std::shared_ptr<OC::OCResourceResponse> response(new OC::OCResourceResponse);
-    response->setErrorCode(200);
     response->setResponseResult(OC_EH_OK);
     response->setResourceRepresentation(resModel.asOCRepresentation(), m_interfaces[0]);
 
@@ -933,7 +931,6 @@ OCEntityHandlerResult SimulatorSingleResourceImpl::sendResponse(
     std::shared_ptr<OC::OCResourceResponse> response(new OC::OCResourceResponse());
     response->setRequestHandle(request->getRequestHandle());
     response->setResourceHandle(request->getResourceHandle());
-    response->setErrorCode(errorCode);
     response->setResponseResult(responseResult);
     if (OC_STACK_OK != OC::OCPlatform::sendResponse(response))
     {
@@ -956,7 +953,6 @@ OCEntityHandlerResult SimulatorSingleResourceImpl::sendResponse(
     std::shared_ptr<OC::OCResourceResponse> response(new OC::OCResourceResponse());
     response->setRequestHandle(request->getRequestHandle());
     response->setResourceHandle(request->getResourceHandle());
-    response->setErrorCode(errorCode);
     response->setResponseResult(responseResult);
     response->setResourceRepresentation(payload, interfaceType);
     if (OC_STACK_OK != OC::OCPlatform::sendResponse(response))
index ab4bcab..6e12f0e 100755 (executable)
@@ -280,7 +280,6 @@ public class ConfigurationServer {
             rep = mntResource.getDiagnosticsRepresentation();
         }
         response.setResourceRepresentation(rep, OcPlatform.DEFAULT_INTERFACE);
-        response.setErrorCode(200);
 
         try {
             OcPlatform.sendResponse(response);
index 5ae9782..88d76e7 100755 (executable)
@@ -162,7 +162,6 @@ OCStackResult sendResponse(std::shared_ptr< OCResourceRequest > pRequest)
     pResponse->setRequestHandle(pRequest->getRequestHandle());
     pResponse->setResourceHandle(pRequest->getResourceHandle());
     pResponse->setResourceRepresentation(myBootstrapResource.getBootstrapRepresentation());
-    pResponse->setErrorCode(200);
     pResponse->setResponseResult(OC_EH_OK);
 
     return OCPlatform::sendResponse(pResponse);
index 60dc232..2039ae6 100755 (executable)
@@ -185,7 +185,6 @@ OCStackResult sendResponseForResource(std::shared_ptr< OCResourceRequest > pRequ
         pResponse->setResourceRepresentation(rep, DEFAULT_INTERFACE);
     }
 
-    pResponse->setErrorCode(200);
     pResponse->setResponseResult(OC_EH_OK);
 
     return OCPlatform::sendResponse(pResponse);
index 88d223d..b22add2 100644 (file)
@@ -198,7 +198,6 @@ OCStackResult sendResponseForResource(std::shared_ptr< OCResourceRequest > pRequ
         pResponse->setResourceRepresentation(rep, DEFAULT_INTERFACE);
     }
 
-    pResponse->setErrorCode(200);
     pResponse->setResponseResult(OC_EH_OK);
 
     return OCPlatform::sendResponse(pResponse);
index e12ebab..97030b6 100755 (executable)
@@ -218,7 +218,6 @@ private:
                     }
                     else
                     {
-                        pResponse->setErrorCode(200);
                         pResponse->setResponseResult(OC_EH_OK);
                         pResponse->setResourceRepresentation(get());
                         if (OC_STACK_OK == OCPlatform::sendResponse(pResponse))
@@ -232,7 +231,6 @@ private:
                     cout << "\t\t\trequestType : PUT\n";
                     OCRepresentation rep = request->getResourceRepresentation();
                     put(rep);
-                    pResponse->setErrorCode(200);
                     pResponse->setResponseResult(OC_EH_OK);
                     pResponse->setResourceRepresentation(rep);
                     if (OC_STACK_OK == OCPlatform::sendResponse(pResponse))
@@ -248,7 +246,6 @@ private:
                     OCRepresentation rep_post = post(rep);
 
                     pResponse->setResourceRepresentation(rep_post);
-                    pResponse->setErrorCode(200);
                     if (rep_post.hasAttribute("createduri"))
                     {
                         pResponse->setResponseResult(OC_EH_RESOURCE_CREATED);
@@ -283,7 +280,6 @@ void *handleSlowResponse(void *param, std::shared_ptr< OCResourceRequest > pRequ
     pResponse->setRequestHandle(pRequest->getRequestHandle());
     pResponse->setResourceHandle(pRequest->getResourceHandle());
     pResponse->setResourceRepresentation(lightPtr->get());
-    pResponse->setErrorCode(200);
     pResponse->setResponseResult(OC_EH_OK);
 
     isSlowResponse = false;
@@ -677,7 +673,6 @@ OCStackResult sendResponseForResource(std::shared_ptr< OCResourceRequest > pRequ
         pResponse->setResourceRepresentation(rep, DEFAULT_INTERFACE);
     }
 
-    pResponse->setErrorCode(200);
     pResponse->setResponseResult(OC_EH_OK);
 
     return OCPlatform::sendResponse(pResponse);
@@ -818,7 +813,6 @@ OCStackResult sendResponse(std::shared_ptr< OCResourceRequest > pRequest)
     pResponse->setRequestHandle(pRequest->getRequestHandle());
     pResponse->setResourceHandle(pRequest->getResourceHandle());
     pResponse->setResourceRepresentation(myBootstrapResource.getBootstrapRepresentation());
-    pResponse->setErrorCode(200);
     pResponse->setResponseResult(OC_EH_OK);
 
     return OCPlatform::sendResponse(pResponse);