--- /dev/null
+#ifndef _LIGHTBULBTEST_STUB_HPP__
+#define _LIGHTBULBTEST_STUB_HPP__
+#include <iostream>
+#include "LightBulbTest.hpp"
+
+using namespace std;
+
+class LightBulbTest_Stub : public LightBulbTest
+{
+ private:
+
+ IoTRMICall *rmiCall;
+ string callbackAddress;
+ vector<int> ports;
+
+ const static int objectId = 0;
+
+
+ public:
+
+ LightBulbTest_Stub() { }
+
+ LightBulbTest_Stub(int _port, const char* _skeletonAddress, string _callbackAddress, int _rev, bool* _bResult, vector<int> _ports) {
+ callbackAddress = _callbackAddress;
+ ports = _ports;
+ rmiCall = new IoTRMICall(_port, _skeletonAddress, _rev, _bResult);
+ }
+
+ ~LightBulbTest_Stub() {
+ if (rmiCall != NULL) {
+ delete rmiCall;
+ rmiCall = NULL;
+ }
+ }
+
+ void turnOn() {
+ int methodId = 2;
+ string retType = "void";
+ int numParam = 0;
+ string paramCls[] = { };
+ void* paramObj[] = { };
+ void* retObj = NULL;
+ rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
+ }
+
+ double getBrightness() {
+ int methodId = 6;
+ string retType = "double";
+ int numParam = 0;
+ string paramCls[] = { };
+ void* paramObj[] = { };
+ double retVal = 0;
+ void* retObj = &retVal;
+ rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
+ return retVal;
+ }
+
+ void turnOff() {
+ int methodId = 1;
+ string retType = "void";
+ int numParam = 0;
+ string paramCls[] = { };
+ void* paramObj[] = { };
+ void* retObj = NULL;
+ rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
+ }
+
+ bool getState() {
+ int methodId = 3;
+ string retType = "boolean";
+ int numParam = 0;
+ string paramCls[] = { };
+ void* paramObj[] = { };
+ bool retVal = false;
+ void* retObj = &retVal;
+ rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
+ return retVal;
+ }
+
+ void setColor(double _hue, double _saturation, double _brightness) {
+ int methodId = 4;
+ string retType = "void";
+ int numParam = 3;
+ string paramCls[] = { "double", "double", "double" };
+ void* paramObj[] = { &_hue, &_saturation, &_brightness };
+ void* retObj = NULL;
+ rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
+ }
+
+ double getSaturation() {
+ int methodId = 8;
+ string retType = "double";
+ int numParam = 0;
+ string paramCls[] = { };
+ void* paramObj[] = { };
+ double retVal = 0;
+ void* retObj = &retVal;
+ rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
+ return retVal;
+ }
+
+ void init() {
+ int methodId = 0;
+ string retType = "void";
+ int numParam = 0;
+ string paramCls[] = { };
+ void* paramObj[] = { };
+ void* retObj = NULL;
+ rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
+ }
+
+ void setTemperature(int _temperature) {
+ int methodId = 5;
+ string retType = "void";
+ int numParam = 1;
+ string paramCls[] = { "int" };
+ void* paramObj[] = { &_temperature };
+ void* retObj = NULL;
+ rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
+ }
+
+ double getHue() {
+ int methodId = 7;
+ string retType = "double";
+ int numParam = 0;
+ string paramCls[] = { };
+ void* paramObj[] = { };
+ double retVal = 0;
+ void* retObj = &retVal;
+ rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
+ return retVal;
+ }
+
+ int getTemperature() {
+ int methodId = 9;
+ string retType = "int";
+ int numParam = 0;
+ string paramCls[] = { };
+ void* paramObj[] = { };
+ int retVal = 0;
+ void* retObj = &retVal;
+ rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
+ return retVal;
+ }
+
+};
+#endif
--- /dev/null
+#ifndef _LIGHTBULB_SKELETON_HPP__
+#define _LIGHTBULB_SKELETON_HPP__
+#include <iostream>
+#include "LightBulb.hpp"
+
+#include <vector>
+#include <set>
+#include "IoTRMICall.hpp"
+#include "IoTRMIObject.hpp"
+
+using namespace std;
+
+class LightBulb_Skeleton : public LightBulb
+{
+ private:
+
+ LightBulb *mainObj;
+ vector<int> ports;
+ string callbackAddress;
+ IoTRMIObject *rmiObj;
+
+ const static int object0Id = 0; //LightBulbSmart
+ static set<int> set0Allowed;
+
+
+ public:
+
+ LightBulb_Skeleton(LightBulb *_mainObj, string _callbackAddress, int _port) {
+ bool _bResult = false;
+ mainObj = _mainObj;
+ callbackAddress = _callbackAddress;
+ rmiObj = new IoTRMIObject(_port, &_bResult);
+ ___waitRequestInvokeMethod();
+ }
+
+ ~LightBulb_Skeleton() {
+ if (rmiObj != NULL) {
+ delete rmiObj;
+ rmiObj = NULL;
+ }
+ }
+
+ void init() {
+ mainObj->init();
+ }
+
+ void turnOff() {
+ mainObj->turnOff();
+ }
+
+ void turnOn() {
+ mainObj->turnOn();
+ }
+
+ bool getState() {
+ return mainObj->getState();
+ }
+
+ void setColor(double _hue, double _saturation, double _brightness) {
+ mainObj->setColor(_hue, _saturation, _brightness);
+ }
+
+ void setTemperature(int _temperature) {
+ mainObj->setTemperature(_temperature);
+ }
+
+ double getBrightness() {
+ return mainObj->getBrightness();
+ }
+
+ double getHue() {
+ return mainObj->getHue();
+ }
+
+ double getSaturation() {
+ return mainObj->getSaturation();
+ }
+
+ int getTemperature() {
+ return mainObj->getTemperature();
+ }
+
+ double getBrightnessRangeLowerBound() {
+ return mainObj->getBrightnessRangeLowerBound();
+ }
+
+ double getBrightnessRangeUpperBound() {
+ return mainObj->getBrightnessRangeUpperBound();
+ }
+
+ double getHueRangeLowerBound() {
+ return mainObj->getHueRangeLowerBound();
+ }
+
+ double getHueRangeUpperBound() {
+ return mainObj->getHueRangeUpperBound();
+ }
+
+ double getSaturationRangeLowerBound() {
+ return mainObj->getSaturationRangeLowerBound();
+ }
+
+ double getSaturationRangeUpperBound() {
+ return mainObj->getSaturationRangeUpperBound();
+ }
+
+ int getTemperatureRangeLowerBound() {
+ return mainObj->getTemperatureRangeLowerBound();
+ }
+
+ int getTemperatureRangeUpperBound() {
+ return mainObj->getTemperatureRangeUpperBound();
+ }
+
+ void ___init() {
+ string paramCls[] = { };
+ int numParam = 0;
+ void* paramObj[] = { };
+ rmiObj->getMethodParams(paramCls, numParam, paramObj);
+ init();
+ }
+
+ void ___turnOff() {
+ string paramCls[] = { };
+ int numParam = 0;
+ void* paramObj[] = { };
+ rmiObj->getMethodParams(paramCls, numParam, paramObj);
+ turnOff();
+ }
+
+ void ___turnOn() {
+ string paramCls[] = { };
+ int numParam = 0;
+ void* paramObj[] = { };
+ rmiObj->getMethodParams(paramCls, numParam, paramObj);
+ turnOn();
+ }
+
+ void ___getState() {
+ string paramCls[] = { };
+ int numParam = 0;
+ void* paramObj[] = { };
+ rmiObj->getMethodParams(paramCls, numParam, paramObj);
+ bool retVal = getState();
+ void* retObj = &retVal;
+ rmiObj->sendReturnObj(retObj, "boolean");
+ }
+
+ void ___setColor() {
+ string paramCls[] = { "double", "double", "double" };
+ int numParam = 3;
+ double _hue;
+ double _saturation;
+ double _brightness;
+ void* paramObj[] = { &_hue, &_saturation, &_brightness };
+ rmiObj->getMethodParams(paramCls, numParam, paramObj);
+ setColor(_hue, _saturation, _brightness);
+ }
+
+ void ___setTemperature() {
+ string paramCls[] = { "int" };
+ int numParam = 1;
+ int _temperature;
+ void* paramObj[] = { &_temperature };
+ rmiObj->getMethodParams(paramCls, numParam, paramObj);
+ setTemperature(_temperature);
+ }
+
+ void ___getBrightness() {
+ string paramCls[] = { };
+ int numParam = 0;
+ void* paramObj[] = { };
+ rmiObj->getMethodParams(paramCls, numParam, paramObj);
+ double retVal = getBrightness();
+ void* retObj = &retVal;
+ rmiObj->sendReturnObj(retObj, "double");
+ }
+
+ void ___getHue() {
+ string paramCls[] = { };
+ int numParam = 0;
+ void* paramObj[] = { };
+ rmiObj->getMethodParams(paramCls, numParam, paramObj);
+ double retVal = getHue();
+ void* retObj = &retVal;
+ rmiObj->sendReturnObj(retObj, "double");
+ }
+
+ void ___getSaturation() {
+ string paramCls[] = { };
+ int numParam = 0;
+ void* paramObj[] = { };
+ rmiObj->getMethodParams(paramCls, numParam, paramObj);
+ double retVal = getSaturation();
+ void* retObj = &retVal;
+ rmiObj->sendReturnObj(retObj, "double");
+ }
+
+ void ___getTemperature() {
+ string paramCls[] = { };
+ int numParam = 0;
+ void* paramObj[] = { };
+ rmiObj->getMethodParams(paramCls, numParam, paramObj);
+ int retVal = getTemperature();
+ void* retObj = &retVal;
+ rmiObj->sendReturnObj(retObj, "int");
+ }
+
+ void ___getBrightnessRangeLowerBound() {
+ string paramCls[] = { };
+ int numParam = 0;
+ void* paramObj[] = { };
+ rmiObj->getMethodParams(paramCls, numParam, paramObj);
+ double retVal = getBrightnessRangeLowerBound();
+ void* retObj = &retVal;
+ rmiObj->sendReturnObj(retObj, "double");
+ }
+
+ void ___getBrightnessRangeUpperBound() {
+ string paramCls[] = { };
+ int numParam = 0;
+ void* paramObj[] = { };
+ rmiObj->getMethodParams(paramCls, numParam, paramObj);
+ double retVal = getBrightnessRangeUpperBound();
+ void* retObj = &retVal;
+ rmiObj->sendReturnObj(retObj, "double");
+ }
+
+ void ___getHueRangeLowerBound() {
+ string paramCls[] = { };
+ int numParam = 0;
+ void* paramObj[] = { };
+ rmiObj->getMethodParams(paramCls, numParam, paramObj);
+ double retVal = getHueRangeLowerBound();
+ void* retObj = &retVal;
+ rmiObj->sendReturnObj(retObj, "double");
+ }
+
+ void ___getHueRangeUpperBound() {
+ string paramCls[] = { };
+ int numParam = 0;
+ void* paramObj[] = { };
+ rmiObj->getMethodParams(paramCls, numParam, paramObj);
+ double retVal = getHueRangeUpperBound();
+ void* retObj = &retVal;
+ rmiObj->sendReturnObj(retObj, "double");
+ }
+
+ void ___getSaturationRangeLowerBound() {
+ string paramCls[] = { };
+ int numParam = 0;
+ void* paramObj[] = { };
+ rmiObj->getMethodParams(paramCls, numParam, paramObj);
+ double retVal = getSaturationRangeLowerBound();
+ void* retObj = &retVal;
+ rmiObj->sendReturnObj(retObj, "double");
+ }
+
+ void ___getSaturationRangeUpperBound() {
+ string paramCls[] = { };
+ int numParam = 0;
+ void* paramObj[] = { };
+ rmiObj->getMethodParams(paramCls, numParam, paramObj);
+ double retVal = getSaturationRangeUpperBound();
+ void* retObj = &retVal;
+ rmiObj->sendReturnObj(retObj, "double");
+ }
+
+ void ___getTemperatureRangeLowerBound() {
+ string paramCls[] = { };
+ int numParam = 0;
+ void* paramObj[] = { };
+ rmiObj->getMethodParams(paramCls, numParam, paramObj);
+ int retVal = getTemperatureRangeLowerBound();
+ void* retObj = &retVal;
+ rmiObj->sendReturnObj(retObj, "int");
+ }
+
+ void ___getTemperatureRangeUpperBound() {
+ string paramCls[] = { };
+ int numParam = 0;
+ void* paramObj[] = { };
+ rmiObj->getMethodParams(paramCls, numParam, paramObj);
+ int retVal = getTemperatureRangeUpperBound();
+ void* retObj = &retVal;
+ rmiObj->sendReturnObj(retObj, "int");
+ }
+
+ void ___waitRequestInvokeMethod() {
+ while (true) {
+ rmiObj->getMethodBytes();
+ int _objectId = rmiObj->getObjectId();
+ int methodId = rmiObj->getMethodId();
+ if (_objectId == object0Id) {
+ if (set0Allowed.find(methodId) == set0Allowed.end()) {
+ cerr << "Object with object Id: " << _objectId << " is not allowed to access method: " << methodId << endl;
+ return;
+ }
+ }
+ else {
+ cerr << "Object Id: " << _objectId << " not recognized!" << endl;
+ return;
+ }
+ switch (methodId) {
+ case 0: ___init(); break;
+ case 1: ___turnOff(); break;
+ case 2: ___turnOn(); break;
+ case 3: ___getState(); break;
+ case 4: ___setColor(); break;
+ case 5: ___setTemperature(); break;
+ case 6: ___getBrightness(); break;
+ case 7: ___getHue(); break;
+ case 8: ___getSaturation(); break;
+ case 9: ___getTemperature(); break;
+ case 10: ___getBrightnessRangeLowerBound(); break;
+ case 11: ___getBrightnessRangeUpperBound(); break;
+ case 12: ___getHueRangeLowerBound(); break;
+ case 13: ___getHueRangeUpperBound(); break;
+ case 14: ___getSaturationRangeLowerBound(); break;
+ case 15: ___getSaturationRangeUpperBound(); break;
+ case 16: ___getTemperatureRangeLowerBound(); break;
+ case 17: ___getTemperatureRangeUpperBound(); break;
+ default:
+ cerr << "Method Id " << methodId << " not recognized!" << endl;
+ throw exception();
+ }
+ }
+ }
+
+};
+set<int> LightBulb_Skeleton::set0Allowed { 2, 10, 1, 3, 11, 8, 12, 7, 13, 9, 6, 16, 17, 4, 0, 14, 15, 5 };
+#endif