1 #ifndef _ROOM_SKELETON_HPP__
2 #define _ROOM_SKELETON_HPP__
9 #include "IoTRMICall.hpp"
10 #include "IoTRMIObject.hpp"
14 class Room_Skeleton : public Room
20 string callbackAddress;
23 const static int object0Id = 0; //RoomSmart
24 static set<int> set0Allowed;
29 Room_Skeleton(Room *_mainObj, string _callbackAddress, int _port) {
30 bool _bResult = false;
32 callbackAddress = _callbackAddress;
35 string file = "Room_Skeleton_cpp" + to_string(i) + ".log";
36 while (ifstream(file.c_str())) {
38 file = "Room_Skeleton_cpp" + to_string(i) + ".log";
41 log << "Callback address: " << callbackAddress << endl;
42 log << "Port: " << _port << endl;
43 rmiObj = new IoTRMIObject(_port, &_bResult);
44 log << "Established connection with slave! Wait request invoke now..." << endl;
45 ___waitRequestInvokeMethod();
56 return mainObj->getRoomID();
60 string paramCls[] = { };
62 void* paramObj[] = { };
63 rmiObj->getMethodParams(paramCls, numParam, paramObj);
64 int retVal = getRoomID();
65 void* retObj = &retVal;
66 rmiObj->sendReturnObj(retObj, "int");
69 void ___waitRequestInvokeMethod() {
71 log << "Getting into the while loop" << endl;
72 rmiObj->getMethodBytes();
73 log << "Getting method bytes now" << endl;
74 log << "Method len: " << rmiObj->getMethodBytesLen() << endl;
75 int _objectId = rmiObj->getObjectId();
76 log << "Object Id: " << _objectId << endl;
77 int methodId = rmiObj->getMethodId();
78 log << "Method Id: " << methodId << endl;
79 if (_objectId == object0Id) {
80 if (set0Allowed.find(methodId) == set0Allowed.end()) {
81 cerr << "Object with object Id: " << _objectId << " is not allowed to access method: " << methodId << endl;
86 cerr << "Object Id: " << _objectId << " not recognized!" << endl;
90 case 0: ___getRoomID(); break;
92 cerr << "Method Id " << methodId << " not recognized!" << endl;
99 set<int> Room_Skeleton::set0Allowed { 0 };