Added note in documentation for max payload length.
authorMandeep Shetty <mandeep.shetty@intel.com>
Wed, 15 Apr 2015 22:25:41 +0000 (15:25 -0700)
committerErich Keane <erich.keane@intel.com>
Mon, 20 Apr 2015 16:43:33 +0000 (16:43 +0000)
This addresses IOT-427.
We were not accounting for json suffixes and prefixes when constructing
in the stack. The C sample apps construct json repsonses too.
After discussions, changed the constants in ocstackconfig.h and
added a note in the documentation to inform api users of the affixes.

Change-Id: I790a6d837a3dabc0d1984cfeb5fb49ef881031e4
Signed-off-by: Mandeep Shetty <mandeep.shetty@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/743
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Doug Hudson <douglas.hudson@intel.com>
Reviewed-by: Erich Keane <erich.keane@intel.com>
resource/csdk/stack/include/internal/ocresourcehandler.h
resource/csdk/stack/include/ocstackconfig.h

index ab939fd..aecc032 100644 (file)
@@ -59,6 +59,8 @@
 
 /**
  * Common JSON string components used by the stack to build JSON strings.
+ * These details are exposed in ocstackconfig.h file in the form of documentation.
+ * Remember to update the documentation there if these are changed.
  */
 #define OC_JSON_PREFIX                     "{\"oc\":["
 #define OC_JSON_PREFIX_LEN                 (sizeof(OC_JSON_PREFIX) - 1)
index ad7c3da..ea6f90f 100644 (file)
 
 /**
  * Maximum length of the response supported by Server for any REST request.
+ * The actual repsonse length is 256 for Arduino and 1024 for other platforms.
+ * Note that the stack will add a prefix and suffix to the payload.
+ * Prefix : {"oc":[
+ * Suffix : ]}
+ * They have a combined size of 9 bytes.
  */
 #ifdef WITH_ARDUINO
-#define MAX_RESPONSE_LENGTH (256)
+#define MAX_RESPONSE_LENGTH (247)
 #else
-#define MAX_RESPONSE_LENGTH (1024)
+#define MAX_RESPONSE_LENGTH (1015)
 #endif
 
 /**