ocpayload: Adding OCByteString support in representation
authorPhilippe Coval <philippe.coval@osg.samsung.com>
Fri, 1 Jul 2016 20:36:36 +0000 (22:36 +0200)
committerUze Choi <uzchoi@samsung.com>
Fri, 30 Sep 2016 07:34:26 +0000 (07:34 +0000)
commit48aa060db9fda67e8f040d79f6ae648d463cba75
tree444b56d3225c4bfb16d6438eb9c03b5735117911
parent7a83e5a41a2bf0508e46cbb9c2f992bb55c8606b
ocpayload: Adding OCByteString support in representation

Add Bytestring handling in OCRepPayloadClone()
 along arrays/vectors of them.

Also added in native java (JNI) part for android
 inspired by existing code, note for later,
 original code might be double checked for potential MLK
 regarding local references to allocated objects within loops.
 Maybe those unref are not mandatory
 as they "are freed automatically after the native method returns."
 http://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/functions.html

Improved tests, it is assumed that contents of OCByteString
 are not duplicated when not wanted,
 plus style cleanup on surrounding code.

Note of my understanding of this design mixing C++ and C paradigms :

 - As OCByteString is a C structure there is no destructor
 - If assigned (no deep copy) into Payload class
   bytes will be freed by Payload's destructor as it "owns" it.
 - If contents are deep copied anywhere else
   then bytes should be also freed manually
   (in other classes' destructor ? like Payload).

Bug: https://jira.iotivity.org/browse/IOT-983
Change-Id: Icfa0657df9b332b4d11b737731636c8fb2a80001
Credits-to: youngman <yman.jung@samsung.com>
Origin: https://gerrit.iotivity.org/gerrit/#/c/8931/
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/8931
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Dave Thaler <dthaler@microsoft.com>
(cherry picked from commit f2059ea75cb7f8966f59132fb05962b2f52e352b)
Reviewed-on: https://gerrit.iotivity.org/gerrit/12611
Reviewed-by: Uze Choi <uzchoi@samsung.com>
12 files changed:
android/android_api/base/jni/JniOcRepresentation.h
android/android_api/base/jni/JniOcStack.cpp
android/android_api/base/jni/JniOcStack.h
resource/csdk/octbstack_product.def
resource/csdk/stack/include/ocpayload.h
resource/csdk/stack/src/ocpayload.c
resource/csdk/stack/src/ocpayloadconvert.c
resource/include/AttributeValue.h
resource/include/OCRepresentation.h
resource/src/OCRepresentation.cpp
resource/unittests/OCRepresentationEncodingTest.cpp
resource/unittests/OCRepresentationTest.cpp