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;
34 log.open("LightBulb_Skeleton_cpp.log");
35 log << "Callback address: " << callbackAddress << endl;
36 log << "Port: " << _port << endl;
37 rmiObj = new IoTRMIObject(_port, &_bResult);
38 log << "Established connection with slave! Wait request invoke now..." << endl;
39 ___waitRequestInvokeMethod();
50 return mainObj->getRoomID();
54 string paramCls[] = { };
56 void* paramObj[] = { };
57 rmiObj->getMethodParams(paramCls, numParam, paramObj);
58 int retVal = getRoomID();
59 void* retObj = &retVal;
60 rmiObj->sendReturnObj(retObj, "int");
63 void ___waitRequestInvokeMethod() {
65 log << "Getting into the while loop" << endl;
66 rmiObj->getMethodBytes();
67 log << "Getting method bytes now" << endl;
68 log << "Method len: " << rmiObj->getMethodBytesLen() << endl;
69 int _objectId = rmiObj->getObjectId();
70 log << "Object Id: " << _objectId << endl;
71 int methodId = rmiObj->getMethodId();
72 log << "Method Id: " << methodId << endl;
73 if (_objectId == object0Id) {
74 if (set0Allowed.find(methodId) == set0Allowed.end()) {
75 cerr << "Object with object Id: " << _objectId << " is not allowed to access method: " << methodId << endl;
80 cerr << "Object Id: " << _objectId << " not recognized!" << endl;
84 case 0: ___getRoomID(); break;
86 cerr << "Method Id " << methodId << " not recognized!" << endl;
93 set<int> Room_Skeleton::set0Allowed { 0 };