Working C++ IoTSlave for both IoTSet and IoTRelation; threading works for C++ LifxLig...
[iot2.git] / benchmarks / Cpp / Lifxtest / LightBulbTest_Stub.hpp
index 3e20d5bc533c8dfcdea49bd2b56489dc10d2c335..a855a7308b939b0307c4fa50495d55a19a626ecd 100644 (file)
@@ -26,7 +26,13 @@ class LightBulbTest_Stub : public LightBulbTest
                callbackAddress = _callbackAddress;
                ports = _ports;
                // Logging
-               log.open("LightBulbTest_Stub_cpp.log");
+               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;
@@ -45,14 +51,17 @@ class LightBulbTest_Stub : public LightBulbTest
                }
        }
        
-       void turnOn() { 
+       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() { 
@@ -67,14 +76,17 @@ class LightBulbTest_Stub : public LightBulbTest
                return retVal;
        }
 
-       void turnOff() { 
+       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() {