Adding return value support for enumeration (both Java and C++
[iot2.git] / iotjava / iotrmi / Java / sample / TestClass_Skeleton.java
index 9ff3b1833a83ac4e173c935ef637ec771bbfe618..73580a25e6735262e428ee4ebe07b21248ca139a 100644 (file)
@@ -226,9 +226,9 @@ public class TestClass_Skeleton implements TestClassInterface {
        }
 
 
-       public void handleEnum(EnumJ[] en) {
+       public EnumJ[] handleEnum(EnumJ[] en) {
 
-               tc.handleEnum(en);
+               return tc.handleEnum(en);
        }
 
 
@@ -240,7 +240,7 @@ public class TestClass_Skeleton implements TestClassInterface {
        }
 
 
-       public void ___handleEnum(int enumSize1) {
+       public void ___handleEnum(int enumSize1) throws IOException {
 
                Class<?>[] paramCls = new Class<?>[enumSize1];
                Class<?>[] paramClsVal = new Class<?>[enumSize1];
@@ -256,7 +256,18 @@ public class TestClass_Skeleton implements TestClassInterface {
                for (int i=0; i < enumSize1; i++) {
                        data[i] = enumJ[(int) paramObj[i]];
                }
-               tc.handleEnum(data);
+               // if void, just "handleEnum(data)"
+               // this is when we have return value EnumJ[]
+               EnumJ[] retEnum = handleEnum(data);
+               // Get length first
+               int enumSize2 = retEnum.length;
+               // Now send the array of integers
+               int[] retEnumInt = new int[enumSize2];
+               for (int i=0; i < enumSize2; i++) {
+                       retEnumInt[i] = retEnum[i].ordinal();
+               }
+               Object retObj = retEnumInt;
+               rmiObj.sendReturnObj(retObj);
        }