1 #ifndef _LIGHTBULBTEST_STUB_HPP__
2 #define _LIGHTBULBTEST_STUB_HPP__
5 #include "LightBulbTest.hpp"
9 class LightBulbTest_Stub : public LightBulbTest
14 string callbackAddress;
17 const static int objectId = 0;
23 LightBulbTest_Stub() { }
25 LightBulbTest_Stub(int _port, const char* _skeletonAddress, string _callbackAddress, int _rev, bool* _bResult, vector<int> _ports) {
26 callbackAddress = _callbackAddress;
29 log.open("LightBulbTest_Stub_cpp.log");
30 log << "Port: " << _port << endl;
31 log << "Skeleton address: " << _skeletonAddress << endl;
32 log << "Callback address: " << callbackAddress << endl;
33 log << "Rev: " << _rev << endl;
34 log << "bResult: " << *_bResult << endl;
35 log << "Ports: " << _ports[0] << endl;
36 rmiCall = new IoTRMICall(_port, _skeletonAddress, _rev, _bResult);
37 log << "Established connection with skeleton!" << endl;
41 ~LightBulbTest_Stub() {
42 if (rmiCall != NULL) {
50 string retType = "void";
52 string paramCls[] = { };
53 void* paramObj[] = { };
55 rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
58 double getBrightness() {
60 string retType = "double";
62 string paramCls[] = { };
63 void* paramObj[] = { };
65 void* retObj = &retVal;
66 rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
72 string retType = "void";
74 string paramCls[] = { };
75 void* paramObj[] = { };
77 rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
82 string retType = "boolean";
84 string paramCls[] = { };
85 void* paramObj[] = { };
87 void* retObj = &retVal;
88 rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
92 void setColor(double _hue, double _saturation, double _brightness) {
94 string retType = "void";
96 string paramCls[] = { "double", "double", "double" };
97 void* paramObj[] = { &_hue, &_saturation, &_brightness };
99 rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
102 double getSaturation() {
104 string retType = "double";
106 string paramCls[] = { };
107 void* paramObj[] = { };
109 void* retObj = &retVal;
110 rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
115 log << "Calling init() in stub!" << endl;
117 string retType = "void";
119 string paramCls[] = { };
120 void* paramObj[] = { };
122 log << "About to remote call!" << endl;
123 rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
124 log << "Remote call performed!" << endl;
128 void setTemperature(int _temperature) {
130 string retType = "void";
132 string paramCls[] = { "int" };
133 void* paramObj[] = { &_temperature };
135 rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
140 string retType = "double";
142 string paramCls[] = { };
143 void* paramObj[] = { };
145 void* retObj = &retVal;
146 rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);
150 int getTemperature() {
152 string retType = "int";
154 string paramCls[] = { };
155 void* paramObj[] = { };
157 void* retObj = &retVal;
158 rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj);