1 #ifndef _LIGHTBULB_SKELETON_HPP__
2 #define _LIGHTBULB_SKELETON_HPP__
4 #include "LightBulb.hpp"
8 #include "IoTRMICall.hpp"
9 #include "IoTRMIObject.hpp"
13 class LightBulb_Skeleton : public LightBulb
19 string callbackAddress;
22 const static int object0Id = 0; //LightBulbSmart
23 static set<int> set0Allowed;
28 LightBulb_Skeleton(LightBulb *_mainObj, string _callbackAddress, int _port) {
29 bool _bResult = false;
31 callbackAddress = _callbackAddress;
32 rmiObj = new IoTRMIObject(_port, &_bResult);
33 ___waitRequestInvokeMethod();
36 ~LightBulb_Skeleton() {
56 return mainObj->getState();
59 void setColor(double _hue, double _saturation, double _brightness) {
60 mainObj->setColor(_hue, _saturation, _brightness);
63 void setTemperature(int _temperature) {
64 mainObj->setTemperature(_temperature);
67 double getBrightness() {
68 return mainObj->getBrightness();
72 return mainObj->getHue();
75 double getSaturation() {
76 return mainObj->getSaturation();
79 int getTemperature() {
80 return mainObj->getTemperature();
83 double getBrightnessRangeLowerBound() {
84 return mainObj->getBrightnessRangeLowerBound();
87 double getBrightnessRangeUpperBound() {
88 return mainObj->getBrightnessRangeUpperBound();
91 double getHueRangeLowerBound() {
92 return mainObj->getHueRangeLowerBound();
95 double getHueRangeUpperBound() {
96 return mainObj->getHueRangeUpperBound();
99 double getSaturationRangeLowerBound() {
100 return mainObj->getSaturationRangeLowerBound();
103 double getSaturationRangeUpperBound() {
104 return mainObj->getSaturationRangeUpperBound();
107 int getTemperatureRangeLowerBound() {
108 return mainObj->getTemperatureRangeLowerBound();
111 int getTemperatureRangeUpperBound() {
112 return mainObj->getTemperatureRangeUpperBound();
116 string paramCls[] = { };
118 void* paramObj[] = { };
119 rmiObj->getMethodParams(paramCls, numParam, paramObj);
124 string paramCls[] = { };
126 void* paramObj[] = { };
127 rmiObj->getMethodParams(paramCls, numParam, paramObj);
132 string paramCls[] = { };
134 void* paramObj[] = { };
135 rmiObj->getMethodParams(paramCls, numParam, paramObj);
140 string paramCls[] = { };
142 void* paramObj[] = { };
143 rmiObj->getMethodParams(paramCls, numParam, paramObj);
144 bool retVal = getState();
145 void* retObj = &retVal;
146 rmiObj->sendReturnObj(retObj, "boolean");
150 string paramCls[] = { "double", "double", "double" };
155 void* paramObj[] = { &_hue, &_saturation, &_brightness };
156 rmiObj->getMethodParams(paramCls, numParam, paramObj);
157 setColor(_hue, _saturation, _brightness);
160 void ___setTemperature() {
161 string paramCls[] = { "int" };
164 void* paramObj[] = { &_temperature };
165 rmiObj->getMethodParams(paramCls, numParam, paramObj);
166 setTemperature(_temperature);
169 void ___getBrightness() {
170 string paramCls[] = { };
172 void* paramObj[] = { };
173 rmiObj->getMethodParams(paramCls, numParam, paramObj);
174 double retVal = getBrightness();
175 void* retObj = &retVal;
176 rmiObj->sendReturnObj(retObj, "double");
180 string paramCls[] = { };
182 void* paramObj[] = { };
183 rmiObj->getMethodParams(paramCls, numParam, paramObj);
184 double retVal = getHue();
185 void* retObj = &retVal;
186 rmiObj->sendReturnObj(retObj, "double");
189 void ___getSaturation() {
190 string paramCls[] = { };
192 void* paramObj[] = { };
193 rmiObj->getMethodParams(paramCls, numParam, paramObj);
194 double retVal = getSaturation();
195 void* retObj = &retVal;
196 rmiObj->sendReturnObj(retObj, "double");
199 void ___getTemperature() {
200 string paramCls[] = { };
202 void* paramObj[] = { };
203 rmiObj->getMethodParams(paramCls, numParam, paramObj);
204 int retVal = getTemperature();
205 void* retObj = &retVal;
206 rmiObj->sendReturnObj(retObj, "int");
209 void ___getBrightnessRangeLowerBound() {
210 string paramCls[] = { };
212 void* paramObj[] = { };
213 rmiObj->getMethodParams(paramCls, numParam, paramObj);
214 double retVal = getBrightnessRangeLowerBound();
215 void* retObj = &retVal;
216 rmiObj->sendReturnObj(retObj, "double");
219 void ___getBrightnessRangeUpperBound() {
220 string paramCls[] = { };
222 void* paramObj[] = { };
223 rmiObj->getMethodParams(paramCls, numParam, paramObj);
224 double retVal = getBrightnessRangeUpperBound();
225 void* retObj = &retVal;
226 rmiObj->sendReturnObj(retObj, "double");
229 void ___getHueRangeLowerBound() {
230 string paramCls[] = { };
232 void* paramObj[] = { };
233 rmiObj->getMethodParams(paramCls, numParam, paramObj);
234 double retVal = getHueRangeLowerBound();
235 void* retObj = &retVal;
236 rmiObj->sendReturnObj(retObj, "double");
239 void ___getHueRangeUpperBound() {
240 string paramCls[] = { };
242 void* paramObj[] = { };
243 rmiObj->getMethodParams(paramCls, numParam, paramObj);
244 double retVal = getHueRangeUpperBound();
245 void* retObj = &retVal;
246 rmiObj->sendReturnObj(retObj, "double");
249 void ___getSaturationRangeLowerBound() {
250 string paramCls[] = { };
252 void* paramObj[] = { };
253 rmiObj->getMethodParams(paramCls, numParam, paramObj);
254 double retVal = getSaturationRangeLowerBound();
255 void* retObj = &retVal;
256 rmiObj->sendReturnObj(retObj, "double");
259 void ___getSaturationRangeUpperBound() {
260 string paramCls[] = { };
262 void* paramObj[] = { };
263 rmiObj->getMethodParams(paramCls, numParam, paramObj);
264 double retVal = getSaturationRangeUpperBound();
265 void* retObj = &retVal;
266 rmiObj->sendReturnObj(retObj, "double");
269 void ___getTemperatureRangeLowerBound() {
270 string paramCls[] = { };
272 void* paramObj[] = { };
273 rmiObj->getMethodParams(paramCls, numParam, paramObj);
274 int retVal = getTemperatureRangeLowerBound();
275 void* retObj = &retVal;
276 rmiObj->sendReturnObj(retObj, "int");
279 void ___getTemperatureRangeUpperBound() {
280 string paramCls[] = { };
282 void* paramObj[] = { };
283 rmiObj->getMethodParams(paramCls, numParam, paramObj);
284 int retVal = getTemperatureRangeUpperBound();
285 void* retObj = &retVal;
286 rmiObj->sendReturnObj(retObj, "int");
289 void ___waitRequestInvokeMethod() {
291 rmiObj->getMethodBytes();
292 int _objectId = rmiObj->getObjectId();
293 int methodId = rmiObj->getMethodId();
294 if (_objectId == object0Id) {
295 if (set0Allowed.find(methodId) == set0Allowed.end()) {
296 cerr << "Object with object Id: " << _objectId << " is not allowed to access method: " << methodId << endl;
301 cerr << "Object Id: " << _objectId << " not recognized!" << endl;
305 case 0: ___init(); break;
306 case 1: ___turnOff(); break;
307 case 2: ___turnOn(); break;
308 case 3: ___getState(); break;
309 case 4: ___setColor(); break;
310 case 5: ___setTemperature(); break;
311 case 6: ___getBrightness(); break;
312 case 7: ___getHue(); break;
313 case 8: ___getSaturation(); break;
314 case 9: ___getTemperature(); break;
315 case 10: ___getBrightnessRangeLowerBound(); break;
316 case 11: ___getBrightnessRangeUpperBound(); break;
317 case 12: ___getHueRangeLowerBound(); break;
318 case 13: ___getHueRangeUpperBound(); break;
319 case 14: ___getSaturationRangeLowerBound(); break;
320 case 15: ___getSaturationRangeUpperBound(); break;
321 case 16: ___getTemperatureRangeLowerBound(); break;
322 case 17: ___getTemperatureRangeUpperBound(); break;
324 cerr << "Method Id " << methodId << " not recognized!" << endl;
331 set<int> LightBulb_Skeleton::set0Allowed { 2, 10, 1, 3, 11, 8, 12, 7, 13, 9, 6, 16, 17, 4, 0, 14, 15, 5 };