Adding stub and skeleton for Lifxtest and LifxLightBulb; Creating build flow for...
[iot2.git] / benchmarks / Cpp / Lifxtest / LightBulbTest_Stub.hpp
1 #ifndef _LIGHTBULBTEST_STUB_HPP__
2 #define _LIGHTBULBTEST_STUB_HPP__
3 #include <iostream>
4 #include "LightBulbTest.hpp"
5
6 using namespace std;
7
8 class LightBulbTest_Stub : public LightBulbTest
9 {
10         private:
11
12         IoTRMICall *rmiCall;
13         string callbackAddress;
14         vector<int> ports;
15
16         const static int objectId = 0;
17         
18
19         public:
20
21         LightBulbTest_Stub() { }
22         
23         LightBulbTest_Stub(int _port, const char* _skeletonAddress, string _callbackAddress, int _rev, bool* _bResult, vector<int> _ports) {
24                 callbackAddress = _callbackAddress;
25                 ports = _ports;
26                 rmiCall = new IoTRMICall(_port, _skeletonAddress, _rev, _bResult);
27         }
28
29         ~LightBulbTest_Stub() {
30                 if (rmiCall != NULL) {
31                         delete rmiCall;
32                         rmiCall = NULL;
33                 }
34         }
35         
36         void turnOn() { 
37                 int methodId = 2;
38                 string retType = "void";
39                 int numParam = 0;
40                 string paramCls[] = {  };
41                 void* paramObj[] = {  };
42                 void* retObj = NULL;
43                 rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
44         }
45
46         double getBrightness() { 
47                 int methodId = 6;
48                 string retType = "double";
49                 int numParam = 0;
50                 string paramCls[] = {  };
51                 void* paramObj[] = {  };
52                 double retVal = 0;
53                 void* retObj = &retVal;
54                 rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
55                 return retVal;
56         }
57
58         void turnOff() { 
59                 int methodId = 1;
60                 string retType = "void";
61                 int numParam = 0;
62                 string paramCls[] = {  };
63                 void* paramObj[] = {  };
64                 void* retObj = NULL;
65                 rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
66         }
67
68         bool getState() { 
69                 int methodId = 3;
70                 string retType = "boolean";
71                 int numParam = 0;
72                 string paramCls[] = {  };
73                 void* paramObj[] = {  };
74                 bool retVal = false;
75                 void* retObj = &retVal;
76                 rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
77                 return retVal;
78         }
79
80         void setColor(double _hue, double _saturation, double _brightness) { 
81                 int methodId = 4;
82                 string retType = "void";
83                 int numParam = 3;
84                 string paramCls[] = { "double", "double", "double" };
85                 void* paramObj[] = { &_hue, &_saturation, &_brightness };
86                 void* retObj = NULL;
87                 rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
88         }
89
90         double getSaturation() { 
91                 int methodId = 8;
92                 string retType = "double";
93                 int numParam = 0;
94                 string paramCls[] = {  };
95                 void* paramObj[] = {  };
96                 double retVal = 0;
97                 void* retObj = &retVal;
98                 rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
99                 return retVal;
100         }
101
102         void init() { 
103                 int methodId = 0;
104                 string retType = "void";
105                 int numParam = 0;
106                 string paramCls[] = {  };
107                 void* paramObj[] = {  };
108                 void* retObj = NULL;
109                 rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
110         }
111
112         void setTemperature(int _temperature) { 
113                 int methodId = 5;
114                 string retType = "void";
115                 int numParam = 1;
116                 string paramCls[] = { "int" };
117                 void* paramObj[] = { &_temperature };
118                 void* retObj = NULL;
119                 rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
120         }
121
122         double getHue() { 
123                 int methodId = 7;
124                 string retType = "double";
125                 int numParam = 0;
126                 string paramCls[] = {  };
127                 void* paramObj[] = {  };
128                 double retVal = 0;
129                 void* retObj = &retVal;
130                 rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
131                 return retVal;
132         }
133
134         int getTemperature() { 
135                 int methodId = 9;
136                 string retType = "int";
137                 int numParam = 0;
138                 string paramCls[] = {  };
139                 void* paramObj[] = {  };
140                 int retVal = 0;
141                 void* retObj = &retVal;
142                 rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
143                 return retVal;
144         }
145
146 };
147
148 //typedef LightBulbTest_Stub* create_t(int _port, const char* _skeletonAddress, string _callbackAddress, int _rev, bool* _bResult, vector<int> _ports);
149 //typedef void destroy_t(LightBulbTest_Stub*);
150 #endif