Updated some value of CAResponseResult_t
authorjihwan.seo <jihwan.seo@samsung.com>
Tue, 16 Jun 2015 12:02:00 +0000 (21:02 +0900)
committerErich Keane <erich.keane@intel.com>
Mon, 22 Jun 2015 13:47:10 +0000 (13:47 +0000)
- VALID, CHANGED, CONTENT value is added.
- sample app also updated.

Change-Id: I41a59a3659bf27eb1de368ca3404e5bd101c2ed1
Signed-off-by: jihwan.seo <jihwan.seo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1282
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Hyuna Jo <hyuna0213.jo@samsung.com>
Reviewed-by: Erich Keane <erich.keane@intel.com>
resource/csdk/connectivity/api/cacommon.h
resource/csdk/connectivity/samples/android/sample_service/src/org/iotivity/ca/service/MainActivity.java
resource/csdk/connectivity/samples/arduino/casample.cpp
resource/csdk/connectivity/samples/linux/sample_main.c
resource/csdk/connectivity/samples/tizen/casample.c
resource/csdk/connectivity/src/caremotehandler.c
resource/csdk/connectivity/test/ca_api_unittest.cpp

index 360ceb1..f821fba 100644 (file)
@@ -239,6 +239,9 @@ typedef enum
     CA_SUCCESS = 200,                /**< Success */
     CA_CREATED = 201,                /**< Created */
     CA_DELETED = 202,                /**< Deleted */
+    CA_VALID = 203,                  /**< Valid */
+    CA_CHANGED = 204,                /**< Changed */
+    CA_CONTENT = 205,                /**< Content */
     CA_BAD_REQ = 400,                /**< Bad Request */
     CA_UNAUTHORIZED_REQ = 401,       /**< Unauthorized Request */
     CA_BAD_OPT = 402,                /**< Bad Option */
