Commit a62b00f8 authored by George Nash's avatar George Nash Committed by Rick Bell

swig move oc_rep into its own interface

This reduces the size of the OCMain and removes
the need to prefix all of the code from oc_rep.h with the
prefix rep since they are now all part of the OCRep class.

Change-Id: Ib8954e3046c91dd9bcbaf7a737a5835f1be89498
Signed-off-by: George Nash's avatarGeorge Nash <george.nash@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/29405Tested-by: default avatarIoTivity Jenkins <jenkins-daemon@iotivity.org>
Reviewed-by: Larry Sachs's avatarLarry Sachs <larry.j.sachs@intel.com>
Reviewed-by: default avatarRick Bell <richard.s.bell@intel.com>
parent 5b61e7a2
......@@ -159,6 +159,10 @@ ${OBJDIR}/swig/oc_collection_wrap.o: ${SWIG_DIR}/oc_collection_wrap.c
@mkdir -p ${@D}
${CC} -c -o $@ $< ${CFLAGS} -I../ -DOC_CLIENT -DOC_SERVER
${OBJDIR}/swig/oc_rep_wrap.o: ${SWIG_DIR}/oc_rep_wrap.c
@mkdir -p ${@D}
${CC} -c -o $@ $< ${CFLAGS} -I../ -DOC_CLIENT -DOC_SERVER
${OBJDIR}/swig/oc_obt_wrap.o: ${SWIG_DIR}/oc_obt_wrap.c
@mkdir -p ${@D}
${CC} -c -o $@ $< ${CFLAGS} -I../ -DOC_CLIENT -DOC_SERVER
......
......@@ -175,6 +175,7 @@
<ClCompile Include="..\..\..\..\swig\java_lang\oc_clock_wrap.c" />
<ClCompile Include="..\..\..\..\swig\java_lang\oc_collection_wrap.c" />
<ClCompile Include="..\..\..\..\swig\java_lang\oc_obt_wrap.c" />
<ClCompile Include="..\..\..\..\swig\java_lang\oc_rep_wrap.c" />
<ClCompile Include="..\..\..\..\swig\java_lang\oc_storage_wrap.c" />
<ClCompile Include="..\..\..\..\swig\java_lang\oc_uuid_wrap.c" />
</ItemGroup>
......
......@@ -5,6 +5,7 @@ import org.iotivity.OCClientResponse;
import org.iotivity.OCMain;
import org.iotivity.OCQos;
import org.iotivity.OCRepresentation;
import org.iotivity.OCRep;
import org.iotivity.OCResponseHandler;
public class GetLightResponseHandler implements OCResponseHandler {
......@@ -46,10 +47,10 @@ public class GetLightResponseHandler implements OCResponseHandler {
PutLightResponseHandler putLight = new PutLightResponseHandler(activity, light);
if (OCMain.initPut(light.serverUri, light.serverEndpoint, null, putLight, OCQos.LOW_QOS)) {
CborEncoder root = OCMain.repBeginRootObject();
OCMain.repSetBoolean(root, "state", true);
OCMain.repSetLong(root, "power", 15);
OCMain.repEndRootObject();
CborEncoder root = OCRep.beginRootObject();
OCRep.setBoolean(root, "state", true);
OCRep.setLong(root, "power", 15);
OCRep.endRootObject();
if (OCMain.doPut()) {
activity.msg("\tSent PUT request");
......
......@@ -5,6 +5,7 @@ import org.iotivity.OCClientResponse;
import org.iotivity.OCMain;
import org.iotivity.OCQos;
import org.iotivity.OCStatus;
import org.iotivity.OCRep;
import org.iotivity.OCResponseHandler;
public class PostLightResponseHandler implements OCResponseHandler {
......@@ -33,10 +34,10 @@ public class PostLightResponseHandler implements OCResponseHandler {
Post2LightResponseHandler postLight = new Post2LightResponseHandler(activity, light);
if (OCMain.initPost(light.serverUri, light.serverEndpoint, null, postLight, OCQos.LOW_QOS)) {
CborEncoder root = OCMain.repBeginRootObject();
OCMain.repSetBoolean(root, "state", true);
OCMain.repSetLong(root, "power", 55);
OCMain.repEndRootObject();
CborEncoder root = OCRep.beginRootObject();
OCRep.setBoolean(root, "state", true);
OCRep.setLong(root, "power", 55);
OCRep.endRootObject();
if (OCMain.doPost()) {
activity.msg("\tSent POST2 request");
......
......@@ -5,6 +5,7 @@ import org.iotivity.OCClientResponse;
import org.iotivity.OCMain;
import org.iotivity.OCQos;
import org.iotivity.OCStatus;
import org.iotivity.OCRep;
import org.iotivity.OCResponseHandler;
public class PutLightResponseHandler implements OCResponseHandler {
......@@ -31,10 +32,10 @@ public class PutLightResponseHandler implements OCResponseHandler {
PostLightResponseHandler postLight = new PostLightResponseHandler(activity, light);
if (OCMain.initPost(light.serverUri, light.serverEndpoint, null, postLight, OCQos.LOW_QOS)) {
CborEncoder root = OCMain.repBeginRootObject();
OCMain.repSetBoolean(root, "state", false);
OCMain.repSetLong(root, "power", 105);
OCMain.repEndRootObject();
CborEncoder root = OCRep.beginRootObject();
OCRep.setBoolean(root, "state", false);
OCRep.setLong(root, "power", 105);
OCRep.endRootObject();
if (OCMain.doPost()) {
activity.msg("\tSent POST request");
......
......@@ -5,6 +5,7 @@ import android.util.Log;
import org.iotivity.CborEncoder;
import org.iotivity.OCInterfaceMask;
import org.iotivity.OCMain;
import org.iotivity.OCRep;
import org.iotivity.OCRequest;
import org.iotivity.OCRequestHandler;
import org.iotivity.OCStatus;
......@@ -32,22 +33,22 @@ public class GetLightRequestHandler implements OCRequestHandler {
activity.msg("\t" + light.name + ", " + light.power + ", " + light.state);
activity.printLine();
CborEncoder root = OCMain.repBeginRootObject();
CborEncoder root = OCRep.beginRootObject();
switch (interfaces) {
case OCInterfaceMask.BASELINE: {
OCMain.processBaselineInterface(request.getResource());
break;
}
case OCInterfaceMask.RW: {
OCMain.repSetBoolean(root, "state", light.state);
OCMain.repSetLong(root, "power", light.power);
OCMain.repSetTextString(root, "name", light.name);
OCRep.setBoolean(root, "state", light.state);
OCRep.setLong(root, "power", light.power);
OCRep.setTextString(root, "name", light.name);
break;
}
default:
break;
}
OCMain.repEndRootObject();
OCRep.endRootObject();
OCMain.sendResponse(request, OCStatus.OC_STATUS_OK);
}
}
......@@ -4,8 +4,10 @@ import org.iotivity.CborEncoder;
import org.iotivity.OCClientResponse;
import org.iotivity.OCMain;
import org.iotivity.OCQos;
import org.iotivity.OCRep;
import org.iotivity.OCRepresentation;
import org.iotivity.OCResponseHandler;
import org.iotivity.OCType;
public class GetLightResponseHandler implements OCResponseHandler {
......@@ -35,10 +37,10 @@ public class GetLightResponseHandler implements OCResponseHandler {
PutLightResponseHandler putLight = new PutLightResponseHandler();
if (OCMain.initPut(Light.serverUri, Light.serverEndpoint, null, putLight, OCQos.LOW_QOS)) {
CborEncoder root = OCMain.repBeginRootObject();
OCMain.repSetBoolean(root, "state", true);
OCMain.repSetLong(root, "power", 15);
OCMain.repEndRootObject();
CborEncoder root = OCRep.beginRootObject();
OCRep.setBoolean(root, "state", true);
OCRep.setLong(root, "power", 15);
OCRep.endRootObject();
if (OCMain.doPut()) {
System.out.println("\tSent PUT request");
......
......@@ -3,6 +3,7 @@ package java_lite_simple_client;
import org.iotivity.OCClientResponse;
import org.iotivity.OCRepresentation;
import org.iotivity.OCResponseHandler;
import org.iotivity.OCType;
public class ObserveLightResponseHandler implements OCResponseHandler {
......
......@@ -4,6 +4,7 @@ import org.iotivity.CborEncoder;
import org.iotivity.OCClientResponse;
import org.iotivity.OCMain;
import org.iotivity.OCQos;
import org.iotivity.OCRep;
import org.iotivity.OCStatus;
import org.iotivity.OCResponseHandler;
......@@ -22,10 +23,10 @@ public class PostLightResponseHandler implements OCResponseHandler {
Post2LightResponseHandler postLight = new Post2LightResponseHandler();
if (OCMain.initPost(Light.serverUri, Light.serverEndpoint, null, postLight, OCQos.LOW_QOS)) {
CborEncoder root = OCMain.repBeginRootObject();
OCMain.repSetBoolean(root, "state", true);
OCMain.repSetLong(root, "power", 55);
OCMain.repEndRootObject();
CborEncoder root = OCRep.beginRootObject();
OCRep.setBoolean(root, "state", true);
OCRep.setLong(root, "power", 55);
OCRep.endRootObject();
if (OCMain.doPost()) {
System.out.println("\tSent POST2 request");
......
......@@ -4,6 +4,7 @@ import org.iotivity.CborEncoder;
import org.iotivity.OCClientResponse;
import org.iotivity.OCMain;
import org.iotivity.OCQos;
import org.iotivity.OCRep;
import org.iotivity.OCStatus;
import org.iotivity.OCResponseHandler;
......@@ -20,10 +21,10 @@ public class PutLightResponseHandler implements OCResponseHandler {
PostLightResponseHandler postLight = new PostLightResponseHandler();
if (OCMain.initPost(Light.serverUri, Light.serverEndpoint, null, postLight, OCQos.LOW_QOS)) {
CborEncoder root = OCMain.repBeginRootObject();
OCMain.repSetBoolean(root, "state", false);
OCMain.repSetLong(root, "power", 105);
OCMain.repEndRootObject();
CborEncoder root = OCRep.beginRootObject();
OCRep.setBoolean(root, "state", false);
OCRep.setLong(root, "power", 105);
OCRep.endRootObject();
if (OCMain.doPost()) {
System.out.println("\tSent POST request");
......
......@@ -3,6 +3,7 @@ package java_lite_simple_server;
import org.iotivity.CborEncoder;
import org.iotivity.OCInterfaceMask;
import org.iotivity.OCMain;
import org.iotivity.OCRep;
import org.iotivity.OCRequest;
import org.iotivity.OCStatus;
import org.iotivity.OCRequestHandler;
......@@ -15,21 +16,21 @@ public class GetCounter implements OCRequestHandler {
Counter.count++;
System.out.println("GET COUNTER:");
CborEncoder root = OCMain.repBeginRootObject();
CborEncoder root = OCRep.beginRootObject();
switch (interfaces) {
case OCInterfaceMask.BASELINE: {
OCMain.processBaselineInterface(request.getResource());
/* fall through */
}
case OCInterfaceMask.R: {
OCMain.repSetLong(root, "count", Counter.count);
OCMain.repSetTextString(root, "name", Counter.name);
OCRep.setLong(root, "count", Counter.count);
OCRep.setTextString(root, "name", Counter.name);
break;
}
default:
break;
}
OCMain.repEndRootObject();
OCRep.endRootObject();
OCMain.sendResponse(request, OCStatus.OC_STATUS_OK);
}
}
......@@ -3,6 +3,7 @@ package java_lite_simple_server;
import org.iotivity.CborEncoder;
import org.iotivity.OCInterfaceMask;
import org.iotivity.OCMain;
import org.iotivity.OCRep;
import org.iotivity.OCRequest;
import org.iotivity.OCStatus;
import org.iotivity.OCRequestHandler;
......@@ -14,22 +15,22 @@ public class GetLight implements OCRequestHandler {
System.out.println("Inside the GetLight RequestHandler");
Light.power++;
System.out.println("GET LIGHT:");
CborEncoder root = OCMain.repBeginRootObject();
CborEncoder root = OCRep.beginRootObject();
switch (interfaces) {
case OCInterfaceMask.BASELINE: {
OCMain.processBaselineInterface(request.getResource());
/* fall through */
}
case OCInterfaceMask.RW: {
OCMain.repSetBoolean(root, "state", Light.state);
OCMain.repSetLong(root, "power", Light.power);
OCMain.repSetTextString(root, "name", Light.name);
OCRep.setBoolean(root, "state", Light.state);
OCRep.setLong(root, "power", Light.power);
OCRep.setTextString(root, "name", Light.name);
break;
}
default:
break;
}
OCMain.repEndRootObject();
OCRep.endRootObject();
OCMain.sendResponse(request, OCStatus.OC_STATUS_OK);
}
}
......@@ -2,10 +2,12 @@ package java_lite_simple_server;
import org.iotivity.CborEncoder;
import org.iotivity.OCMain;
import org.iotivity.OCRep;
import org.iotivity.OCRequest;
import org.iotivity.OCRequestHandler;
import org.iotivity.OCRepresentation;
import org.iotivity.OCStatus;
import org.iotivity.OCType;
public class PostCounter implements OCRequestHandler {
......@@ -35,9 +37,9 @@ public class PostCounter implements OCRequestHandler {
rep = rep.getNext();
}
CborEncoder root = OCMain.repBeginRootObject();
OCMain.repSetLong(root, "count", Counter.count);
OCMain.repEndRootObject();
CborEncoder root = OCRep.beginRootObject();
OCRep.setLong(root, "count", Counter.count);
OCRep.endRootObject();
OCMain.sendResponse(request, OCStatus.OC_STATUS_CHANGED);
}
......
......@@ -2,6 +2,7 @@ package java_lite_simple_server;
import org.iotivity.CborEncoder;
import org.iotivity.OCMain;
import org.iotivity.OCRep;
import org.iotivity.OCRequest;
import org.iotivity.OCRequestHandler;
import org.iotivity.OCRepresentation;
......@@ -39,10 +40,10 @@ public class PostLight implements OCRequestHandler {
rep = rep.getNext();
}
CborEncoder root = OCMain.repBeginRootObject();
OCMain.repSetBoolean(root, "state", Light.state);
OCMain.repSetLong(root, "power", Light.power);
OCMain.repEndRootObject();
CborEncoder root = OCRep.beginRootObject();
OCRep.setBoolean(root, "state", Light.state);
OCRep.setLong(root, "power", Light.power);
OCRep.endRootObject();
OCMain.sendResponse(request, OCStatus.OC_STATUS_CHANGED);
}
......
......@@ -8,26 +8,26 @@ import org.junit.Test;
public class OCRepresentationTest {
@Test
public void testType() {
OCRepresentation req = new OCRepresentation();
assertNotNull(req);
req.setType(OCType.OC_REP_INT);
assertEquals(OCType.OC_REP_INT, req.getType());
OCRepresentation rep = new OCRepresentation();
assertNotNull(rep);
rep.setType(OCType.OC_REP_INT);
assertEquals(OCType.OC_REP_INT, rep.getType());
}
@Test
public void testNext() {
OCRepresentation req1 = new OCRepresentation();
OCRepresentation req2 = new OCRepresentation();
OCRepresentation req3 = new OCRepresentation();
assertNotNull(req1);
assertNotNull(req2);
assertNotNull(req3);
req1.setName("one");
req2.setName("two");
req3.setName("three");
req1.setNext(req2);
req1.getNext().setNext(req3);
OCRepresentation r = req1;
OCRepresentation rep1 = new OCRepresentation();
OCRepresentation rep2 = new OCRepresentation();
OCRepresentation rep3 = new OCRepresentation();
assertNotNull(rep1);
assertNotNull(rep2);
assertNotNull(rep3);
rep1.setName("one");
rep2.setName("two");
rep3.setName("three");
rep1.setNext(rep2);
rep1.getNext().setNext(rep3);
OCRepresentation r = rep1;
assertEquals("one", r.getName());
r = r.getNext();
assertNotNull(r);
......@@ -41,20 +41,20 @@ public class OCRepresentationTest {
@Test
public void testName() {
OCRepresentation req = new OCRepresentation();
assertNotNull(req);
req.setName("Sam");
assertEquals("Sam", req.getName());
OCRepresentation rep = new OCRepresentation();
assertNotNull(rep);
rep.setName("Sam");
assertEquals("Sam", rep.getName());
}
@Test
public void testValue() {
OCRepresentation req = new OCRepresentation();
assertNotNull(req);
OCRepresentation rep = new OCRepresentation();
assertNotNull(rep);
OCValue v = new OCValue();
v.setString("happy dog");
req.setValue(v);
assertEquals("happy dog", req.getValue().getString());
rep.setValue(v);
assertEquals("happy dog", rep.getValue().getString());
}
@Test
......@@ -107,37 +107,37 @@ public class OCRepresentationTest {
@Test
public void testValueArray() {
OCMain.repNewBuffer(1024);
OCRep.newBuffer(1024);
CborEncoder root = OCMain.repBeginRootObject();
assertEquals(0, OCMain.repGetCborErrno());
CborEncoder root = OCRep.beginRootObject();
assertEquals(0, OCRep.getCborErrno());
assertNotNull(root);
long fib[] = {1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89};
OCMain.repSetLongArray(root, "fibonacci", fib);
assertEquals(0, OCMain.repGetCborErrno());
OCRep.setLongArray(root, "fibonacci", fib);
assertEquals(0, OCRep.getCborErrno());
boolean barray[] = {false, false, true, false, false};
OCMain.repSetBooleanArray(root, "flips", barray);
assertEquals(0, OCMain.repGetCborErrno());
OCRep.setBooleanArray(root, "flips", barray);
assertEquals(0, OCRep.getCborErrno());
double mathConstants[] = {3.1415926535, 2.71828, 1.4142135, 1.618033};
OCMain.repSetDoubleArray(root, "math_constants", mathConstants);
assertEquals(0, OCMain.repGetCborErrno());
OCRep.setDoubleArray(root, "math_constants", mathConstants);
assertEquals(0, OCRep.getCborErrno());
String lorem_ipsum[] = {"Lorem", "ipsum", "dolor", "sit", "amet",
"consectetur", "adipiscing", "elit.", "Sed",
"nec", "feugiat", "odio.", "Donec."};
OCMain.repSetStringArray(root, "lorem_ipsum", lorem_ipsum);
assertEquals(0, OCMain.repGetCborErrno());
OCMain.repEndRootObject();
assertEquals(0, OCMain.repGetCborErrno());
OCRep.setStringArray(root, "lorem_ipsum", lorem_ipsum);
assertEquals(0, OCRep.getCborErrno());
OCRep.endRootObject();
assertEquals(0, OCRep.getCborErrno());
OCRepresentation rep = OCMain.repGetOCRepresentaionFromRootObject();
OCRepresentation rep = OCRep.getOCRepresentaionFromRootObject();
assertNotNull(rep);
//OCArray to int array
assertEquals(OCType.OC_REP_INT_ARRAY, rep.getType());
assertTrue(rep.getName().equals("fibonacci"));
assertNotNull(rep.getValue().getArray());
assertEquals(fib.length, OCMain.ocArrayToLongArray(rep.getValue().getArray()).length);
assertArrayEquals(fib, OCMain.ocArrayToLongArray(rep.getValue().getArray()));
assertEquals(fib.length, OCRep.ocArrayToLongArray(rep.getValue().getArray()).length);
assertArrayEquals(fib, OCRep.ocArrayToLongArray(rep.getValue().getArray()));
rep = rep.getNext();
assertNotNull(rep);
......@@ -146,8 +146,8 @@ public class OCRepresentationTest {
assertEquals(OCType.OC_REP_BOOL_ARRAY, rep.getType());
assertTrue(rep.getName().equals("flips"));
assertNotNull(rep.getValue().getArray());
assertEquals(barray.length, OCMain.ocArrayToBooleanArray(rep.getValue().getArray()).length);
assertArrayEquals(barray, OCMain.ocArrayToBooleanArray(rep.getValue().getArray()));
assertEquals(barray.length, OCRep.ocArrayToBooleanArray(rep.getValue().getArray()).length);
assertArrayEquals(barray, OCRep.ocArrayToBooleanArray(rep.getValue().getArray()));
rep = rep.getNext();
assertNotNull(rep);
......@@ -156,9 +156,9 @@ public class OCRepresentationTest {
assertEquals(OCType.OC_REP_DOUBLE_ARRAY, rep.getType());
assertTrue(rep.getName().equals("math_constants"));
assertNotNull(rep.getValue().getArray());
assertEquals(mathConstants.length, OCMain.ocArrayToDoubleArray(rep.getValue().getArray()).length);
assertArrayEquals(mathConstants, OCMain.ocArrayToDoubleArray(rep.getValue().getArray()), 0.0000001);
OCMain.repDeleteBuffer();
assertEquals(mathConstants.length, OCRep.ocArrayToDoubleArray(rep.getValue().getArray()).length);
assertArrayEquals(mathConstants, OCRep.ocArrayToDoubleArray(rep.getValue().getArray()), 0.0000001);
OCRep.deleteBuffer();
rep = rep.getNext();
assertNotNull(rep);
......@@ -167,17 +167,17 @@ public class OCRepresentationTest {
assertEquals(OCType.OC_REP_STRING_ARRAY, rep.getType());
assertTrue(rep.getName().equals("lorem_ipsum"));
assertNotNull(rep.getValue().getArray());
assertEquals(lorem_ipsum.length, OCMain.ocArrayToStringArray(rep.getValue().getArray()).length);
assertArrayEquals(lorem_ipsum, OCMain.ocArrayToStringArray(rep.getValue().getArray()));
assertEquals(lorem_ipsum.length, OCRep.ocArrayToStringArray(rep.getValue().getArray()).length);
assertArrayEquals(lorem_ipsum, OCRep.ocArrayToStringArray(rep.getValue().getArray()));
// TODO solve how to pass arrays of bytes.
// Note Object arrays not covered by the OCArray type
OCMain.repDeleteBuffer();
OCRep.deleteBuffer();
}
@Test
public void testValueObject() {
OCMain.repNewBuffer(1024);
OCRep.newBuffer(1024);
/*
* Create an OCRepresentation with the following
......@@ -187,18 +187,18 @@ public class OCRepresentationTest {
* "c": "three"
* }
*/
CborEncoder root = OCMain.repBeginRootObject();
assertEquals(0, OCMain.repGetCborErrno());
OCMain.repSetLong(root, "a", 1);
assertEquals(0, OCMain.repGetCborErrno());
OCMain.repSetBoolean(root, "b", false);
assertEquals(0, OCMain.repGetCborErrno());
OCMain.repSetTextString(root, "c", "three");
assertEquals(0, OCMain.repGetCborErrno());
OCMain.repEndRootObject();
assertEquals(0, OCMain.repGetCborErrno());
OCRepresentation rep = OCMain.repGetOCRepresentaionFromRootObject();
CborEncoder root = OCRep.beginRootObject();
assertEquals(0, OCRep.getCborErrno());
OCRep.setLong(root, "a", 1);
assertEquals(0, OCRep.getCborErrno());
OCRep.setBoolean(root, "b", false);
assertEquals(0, OCRep.getCborErrno());
OCRep.setTextString(root, "c", "three");
assertEquals(0, OCRep.getCborErrno());
OCRep.endRootObject();
assertEquals(0, OCRep.getCborErrno());
OCRepresentation rep = OCRep.getOCRepresentaionFromRootObject();
assertNotNull(rep);
OCValue v = new OCValue();
......@@ -225,21 +225,21 @@ public class OCRepresentationTest {
assertEquals("three", outObject.getValue().getString());
// Access values indirectly using repGet functions
Long a = OCMain.repGetLong(v.getObject(), "a");
Long a = OCRep.getLong(v.getObject(), "a");
assertNotNull(a);
assertEquals(1, a.longValue());
Boolean b = OCMain.repGetBoolean(v.getObject(), "b");
Boolean b = OCRep.getBoolean(v.getObject(), "b");
assertNotNull(b);
assertEquals(false, b.booleanValue());
String c = OCMain.repGetString(v.getObject(), "c");
String c = OCRep.getString(v.getObject(), "c");
assertNotNull(c);
assertTrue(c.equals("three"));
OCMain.repDeleteBuffer();
OCRep.deleteBuffer();
}
@Test
public void testValueObjectArray() {
OCMain.repNewBuffer(1024);
OCRep.newBuffer(1024);
/*
* NOTE Object Array is a misnomer when represented in json/cbor it
* is an array of objects. It is represented in code as a
......@@ -261,50 +261,50 @@ public class OCRepresentationTest {
* ]
*/
/* add values to root object */
CborEncoder root = OCMain.repBeginRootObject();
assertEquals(0, OCMain.repGetCborErrno());
CborEncoder space2001 = OCMain.repOpenArray(root, "space_2001");
assertEquals(0, OCMain.repGetCborErrno());
CborEncoder root = OCRep.beginRootObject();
assertEquals(0, OCRep.getCborErrno());
CborEncoder space2001 = OCRep.openArray(root, "space_2001");
assertEquals(0, OCRep.getCborErrno());
CborEncoder arrayItemObject;
arrayItemObject = OCMain.repObjectArrayBeginItem(space2001);
assertEquals(0, OCMain.repGetCborErrno());
OCMain.repSetTextString(arrayItemObject, "name", "Dave Bowman");
assertEquals(0, OCMain.repGetCborErrno());
OCMain.repSetTextString(arrayItemObject, "job", "astronaut");
assertEquals(0, OCMain.repGetCborErrno());
OCMain.repObjectArrayEndItem(space2001, arrayItemObject);