From ac90c5d392758d356e22f8c37fd7aae2484e17f6 Mon Sep 17 00:00:00 2001 From: rtrimana Date: Mon, 20 Feb 2017 16:28:04 -0800 Subject: [PATCH] Updating skeletons and stubs for C++; Fixing one bug in IoTCompiler for C++ skeleton instantiation code; Need to find workaround for multithreading on ARM (cross compiler doesn't work) --- .../Cpp/Lifxtest/LightBulbTest_Stub.cpp | 223 ++++++-- .../Cpp/Lifxtest/LightBulbTest_Stub.hpp | 191 ++----- benchmarks/Cpp/Lifxtest/RoomSmart_Stub.cpp | 76 ++- benchmarks/Cpp/Lifxtest/RoomSmart_Stub.hpp | 71 +-- .../drivers/Cpp/LabRoom/Room_Skeleton.cpp | 111 +++- .../drivers/Cpp/LabRoom/Room_Skeleton.hpp | 99 +--- .../Cpp/LifxLightBulb/LightBulb_Skeleton.cpp | 491 ++++++++++++++++-- .../Cpp/LifxLightBulb/LightBulb_Skeleton.hpp | 384 ++------------ iotjava/Makefile | 4 +- iotjava/iotpolicy/IoTCompiler.java | 10 +- iotjava/iotruntime/cpp/iotslave/IoTSlave.cpp | 33 +- iotjava/iotruntime/cpp/iotslave/IoTSlave.hpp | 3 +- iotjava/iotruntime/slave/IoTSlave.java | 8 - 13 files changed, 956 insertions(+), 748 deletions(-) diff --git a/benchmarks/Cpp/Lifxtest/LightBulbTest_Stub.cpp b/benchmarks/Cpp/Lifxtest/LightBulbTest_Stub.cpp index 02e450b..b2e1623 100644 --- a/benchmarks/Cpp/Lifxtest/LightBulbTest_Stub.cpp +++ b/benchmarks/Cpp/Lifxtest/LightBulbTest_Stub.cpp @@ -1,46 +1,203 @@ #include -#include #include "LightBulbTest_Stub.hpp" -// External create, destroy, and init functions -extern "C" void* createLightBulbTest_Stub(void** params) { - // Arguments: int _port, const char* _skeletonAddress, string _callbackAddress, int _rev, bool* _bResult, vector _ports - return new LightBulbTest_Stub(*((int*) params[0]), ((string*) params[1])->c_str(), *((string*) params[2]), *((int*) params[3]), (bool*) params[4], *((vector*) params[5])); +using namespace std; + +LightBulbTest_Stub::LightBulbTest_Stub(int _portSend, int _portRecv, const char* _skeletonAddress, int _rev, bool* _bResult) { + rmiComm = new IoTRMICommClient(_portSend, _portRecv, _skeletonAddress, _rev, _bResult); + rmiComm->registerStub(objectId, 6, &retValueReceived6); + rmiComm->registerStub(objectId, 3, &retValueReceived3); + rmiComm->registerStub(objectId, 8, &retValueReceived8); + rmiComm->registerStub(objectId, 7, &retValueReceived7); + rmiComm->registerStub(objectId, 9, &retValueReceived9); + IoTRMIUtil::mapStub->insert(make_pair(objectId, this)); } +LightBulbTest_Stub::LightBulbTest_Stub(IoTRMIComm* _rmiComm, int _objectId) { + rmiComm = _rmiComm; + objectId = _objectId; + rmiComm->registerStub(objectId, 6, &retValueReceived6); + rmiComm->registerStub(objectId, 3, &retValueReceived3); + rmiComm->registerStub(objectId, 8, &retValueReceived8); + rmiComm->registerStub(objectId, 7, &retValueReceived7); + rmiComm->registerStub(objectId, 9, &retValueReceived9); +} -extern "C" void destroyLightBulbTest_Stub(void* t) { - LightBulbTest_Stub* lbs = (LightBulbTest_Stub*) t; - delete lbs; +LightBulbTest_Stub::~LightBulbTest_Stub() { + if (rmiComm != NULL) { + delete rmiComm; + rmiComm = NULL; + } +} + +mutex mtxLightBulbTest_StubMethodExec2; +void LightBulbTest_Stub::turnOn() { + lock_guard guard(mtxLightBulbTest_StubMethodExec2); + int methodId = 2; + string retType = "void"; + int numParam = 0; + string paramCls[] = { }; + void* paramObj[] = { }; + rmiComm->remoteCall(objectId, methodId, paramCls, paramObj, numParam); +} + +mutex mtxLightBulbTest_StubMethodExec6; +double LightBulbTest_Stub::getBrightness() { + lock_guard guard(mtxLightBulbTest_StubMethodExec6); + int methodId = 6; + string retType = "double"; + int numParam = 0; + string paramCls[] = { }; + void* paramObj[] = { }; + double retVal = 0; + void* retObj = &retVal; + rmiComm->remoteCall(objectId, methodId, paramCls, paramObj, numParam); + // Waiting for return value + while (!retValueReceived6); + rmiComm->getReturnValue(retType, retObj); + retValueReceived6 = false; + didGetReturnBytes.exchange(true); + + return retVal; } +mutex mtxLightBulbTest_StubMethodExec1; +void LightBulbTest_Stub::turnOff() { + lock_guard guard(mtxLightBulbTest_StubMethodExec1); + int methodId = 1; + string retType = "void"; + int numParam = 0; + string paramCls[] = { }; + void* paramObj[] = { }; + rmiComm->remoteCall(objectId, methodId, paramCls, paramObj, numParam); +} + +mutex mtxLightBulbTest_StubMethodExec3; +bool LightBulbTest_Stub::getState() { + lock_guard guard(mtxLightBulbTest_StubMethodExec3); + int methodId = 3; + string retType = "boolean"; + int numParam = 0; + string paramCls[] = { }; + void* paramObj[] = { }; + bool retVal = false; + void* retObj = &retVal; + rmiComm->remoteCall(objectId, methodId, paramCls, paramObj, numParam); + // Waiting for return value + while (!retValueReceived3); + rmiComm->getReturnValue(retType, retObj); + retValueReceived3 = false; + didGetReturnBytes.exchange(true); + + return retVal; +} + +mutex mtxLightBulbTest_StubMethodExec4; +void LightBulbTest_Stub::setColor(double _hue, double _saturation, double _brightness) { + lock_guard guard(mtxLightBulbTest_StubMethodExec4); + int methodId = 4; + string retType = "void"; + int numParam = 3; + string paramCls[] = { "double", "double", "double" }; + void* paramObj[] = { &_hue, &_saturation, &_brightness }; + rmiComm->remoteCall(objectId, methodId, paramCls, paramObj, numParam); +} + +mutex mtxLightBulbTest_StubMethodExec8; +double LightBulbTest_Stub::getSaturation() { + lock_guard guard(mtxLightBulbTest_StubMethodExec8); + int methodId = 8; + string retType = "double"; + int numParam = 0; + string paramCls[] = { }; + void* paramObj[] = { }; + double retVal = 0; + void* retObj = &retVal; + rmiComm->remoteCall(objectId, methodId, paramCls, paramObj, numParam); + // Waiting for return value + while (!retValueReceived8); + rmiComm->getReturnValue(retType, retObj); + retValueReceived8 = false; + didGetReturnBytes.exchange(true); + + return retVal; +} + +mutex mtxLightBulbTest_StubMethodExec0; +void LightBulbTest_Stub::init() { + lock_guard guard(mtxLightBulbTest_StubMethodExec0); + int methodId = 0; + string retType = "void"; + int numParam = 0; + string paramCls[] = { }; + void* paramObj[] = { }; + rmiComm->remoteCall(objectId, methodId, paramCls, paramObj, numParam); +} + +mutex mtxLightBulbTest_StubMethodExec5; +void LightBulbTest_Stub::setTemperature(int _temperature) { + lock_guard guard(mtxLightBulbTest_StubMethodExec5); + int methodId = 5; + string retType = "void"; + int numParam = 1; + string paramCls[] = { "int" }; + void* paramObj[] = { &_temperature }; + rmiComm->remoteCall(objectId, methodId, paramCls, paramObj, numParam); +} + +mutex mtxLightBulbTest_StubMethodExec7; +double LightBulbTest_Stub::getHue() { + lock_guard guard(mtxLightBulbTest_StubMethodExec7); + int methodId = 7; + string retType = "double"; + int numParam = 0; + string paramCls[] = { }; + void* paramObj[] = { }; + double retVal = 0; + void* retObj = &retVal; + rmiComm->remoteCall(objectId, methodId, paramCls, paramObj, numParam); + // Waiting for return value + while (!retValueReceived7); + rmiComm->getReturnValue(retType, retObj); + retValueReceived7 = false; + didGetReturnBytes.exchange(true); + + return retVal; +} + +mutex mtxLightBulbTest_StubMethodExec9; +int LightBulbTest_Stub::getTemperature() { + lock_guard guard(mtxLightBulbTest_StubMethodExec9); + int methodId = 9; + string retType = "int"; + int numParam = 0; + string paramCls[] = { }; + void* paramObj[] = { }; + int retVal = 0; + void* retObj = &retVal; + rmiComm->remoteCall(objectId, methodId, paramCls, paramObj, numParam); + // Waiting for return value + while (!retValueReceived9); + rmiComm->getReturnValue(retType, retObj); + retValueReceived9 = false; + didGetReturnBytes.exchange(true); + + return retVal; +} + +extern "C" void* createLightBulbTest_Stub(void** params) { + // Args: int _portSend, int _portRecv, const char* _skeletonAddress, int _rev, bool* _bResult + return new LightBulbTest_Stub(*((int*) params[0]), *((int*) params[1]), ((string*) params[2])->c_str(), *((int*) params[3]), (bool*) params[4]); +} + +extern "C" void destroyLightBulbTest_Stub(void* t) { + LightBulbTest_Stub* obj = (LightBulbTest_Stub*) t; + delete obj; +} extern "C" void initLightBulbTest_Stub(void* t) { - LightBulbTest_Stub* lbs = (LightBulbTest_Stub*) t; - lbs->init(); -} - - -int main(int argc, char *argv[]) -{ - int stubPort = 55179; - vector ports; - ports.push_back(58551); - const char* skeletonAddress = "localhost"; - string callbackAddress = "localhost"; - int rev = 0; - bool result = false; - LightBulbTest_Stub *lbs = new LightBulbTest_Stub(stubPort, skeletonAddress, callbackAddress, rev, &result, ports); - //cout << "Successfully instantiated stub!" << endl; - lbs->init(); - for (int i = 0; i < 100; i++) { - lbs->turnOff(); - //cout << "Turning off!" << endl; - this_thread::sleep_for (chrono::milliseconds(1000)); - lbs->turnOn(); - //cout << "Turning on!" << endl; - this_thread::sleep_for (chrono::milliseconds(1000)); - } +} +int main() { return 0; } diff --git a/benchmarks/Cpp/Lifxtest/LightBulbTest_Stub.hpp b/benchmarks/Cpp/Lifxtest/LightBulbTest_Stub.hpp index a855a73..b453249 100644 --- a/benchmarks/Cpp/Lifxtest/LightBulbTest_Stub.hpp +++ b/benchmarks/Cpp/Lifxtest/LightBulbTest_Stub.hpp @@ -1,7 +1,14 @@ #ifndef _LIGHTBULBTEST_STUB_HPP__ #define _LIGHTBULBTEST_STUB_HPP__ #include -#include +#include +#include +#include +#include +#include "IoTRMIComm.hpp" +#include "IoTRMICommClient.hpp" +#include "IoTRMICommServer.hpp" + #include "LightBulbTest.hpp" using namespace std; @@ -10,167 +17,31 @@ class LightBulbTest_Stub : public LightBulbTest { private: - IoTRMICall *rmiCall; - string callbackAddress; - vector ports; - - const static int objectId = 0; - - ofstream log; - - public: - - LightBulbTest_Stub() { } - - LightBulbTest_Stub(int _port, const char* _skeletonAddress, string _callbackAddress, int _rev, bool* _bResult, vector _ports) { - callbackAddress = _callbackAddress; - ports = _ports; - // Logging - int i=0; - string file = "LightBulbTest_Stub_cpp" + to_string(i) + ".log"; - while (ifstream(file.c_str())) { - i++; - file = "LightBulbTest_Stub_cpp" + to_string(i) + ".log"; - } - log.open(file); - log << "Port: " << _port << endl; - log << "Skeleton address: " << _skeletonAddress << endl; - log << "Callback address: " << callbackAddress << endl; - log << "Rev: " << _rev << endl; - log << "bResult: " << *_bResult << endl; - log << "Ports: " << _ports[0] << endl; - rmiCall = new IoTRMICall(_port, _skeletonAddress, _rev, _bResult); - log << "Established connection with skeleton!" << endl; - //log.close(); - } - - ~LightBulbTest_Stub() { - if (rmiCall != NULL) { - delete rmiCall; - rmiCall = NULL; - } - } + IoTRMIComm *rmiComm; + int objectId = 0; + // Synchronization variables + bool retValueReceived6 = false; + bool retValueReceived3 = false; + bool retValueReceived8 = false; + bool retValueReceived7 = false; + bool retValueReceived9 = false; - void turnOn() { - log << "Calling turnOn() in stub!" << endl; - int methodId = 2; - string retType = "void"; - int numParam = 0; - string paramCls[] = { }; - void* paramObj[] = { }; - void* retObj = NULL; - log << "About to remote call!" << endl; - rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj); - log << "Remote call performed!" << endl; - } - - 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() { - log << "Calling turnOff() in stub!" << endl; - int methodId = 1; - string retType = "void"; - int numParam = 0; - string paramCls[] = { }; - void* paramObj[] = { }; - void* retObj = NULL; - log << "About to remote call!" << endl; - rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj); - log << "Remote call performed!" << endl; - } - - 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() { - log << "Calling init() in stub!" << endl; - int methodId = 0; - string retType = "void"; - int numParam = 0; - string paramCls[] = { }; - void* paramObj[] = { }; - void* retObj = NULL; - log << "About to remote call!" << endl; - rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj); - log << "Remote call performed!" << endl; - log.close(); - } - - 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; - } + public: + LightBulbTest_Stub(); + LightBulbTest_Stub(int _portSend, int _portRecv, const char* _skeletonAddress, int _rev, bool* _bResult); + LightBulbTest_Stub(IoTRMIComm* _rmiComm, int _objectId); + ~LightBulbTest_Stub(); + void turnOn(); + double getBrightness(); + void turnOff(); + bool getState(); + void setColor(double _hue, double _saturation, double _brightness); + double getSaturation(); + void init(); + void setTemperature(int _temperature); + double getHue(); + int getTemperature(); }; - #endif diff --git a/benchmarks/Cpp/Lifxtest/RoomSmart_Stub.cpp b/benchmarks/Cpp/Lifxtest/RoomSmart_Stub.cpp index 1ca3e53..0e1a498 100644 --- a/benchmarks/Cpp/Lifxtest/RoomSmart_Stub.cpp +++ b/benchmarks/Cpp/Lifxtest/RoomSmart_Stub.cpp @@ -1,24 +1,74 @@ #include -#include #include "RoomSmart_Stub.hpp" -// External create, destroy, and init functions -extern "C" void* createRoomSmart_Stub(void** params) { - // Arguments: int _port, const char* _skeletonAddress, string _callbackAddress, int _rev, bool* _bResult, vector _ports - return new RoomSmart_Stub(*((int*) params[0]), ((string*) params[1])->c_str(), *((string*) params[2]), *((int*) params[3]), (bool*) params[4], *((vector*) params[5])); +using namespace std; + +RoomSmart_Stub::RoomSmart_Stub(int _portSend, int _portRecv, const char* _skeletonAddress, int _rev, bool* _bResult) { + // Logging + int i=0; + string file = "RoomSmart_Stub_cpp" + to_string(i) + ".log"; + while (ifstream(file.c_str())) { + i++; + file = "RoomSmart_Stub_cpp" + to_string(i) + ".log"; + } + log.open(file); + log << "Send port: " << _portSend << endl; + log << "Recv port: " << _portRecv << endl; + log << "Skeleton address: " << _skeletonAddress << endl; + log << "Rev: " << _rev << endl; + log << "bResult: " << *_bResult << endl; + rmiComm = new IoTRMICommClient(_portSend, _portRecv, _skeletonAddress, _rev, _bResult); + log << "Established connection with skeleton!" << endl; + rmiComm->registerStub(objectId, 0, &retValueReceived0); + IoTRMIUtil::mapStub->insert(make_pair(objectId, this)); } +RoomSmart_Stub::RoomSmart_Stub(IoTRMIComm* _rmiComm, int _objectId) { + rmiComm = _rmiComm; + objectId = _objectId; + rmiComm->registerStub(objectId, 0, &retValueReceived0); +} -extern "C" void destroyRoomSmart_Stub(void* t) { - RoomSmart_Stub* rss = (RoomSmart_Stub*) t; - delete rss; +RoomSmart_Stub::~RoomSmart_Stub() { + if (rmiComm != NULL) { + delete rmiComm; + rmiComm = NULL; + } +} + +mutex mtxRoomSmart_StubMethodExec0; +int RoomSmart_Stub::getRoomID() { + lock_guard guard(mtxRoomSmart_StubMethodExec0); + int methodId = 0; + string retType = "int"; + int numParam = 0; + string paramCls[] = { }; + void* paramObj[] = { }; + int retVal = 0; + void* retObj = &retVal; + rmiComm->remoteCall(objectId, methodId, paramCls, paramObj, numParam); + // Waiting for return value + while (!retValueReceived0); + rmiComm->getReturnValue(retType, retObj); + retValueReceived0 = false; + didGetReturnBytes.exchange(true); + + return retVal; } +extern "C" void* createRoomSmart_Stub(void** params) { + // Args: int _portSend, int _portRecv, const char* _skeletonAddress, int _rev, bool* _bResult + return new RoomSmart_Stub(*((int*) params[0]), *((int*) params[1]), ((string*) params[2])->c_str(), *((int*) params[3]), (bool*) params[4]); +} + +extern "C" void destroyRoomSmart_Stub(void* t) { + RoomSmart_Stub* obj = (RoomSmart_Stub*) t; + delete obj; +} extern "C" void initRoomSmart_Stub(void* t) { - // TODO: We actually need init() in LabRoom class - // But, this is declared here just for the sake of consistency for Sentinel - // In this case, we need the symbol "init" when loading object handlers with .so files - //RoomSmart_Stub* rss = (RoomSmart_Stub*) t; - //rss->init(); +} + +int main() { + return 0; } diff --git a/benchmarks/Cpp/Lifxtest/RoomSmart_Stub.hpp b/benchmarks/Cpp/Lifxtest/RoomSmart_Stub.hpp index 8c0f3cf..d978c18 100644 --- a/benchmarks/Cpp/Lifxtest/RoomSmart_Stub.hpp +++ b/benchmarks/Cpp/Lifxtest/RoomSmart_Stub.hpp @@ -1,8 +1,16 @@ #ifndef _ROOMSMART_STUB_HPP__ #define _ROOMSMART_STUB_HPP__ #include -#include +#include +#include +#include +#include +#include "IoTRMIComm.hpp" +#include "IoTRMICommClient.hpp" +#include "IoTRMICommServer.hpp" + #include "RoomSmart.hpp" +#include using namespace std; @@ -10,59 +18,18 @@ class RoomSmart_Stub : public RoomSmart { private: - IoTRMICall *rmiCall; - string callbackAddress; - vector ports; - - const static int objectId = 0; - + IoTRMIComm *rmiComm; + int objectId = 0; + // Synchronization variables + bool retValueReceived0 = false; ofstream log; - public: - - RoomSmart_Stub() { } - - RoomSmart_Stub(int _port, const char* _skeletonAddress, string _callbackAddress, int _rev, bool* _bResult, vector _ports) { - callbackAddress = _callbackAddress; - ports = _ports; - // Logging - int i=0; - string file = "RoomSmart_Stub_cpp" + to_string(i) + ".log"; - while (ifstream(file.c_str())) { - i++; - file = "RoomSmart_Stub_cpp" + to_string(i) + ".log"; - } - log.open(file); - log << "Port: " << _port << endl; - log << "Skeleton address: " << _skeletonAddress << endl; - log << "Callback address: " << callbackAddress << endl; - log << "Rev: " << _rev << endl; - log << "bResult: " << *_bResult << endl; - log << "Ports: " << _ports[0] << endl; - rmiCall = new IoTRMICall(_port, _skeletonAddress, _rev, _bResult); - log << "Established connection with skeleton!" << endl; - } - ~RoomSmart_Stub() { - if (rmiCall != NULL) { - delete rmiCall; - rmiCall = NULL; - } - } - - int getRoomID() { - log << "Calling getRoomID() in stub!" << endl; - int methodId = 0; - string retType = "int"; - int numParam = 0; - string paramCls[] = { }; - void* paramObj[] = { }; - int retVal = 0; - void* retObj = &retVal; - log << "About to remote call!" << endl; - rmiCall->remoteCall(objectId, methodId, retType, paramCls, paramObj, numParam, retObj); - log << "Remote call performed!" << endl; - return retVal; - } + public: + RoomSmart_Stub(); + RoomSmart_Stub(int _portSend, int _portRecv, const char* _skeletonAddress, int _rev, bool* _bResult); + RoomSmart_Stub(IoTRMIComm* _rmiComm, int _objectId); + ~RoomSmart_Stub(); + int getRoomID(); }; #endif diff --git a/benchmarks/drivers/Cpp/LabRoom/Room_Skeleton.cpp b/benchmarks/drivers/Cpp/LabRoom/Room_Skeleton.cpp index 8782fde..e29f567 100644 --- a/benchmarks/drivers/Cpp/LabRoom/Room_Skeleton.cpp +++ b/benchmarks/drivers/Cpp/LabRoom/Room_Skeleton.cpp @@ -1,25 +1,112 @@ #include #include "Room_Skeleton.hpp" +using namespace std; -// External create, destroy, and init functions -extern "C" void* createRoom_Skeleton(void** params) { - // Arguments: Room *_mainObj, string _callbackAddress, int _port - return new Room_Skeleton((Room*) params[0], *((string*) params[1]), *((int*) params[2])); +Room_Skeleton::Room_Skeleton(Room *_mainObj, int _portSend, int _portRecv) { + // Logging + int i=0; + string file = "Room_Skeleton_cpp" + to_string(i) + ".log"; + while (ifstream(file.c_str())) { + i++; + file = "Room_Skeleton_cpp" + to_string(i) + ".log"; + } + log.open(file); + log << "Port send: " << _portSend << endl; + log << "Port receive: " << _portRecv << endl; + bool _bResult = false; + mainObj = _mainObj; + rmiComm = new IoTRMICommServer(_portSend, _portRecv, &_bResult); + log << "Established connection with slave! Wait request invoke now..." << endl; + IoTRMIUtil::mapSkel->insert(make_pair(_mainObj, this)); + IoTRMIUtil::mapSkelId->insert(make_pair(_mainObj, objectId)); + rmiComm->registerSkeleton(objectId, &methodReceived); + thread th1 (&Room_Skeleton::___waitRequestInvokeMethod, this, this); + th1.join(); } +Room_Skeleton::Room_Skeleton(Room *_mainObj, IoTRMIComm *_rmiComm, int _objectId) { + bool _bResult = false; + mainObj = _mainObj; + rmiComm = _rmiComm; + objectId = _objectId; + rmiComm->registerSkeleton(objectId, &methodReceived); +} -extern "C" void destroyRoom_Skeleton(void* t) { - Room_Skeleton* rs = (Room_Skeleton*) t; - delete rs; +Room_Skeleton::~Room_Skeleton() { + if (rmiComm != NULL) { + delete rmiComm; + rmiComm = NULL; + } } +bool Room_Skeleton::didInitWaitInvoke() { + return didAlreadyInitWaitInvoke; +} + +int Room_Skeleton::getRoomID() { + return mainObj->getRoomID(); +} + +void Room_Skeleton::___getRoomID(Room_Skeleton* skel) { + char* localMethodBytes = new char[methodLen]; + memcpy(localMethodBytes, skel->methodBytes, methodLen); + didGetMethodBytes.exchange(true); + string paramCls[] = { }; + int numParam = 0; + void* paramObj[] = { }; + rmiComm->getMethodParams(paramCls, numParam, paramObj, localMethodBytes); + int retVal = getRoomID(); + void* retObj = &retVal; + rmiComm->sendReturnObj(retObj, "int", localMethodBytes); + delete[] localMethodBytes; +} + +void Room_Skeleton::___waitRequestInvokeMethod(Room_Skeleton* skel) { + skel->didAlreadyInitWaitInvoke = true; + while (true) { + if (!methodReceived) { + continue; + } + skel->methodBytes = skel->rmiComm->getMethodBytes(); + skel->methodLen = skel->rmiComm->getMethodLength(); + methodReceived = false; + int _objectId = skel->rmiComm->getObjectId(skel->methodBytes); + int methodId = skel->rmiComm->getMethodId(skel->methodBytes); + if (_objectId == objectId) { + if (set0Allowed.find(methodId) == set0Allowed.end()) { + cerr << "Object with object Id: " << _objectId << " is not allowed to access method: " << methodId << endl; + return; + } + } + else { + continue; + } + switch (methodId) { + case 0: { + thread th0 (&Room_Skeleton::___getRoomID, std::ref(skel), skel); + th0.detach(); break; + } + default: + cerr << "Method Id " << methodId << " not recognized!" << endl; + return; + } + } +} + +extern "C" void* createRoom_Skeleton(void** params) { + // Args: *_mainObj, int _portSend, int _portRecv + return new Room_Skeleton((Room*) params[0], *((int*) params[1]), *((int*) params[2])); +} + +extern "C" void destroyRoom_Skeleton(void* t) { + Room_Skeleton* obj = (Room_Skeleton*) t; + delete obj; +} extern "C" void initRoom_Skeleton(void* t) { - // TODO: We actually need init() in LabRoom class - // But, this is declared here just for the sake of consistency for Sentinel - // In this case, we need the symbol "init" when loading object handlers with .so files - //Room_Skeleton* rs = (Room_Skeleton*) t; - //rs->init(); } +int main() { + return 0; +} diff --git a/benchmarks/drivers/Cpp/LabRoom/Room_Skeleton.hpp b/benchmarks/drivers/Cpp/LabRoom/Room_Skeleton.hpp index fd88f24..715450c 100644 --- a/benchmarks/drivers/Cpp/LabRoom/Room_Skeleton.hpp +++ b/benchmarks/drivers/Cpp/LabRoom/Room_Skeleton.hpp @@ -1,13 +1,15 @@ #ifndef _ROOM_SKELETON_HPP__ #define _ROOM_SKELETON_HPP__ #include -#include #include "Room.hpp" #include #include -#include "IoTRMICall.hpp" -#include "IoTRMIObject.hpp" +#include "IoTRMIComm.hpp" +#include "IoTRMICommClient.hpp" +#include "IoTRMICommServer.hpp" + +#include using namespace std; @@ -16,85 +18,26 @@ class Room_Skeleton : public Room private: Room *mainObj; - vector ports; - string callbackAddress; - IoTRMIObject *rmiObj; - - const static int object0Id = 0; //RoomSmart + IoTRMIComm *rmiComm; + char* methodBytes; + int methodLen; + int objectId = 0; static set set0Allowed; - + // Synchronization variables + bool methodReceived = false; + bool didAlreadyInitWaitInvoke = false; ofstream log; - public: - Room_Skeleton(Room *_mainObj, string _callbackAddress, int _port) { - bool _bResult = false; - mainObj = _mainObj; - callbackAddress = _callbackAddress; - // Logging - int i=0; - string file = "Room_Skeleton_cpp" + to_string(i) + ".log"; - while (ifstream(file.c_str())) { - i++; - file = "Room_Skeleton_cpp" + to_string(i) + ".log"; - } - log.open(file); - log << "Callback address: " << callbackAddress << endl; - log << "Port: " << _port << endl; - rmiObj = new IoTRMIObject(_port, &_bResult); - log << "Established connection with slave! Wait request invoke now..." << endl; - ___waitRequestInvokeMethod(); - } - - ~Room_Skeleton() { - if (rmiObj != NULL) { - delete rmiObj; - rmiObj = NULL; - } - } - - int getRoomID() { - return mainObj->getRoomID(); - } - - void ___getRoomID() { - string paramCls[] = { }; - int numParam = 0; - void* paramObj[] = { }; - rmiObj->getMethodParams(paramCls, numParam, paramObj); - int retVal = getRoomID(); - void* retObj = &retVal; - rmiObj->sendReturnObj(retObj, "int"); - } - - void ___waitRequestInvokeMethod() { - while (true) { - log << "Getting into the while loop" << endl; - rmiObj->getMethodBytes(); - log << "Getting method bytes now" << endl; - log << "Method len: " << rmiObj->getMethodBytesLen() << endl; - int _objectId = rmiObj->getObjectId(); - log << "Object Id: " << _objectId << endl; - int methodId = rmiObj->getMethodId(); - log << "Method Id: " << methodId << endl; - 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: ___getRoomID(); break; - default: - cerr << "Method Id " << methodId << " not recognized!" << endl; - throw exception(); - } - } - } + public: + Room_Skeleton(); + Room_Skeleton(Room*_mainObj, int _portSend, int _portRecv); + Room_Skeleton(Room*_mainObj, IoTRMIComm *rmiComm, int _objectId); + ~Room_Skeleton(); + bool didInitWaitInvoke(); + int getRoomID(); + void ___getRoomID(Room_Skeleton* skel); + void ___waitRequestInvokeMethod(Room_Skeleton* skel); }; set Room_Skeleton::set0Allowed { 0 }; #endif diff --git a/benchmarks/drivers/Cpp/LifxLightBulb/LightBulb_Skeleton.cpp b/benchmarks/drivers/Cpp/LifxLightBulb/LightBulb_Skeleton.cpp index 7a7d9f1..e533d08 100644 --- a/benchmarks/drivers/Cpp/LifxLightBulb/LightBulb_Skeleton.cpp +++ b/benchmarks/drivers/Cpp/LifxLightBulb/LightBulb_Skeleton.cpp @@ -1,48 +1,469 @@ #include #include "LightBulb_Skeleton.hpp" -#include -#include "IoTSet.hpp" -#include "LifxLightBulb.cpp" -#include "IoTDeviceAddress.hpp" +using namespace std; -// External create, destroy, and init functions -extern "C" void* createLightBulb_Skeleton(void** params) { - // Arguments: LightBulb *_mainObj, string _callbackAddress, int _port - return new LightBulb_Skeleton((LightBulb*) params[0], *((string*) params[1]), *((int*) params[2])); +LightBulb_Skeleton::LightBulb_Skeleton(LightBulb *_mainObj, int _portSend, int _portRecv) { + bool _bResult = false; + mainObj = _mainObj; + rmiComm = new IoTRMICommServer(_portSend, _portRecv, &_bResult); + IoTRMIUtil::mapSkel->insert(make_pair(_mainObj, this)); + IoTRMIUtil::mapSkelId->insert(make_pair(_mainObj, objectId)); + rmiComm->registerSkeleton(objectId, &methodReceived); + thread th1 (&LightBulb_Skeleton::___waitRequestInvokeMethod, this, this); + th1.join(); } +LightBulb_Skeleton::LightBulb_Skeleton(LightBulb *_mainObj, IoTRMIComm *_rmiComm, int _objectId) { + bool _bResult = false; + mainObj = _mainObj; + rmiComm = _rmiComm; + objectId = _objectId; + rmiComm->registerSkeleton(objectId, &methodReceived); +} -extern "C" void destroyLightBulb_Skeleton(void* t) { - LightBulb_Skeleton* lbs = (LightBulb_Skeleton*) t; - delete lbs; +LightBulb_Skeleton::~LightBulb_Skeleton() { + if (rmiComm != NULL) { + delete rmiComm; + rmiComm = NULL; + } +} + +bool LightBulb_Skeleton::didInitWaitInvoke() { + return didAlreadyInitWaitInvoke; +} + +void LightBulb_Skeleton::init() { + mainObj->init(); +} + +void LightBulb_Skeleton::turnOff() { + mainObj->turnOff(); +} + +void LightBulb_Skeleton::turnOn() { + mainObj->turnOn(); +} + +bool LightBulb_Skeleton::getState() { + return mainObj->getState(); +} + +void LightBulb_Skeleton::setColor(double _hue, double _saturation, double _brightness) { + mainObj->setColor(_hue, _saturation, _brightness); +} + +void LightBulb_Skeleton::setTemperature(int _temperature) { + mainObj->setTemperature(_temperature); +} + +double LightBulb_Skeleton::getBrightness() { + return mainObj->getBrightness(); +} + +double LightBulb_Skeleton::getHue() { + return mainObj->getHue(); +} + +double LightBulb_Skeleton::getSaturation() { + return mainObj->getSaturation(); +} + +int LightBulb_Skeleton::getTemperature() { + return mainObj->getTemperature(); +} + +double LightBulb_Skeleton::getBrightnessRangeLowerBound() { + return mainObj->getBrightnessRangeLowerBound(); +} + +double LightBulb_Skeleton::getBrightnessRangeUpperBound() { + return mainObj->getBrightnessRangeUpperBound(); +} + +double LightBulb_Skeleton::getHueRangeLowerBound() { + return mainObj->getHueRangeLowerBound(); +} + +double LightBulb_Skeleton::getHueRangeUpperBound() { + return mainObj->getHueRangeUpperBound(); +} + +double LightBulb_Skeleton::getSaturationRangeLowerBound() { + return mainObj->getSaturationRangeLowerBound(); +} + +double LightBulb_Skeleton::getSaturationRangeUpperBound() { + return mainObj->getSaturationRangeUpperBound(); +} + +int LightBulb_Skeleton::getTemperatureRangeLowerBound() { + return mainObj->getTemperatureRangeLowerBound(); +} + +int LightBulb_Skeleton::getTemperatureRangeUpperBound() { + return mainObj->getTemperatureRangeUpperBound(); +} + +void LightBulb_Skeleton::___init(LightBulb_Skeleton* skel) { + char* localMethodBytes = new char[methodLen]; + memcpy(localMethodBytes, skel->methodBytes, methodLen); + didGetMethodBytes.exchange(true); + string paramCls[] = { }; + int numParam = 0; + void* paramObj[] = { }; + rmiComm->getMethodParams(paramCls, numParam, paramObj, localMethodBytes); + init(); + delete[] localMethodBytes; } +void LightBulb_Skeleton::___turnOff(LightBulb_Skeleton* skel) { + char* localMethodBytes = new char[methodLen]; + memcpy(localMethodBytes, skel->methodBytes, methodLen); + didGetMethodBytes.exchange(true); + string paramCls[] = { }; + int numParam = 0; + void* paramObj[] = { }; + rmiComm->getMethodParams(paramCls, numParam, paramObj, localMethodBytes); + turnOff(); + delete[] localMethodBytes; +} + +void LightBulb_Skeleton::___turnOn(LightBulb_Skeleton* skel) { + char* localMethodBytes = new char[methodLen]; + memcpy(localMethodBytes, skel->methodBytes, methodLen); + didGetMethodBytes.exchange(true); + string paramCls[] = { }; + int numParam = 0; + void* paramObj[] = { }; + rmiComm->getMethodParams(paramCls, numParam, paramObj, localMethodBytes); + turnOn(); + delete[] localMethodBytes; +} + +void LightBulb_Skeleton::___getState(LightBulb_Skeleton* skel) { + char* localMethodBytes = new char[methodLen]; + memcpy(localMethodBytes, skel->methodBytes, methodLen); + didGetMethodBytes.exchange(true); + string paramCls[] = { }; + int numParam = 0; + void* paramObj[] = { }; + rmiComm->getMethodParams(paramCls, numParam, paramObj, localMethodBytes); + bool retVal = getState(); + void* retObj = &retVal; + rmiComm->sendReturnObj(retObj, "boolean", localMethodBytes); + delete[] localMethodBytes; +} + +void LightBulb_Skeleton::___setColor(LightBulb_Skeleton* skel) { + char* localMethodBytes = new char[methodLen]; + memcpy(localMethodBytes, skel->methodBytes, methodLen); + didGetMethodBytes.exchange(true); + string paramCls[] = { "double", "double", "double" }; + int numParam = 3; + double _hue; + double _saturation; + double _brightness; + void* paramObj[] = { &_hue, &_saturation, &_brightness }; + rmiComm->getMethodParams(paramCls, numParam, paramObj, localMethodBytes); + setColor(_hue, _saturation, _brightness); + delete[] localMethodBytes; +} + +void LightBulb_Skeleton::___setTemperature(LightBulb_Skeleton* skel) { + char* localMethodBytes = new char[methodLen]; + memcpy(localMethodBytes, skel->methodBytes, methodLen); + didGetMethodBytes.exchange(true); + string paramCls[] = { "int" }; + int numParam = 1; + int _temperature; + void* paramObj[] = { &_temperature }; + rmiComm->getMethodParams(paramCls, numParam, paramObj, localMethodBytes); + setTemperature(_temperature); + delete[] localMethodBytes; +} + +void LightBulb_Skeleton::___getBrightness(LightBulb_Skeleton* skel) { + char* localMethodBytes = new char[methodLen]; + memcpy(localMethodBytes, skel->methodBytes, methodLen); + didGetMethodBytes.exchange(true); + string paramCls[] = { }; + int numParam = 0; + void* paramObj[] = { }; + rmiComm->getMethodParams(paramCls, numParam, paramObj, localMethodBytes); + double retVal = getBrightness(); + void* retObj = &retVal; + rmiComm->sendReturnObj(retObj, "double", localMethodBytes); + delete[] localMethodBytes; +} + +void LightBulb_Skeleton::___getHue(LightBulb_Skeleton* skel) { + char* localMethodBytes = new char[methodLen]; + memcpy(localMethodBytes, skel->methodBytes, methodLen); + didGetMethodBytes.exchange(true); + string paramCls[] = { }; + int numParam = 0; + void* paramObj[] = { }; + rmiComm->getMethodParams(paramCls, numParam, paramObj, localMethodBytes); + double retVal = getHue(); + void* retObj = &retVal; + rmiComm->sendReturnObj(retObj, "double", localMethodBytes); + delete[] localMethodBytes; +} + +void LightBulb_Skeleton::___getSaturation(LightBulb_Skeleton* skel) { + char* localMethodBytes = new char[methodLen]; + memcpy(localMethodBytes, skel->methodBytes, methodLen); + didGetMethodBytes.exchange(true); + string paramCls[] = { }; + int numParam = 0; + void* paramObj[] = { }; + rmiComm->getMethodParams(paramCls, numParam, paramObj, localMethodBytes); + double retVal = getSaturation(); + void* retObj = &retVal; + rmiComm->sendReturnObj(retObj, "double", localMethodBytes); + delete[] localMethodBytes; +} + +void LightBulb_Skeleton::___getTemperature(LightBulb_Skeleton* skel) { + char* localMethodBytes = new char[methodLen]; + memcpy(localMethodBytes, skel->methodBytes, methodLen); + didGetMethodBytes.exchange(true); + string paramCls[] = { }; + int numParam = 0; + void* paramObj[] = { }; + rmiComm->getMethodParams(paramCls, numParam, paramObj, localMethodBytes); + int retVal = getTemperature(); + void* retObj = &retVal; + rmiComm->sendReturnObj(retObj, "int", localMethodBytes); + delete[] localMethodBytes; +} + +void LightBulb_Skeleton::___getBrightnessRangeLowerBound(LightBulb_Skeleton* skel) { + char* localMethodBytes = new char[methodLen]; + memcpy(localMethodBytes, skel->methodBytes, methodLen); + didGetMethodBytes.exchange(true); + string paramCls[] = { }; + int numParam = 0; + void* paramObj[] = { }; + rmiComm->getMethodParams(paramCls, numParam, paramObj, localMethodBytes); + double retVal = getBrightnessRangeLowerBound(); + void* retObj = &retVal; + rmiComm->sendReturnObj(retObj, "double", localMethodBytes); + delete[] localMethodBytes; +} + +void LightBulb_Skeleton::___getBrightnessRangeUpperBound(LightBulb_Skeleton* skel) { + char* localMethodBytes = new char[methodLen]; + memcpy(localMethodBytes, skel->methodBytes, methodLen); + didGetMethodBytes.exchange(true); + string paramCls[] = { }; + int numParam = 0; + void* paramObj[] = { }; + rmiComm->getMethodParams(paramCls, numParam, paramObj, localMethodBytes); + double retVal = getBrightnessRangeUpperBound(); + void* retObj = &retVal; + rmiComm->sendReturnObj(retObj, "double", localMethodBytes); + delete[] localMethodBytes; +} + +void LightBulb_Skeleton::___getHueRangeLowerBound(LightBulb_Skeleton* skel) { + char* localMethodBytes = new char[methodLen]; + memcpy(localMethodBytes, skel->methodBytes, methodLen); + didGetMethodBytes.exchange(true); + string paramCls[] = { }; + int numParam = 0; + void* paramObj[] = { }; + rmiComm->getMethodParams(paramCls, numParam, paramObj, localMethodBytes); + double retVal = getHueRangeLowerBound(); + void* retObj = &retVal; + rmiComm->sendReturnObj(retObj, "double", localMethodBytes); + delete[] localMethodBytes; +} + +void LightBulb_Skeleton::___getHueRangeUpperBound(LightBulb_Skeleton* skel) { + char* localMethodBytes = new char[methodLen]; + memcpy(localMethodBytes, skel->methodBytes, methodLen); + didGetMethodBytes.exchange(true); + string paramCls[] = { }; + int numParam = 0; + void* paramObj[] = { }; + rmiComm->getMethodParams(paramCls, numParam, paramObj, localMethodBytes); + double retVal = getHueRangeUpperBound(); + void* retObj = &retVal; + rmiComm->sendReturnObj(retObj, "double", localMethodBytes); + delete[] localMethodBytes; +} + +void LightBulb_Skeleton::___getSaturationRangeLowerBound(LightBulb_Skeleton* skel) { + char* localMethodBytes = new char[methodLen]; + memcpy(localMethodBytes, skel->methodBytes, methodLen); + didGetMethodBytes.exchange(true); + string paramCls[] = { }; + int numParam = 0; + void* paramObj[] = { }; + rmiComm->getMethodParams(paramCls, numParam, paramObj, localMethodBytes); + double retVal = getSaturationRangeLowerBound(); + void* retObj = &retVal; + rmiComm->sendReturnObj(retObj, "double", localMethodBytes); + delete[] localMethodBytes; +} + +void LightBulb_Skeleton::___getSaturationRangeUpperBound(LightBulb_Skeleton* skel) { + char* localMethodBytes = new char[methodLen]; + memcpy(localMethodBytes, skel->methodBytes, methodLen); + didGetMethodBytes.exchange(true); + string paramCls[] = { }; + int numParam = 0; + void* paramObj[] = { }; + rmiComm->getMethodParams(paramCls, numParam, paramObj, localMethodBytes); + double retVal = getSaturationRangeUpperBound(); + void* retObj = &retVal; + rmiComm->sendReturnObj(retObj, "double", localMethodBytes); + delete[] localMethodBytes; +} + +void LightBulb_Skeleton::___getTemperatureRangeLowerBound(LightBulb_Skeleton* skel) { + char* localMethodBytes = new char[methodLen]; + memcpy(localMethodBytes, skel->methodBytes, methodLen); + didGetMethodBytes.exchange(true); + string paramCls[] = { }; + int numParam = 0; + void* paramObj[] = { }; + rmiComm->getMethodParams(paramCls, numParam, paramObj, localMethodBytes); + int retVal = getTemperatureRangeLowerBound(); + void* retObj = &retVal; + rmiComm->sendReturnObj(retObj, "int", localMethodBytes); + delete[] localMethodBytes; +} + +void LightBulb_Skeleton::___getTemperatureRangeUpperBound(LightBulb_Skeleton* skel) { + char* localMethodBytes = new char[methodLen]; + memcpy(localMethodBytes, skel->methodBytes, methodLen); + didGetMethodBytes.exchange(true); + string paramCls[] = { }; + int numParam = 0; + void* paramObj[] = { }; + rmiComm->getMethodParams(paramCls, numParam, paramObj, localMethodBytes); + int retVal = getTemperatureRangeUpperBound(); + void* retObj = &retVal; + rmiComm->sendReturnObj(retObj, "int", localMethodBytes); + delete[] localMethodBytes; +} + +void LightBulb_Skeleton::___waitRequestInvokeMethod(LightBulb_Skeleton* skel) { + skel->didAlreadyInitWaitInvoke = true; + while (true) { + if (!methodReceived) { + continue; + } + skel->methodBytes = skel->rmiComm->getMethodBytes(); + skel->methodLen = skel->rmiComm->getMethodLength(); + methodReceived = false; + int _objectId = skel->rmiComm->getObjectId(skel->methodBytes); + int methodId = skel->rmiComm->getMethodId(skel->methodBytes); + if (_objectId == objectId) { + if (set0Allowed.find(methodId) == set0Allowed.end()) { + cerr << "Object with object Id: " << _objectId << " is not allowed to access method: " << methodId << endl; + return; + } + } + else { + continue; + } + switch (methodId) { + case 0: { + thread th0 (&LightBulb_Skeleton::___init, std::ref(skel), skel); + th0.detach(); break; + } + case 1: { + thread th1 (&LightBulb_Skeleton::___turnOff, std::ref(skel), skel); + th1.detach(); break; + } + case 2: { + thread th2 (&LightBulb_Skeleton::___turnOn, std::ref(skel), skel); + th2.detach(); break; + } + case 3: { + thread th3 (&LightBulb_Skeleton::___getState, std::ref(skel), skel); + th3.detach(); break; + } + case 4: { + thread th4 (&LightBulb_Skeleton::___setColor, std::ref(skel), skel); + th4.detach(); break; + } + case 5: { + thread th5 (&LightBulb_Skeleton::___setTemperature, std::ref(skel), skel); + th5.detach(); break; + } + case 6: { + thread th6 (&LightBulb_Skeleton::___getBrightness, std::ref(skel), skel); + th6.detach(); break; + } + case 7: { + thread th7 (&LightBulb_Skeleton::___getHue, std::ref(skel), skel); + th7.detach(); break; + } + case 8: { + thread th8 (&LightBulb_Skeleton::___getSaturation, std::ref(skel), skel); + th8.detach(); break; + } + case 9: { + thread th9 (&LightBulb_Skeleton::___getTemperature, std::ref(skel), skel); + th9.detach(); break; + } + case 10: { + thread th10 (&LightBulb_Skeleton::___getBrightnessRangeLowerBound, std::ref(skel), skel); + th10.detach(); break; + } + case 11: { + thread th11 (&LightBulb_Skeleton::___getBrightnessRangeUpperBound, std::ref(skel), skel); + th11.detach(); break; + } + case 12: { + thread th12 (&LightBulb_Skeleton::___getHueRangeLowerBound, std::ref(skel), skel); + th12.detach(); break; + } + case 13: { + thread th13 (&LightBulb_Skeleton::___getHueRangeUpperBound, std::ref(skel), skel); + th13.detach(); break; + } + case 14: { + thread th14 (&LightBulb_Skeleton::___getSaturationRangeLowerBound, std::ref(skel), skel); + th14.detach(); break; + } + case 15: { + thread th15 (&LightBulb_Skeleton::___getSaturationRangeUpperBound, std::ref(skel), skel); + th15.detach(); break; + } + case 16: { + thread th16 (&LightBulb_Skeleton::___getTemperatureRangeLowerBound, std::ref(skel), skel); + th16.detach(); break; + } + case 17: { + thread th17 (&LightBulb_Skeleton::___getTemperatureRangeUpperBound, std::ref(skel), skel); + th17.detach(); break; + } + default: + cerr << "Method Id " << methodId << " not recognized!" << endl; + return; + } + } +} + +extern "C" void* createLightBulb_Skeleton(void** params) { + // Args: *_mainObj, int _portSend, int _portRecv + return new LightBulb_Skeleton((LightBulb*) params[0], *((int*) params[0]), *((int*) params[1])); +} + +extern "C" void destroyLightBulb_Skeleton(void* t) { + LightBulb_Skeleton* obj = (LightBulb_Skeleton*) t; + delete obj; +} extern "C" void initLightBulb_Skeleton(void* t) { - LightBulb_Skeleton* lbs = (LightBulb_Skeleton*) t; - lbs->init(); -} - - -/*int main(int argc, char *argv[]) -{ - // LightBulb #1 - string macAddress1 = "D073D5128E300000"; - string devIPAddress1 = "192.168.2.126"; - //string macAddress1 = "D073D50241DA0000"; - //string devIPAddress1 = "192.168.2.232"; - IoTDeviceAddress* devAddress1 = new IoTDeviceAddress(devIPAddress1, 43583, 56700, false, false); - unordered_set* myset1 = new unordered_set(); - myset1->insert(devAddress1); - IoTSet* setDevAddress1 = new IoTSet(myset1); - LifxLightBulb *llb1 = new LifxLightBulb(setDevAddress1, macAddress1); - //cout << "Generated LifxLightBulb object!" << endl; - - string callbackAddress = "localhost"; - int stubPort = 55179; - LightBulb_Skeleton *lbs = new LightBulb_Skeleton(llb1, callbackAddress, stubPort); - //cout << "Successfully instantiated object and its skeleton!" << endl; +} +int main() { return 0; -}*/ +} diff --git a/benchmarks/drivers/Cpp/LifxLightBulb/LightBulb_Skeleton.hpp b/benchmarks/drivers/Cpp/LifxLightBulb/LightBulb_Skeleton.hpp index be35d65..2a06e73 100644 --- a/benchmarks/drivers/Cpp/LifxLightBulb/LightBulb_Skeleton.hpp +++ b/benchmarks/drivers/Cpp/LifxLightBulb/LightBulb_Skeleton.hpp @@ -1,13 +1,13 @@ #ifndef _LIGHTBULB_SKELETON_HPP__ #define _LIGHTBULB_SKELETON_HPP__ #include -#include #include "LightBulb.hpp" #include #include -#include "IoTRMICall.hpp" -#include "IoTRMIObject.hpp" +#include "IoTRMIComm.hpp" +#include "IoTRMICommClient.hpp" +#include "IoTRMICommServer.hpp" using namespace std; @@ -16,336 +16,60 @@ class LightBulb_Skeleton : public LightBulb private: LightBulb *mainObj; - vector ports; - string callbackAddress; - IoTRMIObject *rmiObj; - - const static int object0Id = 0; //LightBulbSmart + IoTRMIComm *rmiComm; + char* methodBytes; + int methodLen; + int objectId = 0; static set set0Allowed; + // Synchronization variables + bool methodReceived = false; + bool didAlreadyInitWaitInvoke = false; - ofstream log; - public: - - LightBulb_Skeleton(LightBulb *_mainObj, string _callbackAddress, int _port) { - bool _bResult = false; - mainObj = _mainObj; - callbackAddress = _callbackAddress; - // Logging - int i=0; - string file = "LightBulb_Skeleton_cpp" + to_string(i) + ".log"; - while (ifstream(file.c_str())) { - i++; - file = "LightBulb_Skeleton_cpp" + to_string(i) + ".log"; - } - log.open(file); - log << "Callback address: " << callbackAddress << endl; - log << "Port: " << _port << endl; - rmiObj = new IoTRMIObject(_port, &_bResult); - log << "Established connection with slave! Wait request invoke now..." << endl; - ___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) { - log << "Getting into the while loop" << endl; - rmiObj->getMethodBytes(); - log << "Getting method bytes now" << endl; - log << "Method len: " << rmiObj->getMethodBytesLen() << endl; - int _objectId = rmiObj->getObjectId(); - log << "Object Id: " << _objectId << endl; - int methodId = rmiObj->getMethodId(); - log << "Method Id: " << methodId << endl; - 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(); - } - } - log.close(); - } + public: + LightBulb_Skeleton(); + LightBulb_Skeleton(LightBulb*_mainObj, int _portSend, int _portRecv); + LightBulb_Skeleton(LightBulb*_mainObj, IoTRMIComm *rmiComm, int _objectId); + ~LightBulb_Skeleton(); + bool didInitWaitInvoke(); + void init(); + void turnOff(); + void turnOn(); + bool getState(); + void setColor(double _hue, double _saturation, double _brightness); + void setTemperature(int _temperature); + double getBrightness(); + double getHue(); + double getSaturation(); + int getTemperature(); + double getBrightnessRangeLowerBound(); + double getBrightnessRangeUpperBound(); + double getHueRangeLowerBound(); + double getHueRangeUpperBound(); + double getSaturationRangeLowerBound(); + double getSaturationRangeUpperBound(); + int getTemperatureRangeLowerBound(); + int getTemperatureRangeUpperBound(); + void ___init(LightBulb_Skeleton* skel); + void ___turnOff(LightBulb_Skeleton* skel); + void ___turnOn(LightBulb_Skeleton* skel); + void ___getState(LightBulb_Skeleton* skel); + void ___setColor(LightBulb_Skeleton* skel); + void ___setTemperature(LightBulb_Skeleton* skel); + void ___getBrightness(LightBulb_Skeleton* skel); + void ___getHue(LightBulb_Skeleton* skel); + void ___getSaturation(LightBulb_Skeleton* skel); + void ___getTemperature(LightBulb_Skeleton* skel); + void ___getBrightnessRangeLowerBound(LightBulb_Skeleton* skel); + void ___getBrightnessRangeUpperBound(LightBulb_Skeleton* skel); + void ___getHueRangeLowerBound(LightBulb_Skeleton* skel); + void ___getHueRangeUpperBound(LightBulb_Skeleton* skel); + void ___getSaturationRangeLowerBound(LightBulb_Skeleton* skel); + void ___getSaturationRangeUpperBound(LightBulb_Skeleton* skel); + void ___getTemperatureRangeLowerBound(LightBulb_Skeleton* skel); + void ___getTemperatureRangeUpperBound(LightBulb_Skeleton* skel); + void ___waitRequestInvokeMethod(LightBulb_Skeleton* skel); }; -set LightBulb_Skeleton::set0Allowed { 2, 10, 1, 3, 11, 8, 12, 7, 13, 9, 6, 16, 17, 4, 0, 14, 15, 5 }; - +set LightBulb_Skeleton::set0Allowed { 2, 6, 1, 3, 4, 8, 0, 5, 7, 9 }; #endif diff --git a/iotjava/Makefile b/iotjava/Makefile index 5210cab..6d74c11 100644 --- a/iotjava/Makefile +++ b/iotjava/Makefile @@ -32,8 +32,8 @@ PHONY += run-compiler-lbtest run-compiler-lbtest: cp ../localconfig/iotpolicy/LifxLightBulb/*.pol $(BIN_DIR)/iotpolicy/ cp ../localconfig/iotpolicy/LifxLightBulb/*.req $(BIN_DIR)/iotpolicy/ - cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler lifxlightbulb.pol lifxtest.req -java Java - #cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler lifxlightbulb.pol lifxtest.req -cplus Cplus + #cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler lifxlightbulb.pol lifxtest.req -java Java + cd $(BIN_DIR)/iotpolicy; $(JAVA) -cp .:..:../$(PARSERJARS):../$(BIN_DIR) iotpolicy.IoTCompiler lifxlightbulb.pol lifxtest.req -cplus Cplus # SmartLightsController PHONY += run-compiler-lifx diff --git a/iotjava/iotpolicy/IoTCompiler.java b/iotjava/iotpolicy/IoTCompiler.java index f127cda..425eebc 100644 --- a/iotjava/iotpolicy/IoTCompiler.java +++ b/iotjava/iotpolicy/IoTCompiler.java @@ -3239,11 +3239,11 @@ public class IoTCompiler { println(newStubClass + "* obj = (" + newStubClass + "*) t;"); println("delete obj;"); println("}\n"); - //println("extern \"C\" void init" + newStubClass + "(void* t) {"); + println("extern \"C\" void init" + newStubClass + "(void* t) {"); //println(newStubClass + "* obj = (" + newStubClass + "*) t;"); //println("obj->init();"); //println("while(true);"); - //println("}\n"); + println("}\n"); } @@ -4338,17 +4338,17 @@ public class IoTCompiler { println("extern \"C\" void* create" + newSkelClass + "(void** params) {"); println("// Args: *_mainObj, int _portSend, int _portRecv"); - println("return new " + newSkelClass + "((" + intface + "*) params[0], *((int*) params[0]), *((int*) params[1]));"); + println("return new " + newSkelClass + "((" + intface + "*) params[0], *((int*) params[1]), *((int*) params[2]));"); println("}\n"); println("extern \"C\" void destroy" + newSkelClass + "(void* t) {"); println(newSkelClass + "* obj = (" + newSkelClass + "*) t;"); println("delete obj;"); println("}\n"); - //println("extern \"C\" void init" + newSkelClass + "(void* t) {"); + println("extern \"C\" void init" + newSkelClass + "(void* t) {"); //println(newSkelClass + "* obj = (" + newSkelClass + "*) t;"); //println("obj->init();"); //println("while(true);"); - //println("}\n"); + println("}\n"); } diff --git a/iotjava/iotruntime/cpp/iotslave/IoTSlave.cpp b/iotjava/iotruntime/cpp/iotslave/IoTSlave.cpp index 38dcf72..e4d4864 100644 --- a/iotjava/iotruntime/cpp/iotslave/IoTSlave.cpp +++ b/iotjava/iotruntime/cpp/iotslave/IoTSlave.cpp @@ -3,8 +3,6 @@ #include "IoTSlave.hpp" -#include "Lifxtest.cpp" - IoTSlave::IoTSlave(string _serverAddress, int _serverPort, string _objectName) { //isDriverObject = false; // Default to false @@ -248,9 +246,11 @@ void IoTSlave::instantiateSkelObject() { void* params[SKELPARAMSIZE]; params[0] = objMainCls; - string callbackAddress = LOCALHOST; - params[1] = &callbackAddress; - params[2] = &objectStubPort; + //string callbackAddress = LOCALHOST; + //params[1] = &callbackAddress; + //params[2] = &objectStubPort; + params[1] = &objectStubPort; + params[2] = &objectRegPort; writeToFile("Skeleton Object " + objectSkelClass + " created for " + objectClassName); // After this, this slave needs to be killed using "pkill IoTSlave" because it's waiting in an infinite while-loop objSkelCls = create_object(params); @@ -262,16 +262,21 @@ void IoTSlave::instantiateStubObject() { void* params[STUBPARAMSIZE]; params[0] = &objectStubPort; - params[1] = &hostAddress; - string callbackAddress = LOCALHOST; - params[2] = &callbackAddress; + params[1] = &objectRegPort; + params[2] = &hostAddress; + //params[0] = &objectStubPort; + //params[1] = &hostAddress; + //string callbackAddress = LOCALHOST; + //params[2] = &callbackAddress; int rev = 0; params[3] = &rev; bool result = false; params[4] = &result; - params[5] = ports; + //params[5] = ports; writeToFile("Stub Object " + objectStubClass + " created for " + objectClassName); + writeToFile("Success 1!"); objStubCls = create_object(params); + writeToFile("Success 2!"); } @@ -512,16 +517,6 @@ void IoTSlave::reinitializeIoTSetField() { // Collect IoTSet field first in a vector vecIoTSet.push_back(iotsetObject); - // Create object if this is for driver object - // Right now we assume that this needs only one object per device - /*if (isDriverObject) { - // Instantiate driver object - getObjectHandler(objectClassName); - instantiateDriverObject(); - // Instantiate skeleton object - getObjectHandler(objectSkelClass); - instantiateSkelObject(); - }*/ } diff --git a/iotjava/iotruntime/cpp/iotslave/IoTSlave.hpp b/iotjava/iotruntime/cpp/iotslave/IoTSlave.hpp index 6c96604..1d14eac 100644 --- a/iotjava/iotruntime/cpp/iotslave/IoTSlave.hpp +++ b/iotjava/iotruntime/cpp/iotslave/IoTSlave.hpp @@ -60,7 +60,8 @@ class IoTSlave { // Constants const static int RCVBUFSIZE = 1024; // Size of receive buffer const static int SKELPARAMSIZE = 3; // Number of params for skeleton - const static int STUBPARAMSIZE = 6; // Number of params for stub + //const static int STUBPARAMSIZE = 6; // Number of params for stub + const static int STUBPARAMSIZE = 5; // Number of params for stub const static string FILEPATH; // File path const static string FILEEXT; // File extension const static string SOEXT; // Shared object (.so) extension diff --git a/iotjava/iotruntime/slave/IoTSlave.java b/iotjava/iotruntime/slave/IoTSlave.java index 3231f54..0b6401d 100644 --- a/iotjava/iotruntime/slave/IoTSlave.java +++ b/iotjava/iotruntime/slave/IoTSlave.java @@ -226,11 +226,8 @@ public class IoTSlave { Class clsSkel = Class.forName(strObjSkelName); Class clsInt = Class.forName(STR_OBJ_CLS_PFX + "." + STR_INTERFACE_PFX + "." + sMessage.getObjectInterfaceName()); - //Class[] clsSkelParams = { clsInt, String.class, int.class }; // Port number is integer Class[] clsSkelParams = { clsInt, int.class, int.class }; // Port number is integer Constructor objSkelCons = clsSkel.getDeclaredConstructor(clsSkelParams); - //String callbackAddress = InetAddress.getLocalHost().getHostAddress(); // Callback address is this machine's address - //Object objSkelParams[] = { objMainCls, callbackAddress, iRMIStubPort }; Object objSkelParams[] = { objMainCls, iRMIStubPort, iRMIRegPort }; // Create a new thread for each skeleton Thread objectThread = new Thread(new Runnable() { @@ -486,15 +483,10 @@ public class IoTSlave { // Instantiate the stub and put in the object String strObjStubName = sMainObjectName + "." + sMessage.getObjectStubInterfaceName() + STUB_CLASS_SUFFIX; Class clsStub = Class.forName(strObjStubName); // Port number is integer - //Class[] clsStubParams = { int.class, String.class, String.class, int.class, int[].class }; Class[] clsStubParams = { int.class, int.class, int.class, int.class, String.class, int.class }; Constructor objStubCons = clsStub.getDeclaredConstructor(clsStubParams); - //Integer[] portsInteger = sMessage.getRMICallbackPorts(); - //int[] ports = Arrays.stream(portsInteger).mapToInt(Integer::intValue).toArray(); int rev = 0; - //String callbackAddress = InetAddress.getLocalHost().getHostAddress(); // Callback address is this machine's address - //Object objStubParams[] = { sMessage.getRMIStubPort(), sMessage.getHostAddress(), callbackAddress, rev, ports }; Object objStubParams[] = { 0, 0, sMessage.getRMIStubPort(), sMessage.getRMIRegPort(), sMessage.getHostAddress(), rev }; RuntimeOutput.print("IoTSlave: Creating RMI stub: " + sMessage.getHostAddress() + ":" + sMessage.getRMIRegPort() + -- 2.34.1