index 249acf9..d3e2884 100644 (file)
@@ -33,9 +33,10 @@ public class MainActivity extends Activity {
 
     private final CharSequence[] mResponseResultCheckBoxItems = {
             ResponseResult.CA_SUCCESS.name(), ResponseResult.CA_CREATED.name(),
-            ResponseResult.CA_DELETED.name(), ResponseResult.CA_EMPTY.name(),
-            ResponseResult.CA_BAD_REQ.name(), ResponseResult.CA_BAD_OPT.name(),
-            ResponseResult.CA_NOT_FOUND.name(),
+            ResponseResult.CA_DELETED.name(), ResponseResult.CA_VALID.name(),
+            ResponseResult.CA_CHANGED.name(), ResponseResult.CA_CONTENT.name(),
+            ResponseResult.CA_EMPTY.name(), ResponseResult.CA_BAD_REQ.name(),
+            ResponseResult.CA_BAD_OPT.name(), ResponseResult.CA_NOT_FOUND.name(),
             ResponseResult.CA_INTERNAL_SERVER_ERROR.name(),
             ResponseResult.CA_RETRANSMIT_TIMEOUT.name() };
 
@@ -56,8 +57,8 @@ public class MainActivity extends Activity {
     };
 
     private enum ResponseResult {
-        CA_SUCCESS, CA_CREATED, CA_DELETED, CA_EMPTY, CA_BAD_REQ, CA_BAD_OPT,
-        CA_NOT_FOUND, CA_INTERNAL_SERVER_ERROR, CA_RETRANSMIT_TIMEOUT
+        CA_SUCCESS, CA_CREATED, CA_DELETED, CA_VALID, CA_CHANGED, CA_CONTENT, CA_EMPTY,
+        CA_BAD_REQ, CA_BAD_OPT, CA_NOT_FOUND, CA_INTERNAL_SERVER_ERROR, CA_RETRANSMIT_TIMEOUT
     }
 
     private boolean mCheckedItems[] = {
@@ -703,6 +704,18 @@ public class MainActivity extends Activity {
                                 .ordinal()) {
                             responseValue = 202;
                             DLog.v(TAG, "Response Value is CA_DELETED");
+                        } else if (selectedResponseValue == ResponseResult.CA_VALID
+                                .ordinal()) {
+                            responseValue = 203;
+                            DLog.v(TAG, "Response Value is CA_VALID");
+                        } else if (selectedResponseValue == ResponseResult.CA_CHANGED
+                                .ordinal()) {
+                            responseValue = 204;
+                            DLog.v(TAG, "Response Value is CA_CHANGED");
+                        } else if (selectedResponseValue == ResponseResult.CA_CONTENT
+                                .ordinal()) {
+                            responseValue = 205;
+                            DLog.v(TAG, "Response Value is CA_CONTENT");
                         } else if (selectedResponseValue == ResponseResult.CA_EMPTY
                                 .ordinal()) {
                             responseValue = 0;
index ee045de..13d18c1 100644 (file)
@@ -505,7 +505,7 @@ void SendNotification()
     strcpy(respondData.resourceUri, resourceUri);
 
     CAResponseInfo_t responseInfo = {CA_BAD_REQ, {CA_MSG_RESET}};
-    responseInfo.result = CA_SUCCESS;
+    responseInfo.result = CA_CONTENT;
     responseInfo.info = respondData;
 
     // send request
@@ -782,6 +782,9 @@ void SendResponse(CAEndpoint_t *endpoint, const CAInfo_t* info)
         Serial.println("Success: 200");
         Serial.println("Created: 201");
         Serial.println("Deleted: 202");
+        Serial.println("Valid  : 203");
+        Serial.println("Changed: 204");
+        Serial.println("Content: 205");
         Serial.println("BadReq : 400");
         Serial.println("BadOpt : 402");
         Serial.println("NotFnd : 404");
index 0bc9051..1a984ec 100644 (file)
@@ -99,7 +99,8 @@ static CAToken_t g_last_request_token = NULL;
 static const char SECURE_COAPS_PREFIX[] = "coaps://";
 static const char SECURE_INFO_DATA[] =
                                     "{\"oc\":[{\"href\":\"%s\",\"prop\":{\"rt\":[\"core.led\"],"
-                                     "\"if\":[\"oic.if.baseline\"],\"obs\":1,\"sec\":1,\"port\":%d}}]}";
+                                     "\"if\":[\"oic.if.baseline\"],\"obs\":1,\"sec\":1,\"port\":"
+                                     "%d}}]}";
 static const char NORMAL_INFO_DATA[] =
                                     "{\"oc\":[{\"href\":\"%s\",\"prop\":{\"rt\":[\"core.led\"],"
                                      "\"if\":[\"oic.if.baseline\"],\"obs\":1}}]}";
@@ -723,7 +724,7 @@ void send_notification()
     respondData.resourceUri = (CAURI_t)uri;
 
     CAResponseInfo_t responseInfo = { 0 };
-    responseInfo.result = CA_SUCCESS;
+    responseInfo.result = CA_CONTENT;
     responseInfo.info = respondData;
 
     // send request
@@ -1121,6 +1122,9 @@ void send_response(const CAEndpoint_t *endpoint, const CAInfo_t *info)
         printf("SUCCESS                  : 200\n");
         printf("CREATED                  : 201\n");
         printf("DELETED                  : 202\n");
+        printf("VALID                    : 203\n");
+        printf("CHANGED                  : 204\n");
+        printf("CONTENT                  : 205\n");
         printf("BAD_REQ                  : 400\n");
         printf("BAD_OPT                  : 402\n");
         printf("NOT_FOUND                : 404\n");
index 14cbccc..a38af20 100644 (file)
@@ -789,7 +789,7 @@ void send_notification()
     respondData.type = messageType;
 
     CAResponseInfo_t responseInfo = { 0 };
-    responseInfo.result = CA_SUCCESS;
+    responseInfo.result = CA_CONTENT;
     responseInfo.info = respondData;
 
     // send notification
@@ -1181,6 +1181,9 @@ void send_response(const CARemoteEndpoint_t *endpoint, const CAInfo_t *info)
         printf("SUCCESS                  : 200\n");
         printf("CREATED                  : 201\n");
         printf("DELETED                  : 202\n");
+        printf("VALID                    : 203\n");
+        printf("CHANGED                  : 204\n");
+        printf("CONTENT                  : 205\n");
         printf("BAD_REQ                  : 400\n");
         printf("BAD_OPT                  : 402\n");
         printf("NOT_FOUND                : 404\n");
index 73de3f1..df7e8f3 100644 (file)
@@ -147,6 +147,9 @@ CAResponseInfo_t *CACloneResponseInfo(const CAResponseInfo_t *rep)
         case CA_SUCCESS:
         case CA_CREATED:
         case CA_DELETED:
+        case CA_VALID:
+        case CA_CHANGED:
+        case CA_CONTENT:
         case CA_BAD_REQ:
         case CA_BAD_OPT:
         case CA_NOT_FOUND:
index 3fe49b2..da49d65 100644 (file)
@@ -321,7 +321,7 @@ TEST(SendResponseTest, DISABLED_TC_19_Positive_01)
     requestData.tokenLength = tokenLength;
 
     memset(&responseInfo, 0, sizeof(CAResponseInfo_t));
-    responseInfo.result = CA_SUCCESS;
+    responseInfo.result = CA_CONTENT;
     responseInfo.info = responseData;
 
     EXPECT_EQ(CA_STATUS_OK, CASendResponse(tempRep, &responseInfo));
@@ -347,7 +347,7 @@ TEST(SendResponseTest, DISABLED_TC_20_Negative_01)
     requestData.tokenLength = tokenLength;
 
     memset(&responseInfo, 0, sizeof(CAResponseInfo_t));
-    responseInfo.result = CA_SUCCESS;
+    responseInfo.result = CA_CONTENT;
     responseInfo.info = responseData;
 
     EXPECT_EQ(CA_STATUS_OK, CASendResponse(tempRep, &responseInfo));
@@ -391,7 +391,7 @@ TEST(SendNotificationTest, DISABLED_TC_22_Positive_01)
     requestData.tokenLength = tokenLength;
 
     memset(&responseInfo, 0, sizeof(CAResponseInfo_t));
-    responseInfo.result = CA_SUCCESS;
+    responseInfo.result = CA_CONTENT;
     responseInfo.info = responseData;
 
     EXPECT_EQ(CA_STATUS_OK, CASendNotification(tempRep, &responseInfo));