2 #include "LightBulbTest_Stub.hpp"
6 LightBulbTest_Stub::LightBulbTest_Stub(int _portSend, int _portRecv, const char* _skeletonAddress, int _rev, bool* _bResult) {
7 rmiComm = new IoTRMICommClient(_portSend, _portRecv, _skeletonAddress, _rev, _bResult);
8 rmiComm->registerStub(objectId, 6, &retValueReceived6);
9 rmiComm->registerStub(objectId, 3, &retValueReceived3);
10 rmiComm->registerStub(objectId, 8, &retValueReceived8);
11 rmiComm->registerStub(objectId, 7, &retValueReceived7);
12 rmiComm->registerStub(objectId, 9, &retValueReceived9);
13 IoTRMIUtil::mapStub->insert(make_pair(objectId, this));
16 LightBulbTest_Stub::LightBulbTest_Stub(IoTRMIComm* _rmiComm, int _objectId) {
19 rmiComm->registerStub(objectId, 6, &retValueReceived6);
20 rmiComm->registerStub(objectId, 3, &retValueReceived3);
21 rmiComm->registerStub(objectId, 8, &retValueReceived8);
22 rmiComm->registerStub(objectId, 7, &retValueReceived7);
23 rmiComm->registerStub(objectId, 9, &retValueReceived9);
26 LightBulbTest_Stub::~LightBulbTest_Stub() {
27 if (rmiComm != NULL) {
33 mutex mtxLightBulbTest_StubMethodExec2;
34 void LightBulbTest_Stub::turnOn() {
35 lock_guard<mutex> guard(mtxLightBulbTest_StubMethodExec2);
37 string retType = "void";
39 string paramCls[] = { };
40 void* paramObj[] = { };
41 rmiComm->remoteCall(objectId, methodId, paramCls, paramObj, numParam);
44 mutex mtxLightBulbTest_StubMethodExec6;
45 double LightBulbTest_Stub::getBrightness() {
46 lock_guard<mutex> guard(mtxLightBulbTest_StubMethodExec6);
48 string retType = "double";
50 string paramCls[] = { };
51 void* paramObj[] = { };
53 void* retObj = &retVal;
54 rmiComm->remoteCall(objectId, methodId, paramCls, paramObj, numParam);
55 // Waiting for return value
56 while (!retValueReceived6);
57 rmiComm->getReturnValue(retType, retObj);
58 retValueReceived6 = false;
59 didGetReturnBytes.exchange(true);
64 mutex mtxLightBulbTest_StubMethodExec1;
65 void LightBulbTest_Stub::turnOff() {
66 lock_guard<mutex> guard(mtxLightBulbTest_StubMethodExec1);
68 string retType = "void";
70 string paramCls[] = { };
71 void* paramObj[] = { };
72 rmiComm->remoteCall(objectId, methodId, paramCls, paramObj, numParam);
75 mutex mtxLightBulbTest_StubMethodExec3;
76 bool LightBulbTest_Stub::getState() {
77 lock_guard<mutex> guard(mtxLightBulbTest_StubMethodExec3);
79 string retType = "boolean";
81 string paramCls[] = { };
82 void* paramObj[] = { };
84 void* retObj = &retVal;
85 rmiComm->remoteCall(objectId, methodId, paramCls, paramObj, numParam);
86 // Waiting for return value
87 while (!retValueReceived3);
88 rmiComm->getReturnValue(retType, retObj);
89 retValueReceived3 = false;
90 didGetReturnBytes.exchange(true);
95 mutex mtxLightBulbTest_StubMethodExec4;
96 void LightBulbTest_Stub::setColor(double _hue, double _saturation, double _brightness) {
97 lock_guard<mutex> guard(mtxLightBulbTest_StubMethodExec4);
99 string retType = "void";
101 string paramCls[] = { "double", "double", "double" };
102 void* paramObj[] = { &_hue, &_saturation, &_brightness };
103 rmiComm->remoteCall(objectId, methodId, paramCls, paramObj, numParam);
106 mutex mtxLightBulbTest_StubMethodExec8;
107 double LightBulbTest_Stub::getSaturation() {
108 lock_guard<mutex> guard(mtxLightBulbTest_StubMethodExec8);
110 string retType = "double";
112 string paramCls[] = { };
113 void* paramObj[] = { };
115 void* retObj = &retVal;
116 rmiComm->remoteCall(objectId, methodId, paramCls, paramObj, numParam);
117 // Waiting for return value
118 while (!retValueReceived8);
119 rmiComm->getReturnValue(retType, retObj);
120 retValueReceived8 = false;
121 didGetReturnBytes.exchange(true);
126 mutex mtxLightBulbTest_StubMethodExec0;
127 void LightBulbTest_Stub::init() {
128 lock_guard<mutex> guard(mtxLightBulbTest_StubMethodExec0);
130 string retType = "void";
132 string paramCls[] = { };
133 void* paramObj[] = { };
134 rmiComm->remoteCall(objectId, methodId, paramCls, paramObj, numParam);
137 mutex mtxLightBulbTest_StubMethodExec5;
138 void LightBulbTest_Stub::setTemperature(int _temperature) {
139 lock_guard<mutex> guard(mtxLightBulbTest_StubMethodExec5);
141 string retType = "void";
143 string paramCls[] = { "int" };
144 void* paramObj[] = { &_temperature };
145 rmiComm->remoteCall(objectId, methodId, paramCls, paramObj, numParam);
148 mutex mtxLightBulbTest_StubMethodExec7;
149 double LightBulbTest_Stub::getHue() {
150 lock_guard<mutex> guard(mtxLightBulbTest_StubMethodExec7);
152 string retType = "double";
154 string paramCls[] = { };
155 void* paramObj[] = { };
157 void* retObj = &retVal;
158 rmiComm->remoteCall(objectId, methodId, paramCls, paramObj, numParam);
159 // Waiting for return value
160 while (!retValueReceived7);
161 rmiComm->getReturnValue(retType, retObj);
162 retValueReceived7 = false;
163 didGetReturnBytes.exchange(true);
168 mutex mtxLightBulbTest_StubMethodExec9;
169 int LightBulbTest_Stub::getTemperature() {
170 lock_guard<mutex> guard(mtxLightBulbTest_StubMethodExec9);
172 string retType = "int";
174 string paramCls[] = { };
175 void* paramObj[] = { };
177 void* retObj = &retVal;
178 rmiComm->remoteCall(objectId, methodId, paramCls, paramObj, numParam);
179 // Waiting for return value
180 while (!retValueReceived9);
181 rmiComm->getReturnValue(retType, retObj);
182 retValueReceived9 = false;
183 didGetReturnBytes.exchange(true);
188 extern "C" void* createLightBulbTest_Stub(void** params) {
189 // Args: int _portSend, int _portRecv, const char* _skeletonAddress, int _rev, bool* _bResult
190 return new LightBulbTest_Stub(*((int*) params[0]), *((int*) params[1]), ((string*) params[2])->c_str(), *((int*) params[3]), (bool*) params[4]);
193 extern "C" void destroyLightBulbTest_Stub(void* t) {
194 LightBulbTest_Stub* obj = (LightBulbTest_Stub*) t;
198 extern "C" void initLightBulbTest_Stub(void* t) {