Merge branch 'security-CKM' into 'master'
[platform/upstream/iotivity.git] / resource / examples / lightserver.cpp
old mode 100755 (executable)
new mode 100644 (file)
index f95722d..dd207d5
@@ -52,7 +52,7 @@ bool isSlowResponse = false;
 // Forward declaring the entityHandler
 
 /// This class represents a single resource named 'lightResource'. This resource has
-/// two simple properties named 'state' and 'power'
+/// one simple attribute, power
 
 class LightResource
 {
@@ -176,12 +176,6 @@ OCEntityHandlerResult entityHandler(std::shared_ptr<OCResourceRequest> request)
         std::string requestType = request->getRequestType();
         int requestFlag = request->getRequestHandlerFlag();
 
-        if(requestFlag & RequestHandlerFlag::InitFlag)
-        {
-            cout << "\t\trequestFlag : Init\n";
-
-            // entity handler to perform resource initialization operations
-        }
         if(requestFlag & RequestHandlerFlag::RequestFlag)
         {
             cout << "\t\trequestFlag : Request\n";
@@ -289,7 +283,7 @@ void * handleSlowResponse (void *param, std::shared_ptr<OCResourceRequest> pRequ
 }
 
 
-int main(int argc, char* argv[])
+int main(int /*argc*/, char** /*argv[]*/)
 {
     // Create PlatformConfig object
     PlatformConfig cfg {
@@ -311,7 +305,7 @@ int main(int argc, char* argv[])
         myLight.createResource();
 
         myLight.addType(std::string("core.brightlight"));
-        myLight.addInterface(std::string("oc.mi.ll"));
+        myLight.addInterface(std::string(LINK_INTERFACE));
 
         // A condition variable will free the mutex it is given, then do a non-
         // intensive block until 'notify' is called on it.  In this case, since we
@@ -322,9 +316,9 @@ int main(int argc, char* argv[])
         std::unique_lock<std::mutex> lock(blocker);
         cv.wait(lock);
     }
-    catch(OCException e)
+    catch(OCException& e)
     {
-        //log(e.what());
+       oclog() << "Exception in main: "<< e.what();
     }
 
     // No explicit call to stop the platform.
@@ -332,3 +326,4 @@ int main(int argc, char* argv[])
 
     return 0;
 }
+