Adjusting and cleaning up ZigbeeTest to install Vigilia ZigBee gateway and devices.
[iot2.git] / iotjava / iotrmi / Java / sample / CallBack_CBSkeleton.java
1 package iotrmi.Java.sample;
2
3 import java.io.IOException;
4 import java.util.Set;
5 import java.util.Arrays;
6 import iotrmi.Java.IoTRMIObject;
7
8 public class CallBack_CBSkeleton implements CallBackInterface {
9
10         private int objectId = 0;       // Default value is 0
11         private CallBackInterface cb;
12
13
14         /**
15          * Constructors
16          */
17         public CallBack_CBSkeleton(CallBackInterface _cb, int _objectId) throws
18                 ClassNotFoundException, InstantiationException,
19                         IllegalAccessException, IOException {
20
21                 cb = _cb;
22                 objectId = _objectId;
23                 System.out.println("Creating CallBack_Skeleton and waiting!");
24         }
25
26         
27         public int printInt() {
28                 return cb.printInt();
29         }
30         
31         
32         public void ___printInt(IoTRMIObject rmiObj) throws IOException {
33                 Object retObj = printInt();
34                 rmiObj.sendReturnObj(retObj);
35         }
36
37
38         public void setInt(int _i) {
39                 cb.setInt(_i);
40         }
41         
42         
43         public void ___setInt(IoTRMIObject rmiObj) {
44                 Object[] paramObj = rmiObj.getMethodParams(new Class<?>[] { int.class }, 
45                         new Class<?>[] { null });
46                 setInt((int) paramObj[0]);
47         }
48         
49
50         public void invokeMethod(IoTRMIObject rmiObj) throws IOException {
51
52                 int methodId = rmiObj.getMethodId();
53
54                 switch (methodId) {
55                         case 0: ___printInt(rmiObj); break;
56                         case 1: ___setInt(rmiObj); break;
57                         default: 
58                                 throw new Error("Method Id not recognized!");
59                 }
60         }
61
62
63         public static void main(String[] args) throws Exception {
64
65         }
66 }