Logging improvements for resource container android extension
authorMarkus Jung <markus.jung@samsung.com>
Mon, 4 Jan 2016 00:30:39 +0000 (09:30 +0900)
committerUze Choi <uzchoi@samsung.com>
Mon, 4 Jan 2016 09:36:51 +0000 (09:36 +0000)
Required WAKE_LOCK permission for Android container sample

Change-Id: I19449c76e55e0340c3e6e79d358c7f3bc3942466
Signed-off-by: Markus Jung <markus.jung@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/4747
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
service/resource-container/examples/android/ContainerSampleApp/app/src/main/AndroidManifest.xml
service/resource-container/src/Configuration.cpp
service/resource-container/src/DiscoverResourceUnit.cpp
service/resource-container/src/InternalTypes.h
service/resource-container/src/ResourceContainerImpl.cpp

index a3a455b..f58486e 100755 (executable)
@@ -6,6 +6,7 @@
 
     <uses-permission android:name="android.permission.CAMERA" />
     <uses-permission android:name="android.permission.FLASHLIGHT"/>
+    <uses-permission android:name="android.permission.WAKE_LOCK"/>
     <uses-feature android:name="android.hardware.camera" />
     <uses-feature android:name="android.hardware.camera.autofocus" />
     <uses-feature android:name="android.hardware.camera.flash" />
index 830138e..3d7592e 100644 (file)
@@ -25,6 +25,7 @@
 #include "InternalTypes.h"
 
 #define CONTAINER_TAG "RESOURCE_CONTAINER"
+#define DISCOVER_TAG "DISCOVER_RESOURCE_UNIT"
 
 namespace OIC
 {
index 7d1e266..c9895bc 100644 (file)
@@ -52,7 +52,7 @@ void DiscoverResourceUnit::startDiscover(DiscoverResourceInfo info, UpdatedCB up
         return;
     }
 
-    OC_LOG_V(DEBUG, CONTAINER_TAG, "Start discover%s", info.resourceUri.c_str());
+    OC_LOG_V(DEBUG, DISCOVER_TAG, "Start discover %s", info.resourceUri.c_str());
 
     m_Uri = info.resourceUri;
     m_ResourceType = info.resourceType;
@@ -88,15 +88,19 @@ void DiscoverResourceUnit::discoverdCB(RCSRemoteResourceObject::Ptr remoteObject
 {
     if (remoteObject && !isAlreadyDiscoveredResource(remoteObject))
     {
-        OC_LOG_V(DEBUG, CONTAINER_TAG, "Discovered%s", uri.c_str());
-        RemoteResourceUnit::Ptr newDiscoveredResource =
-            RemoteResourceUnit::createRemoteResourceInfo(remoteObject, pUpdatedCBFromServer);
-
-        if (uri.empty() || uri.compare(remoteObject->getUri()) == 0)
-        {
-            m_vecRemoteResource.push_back(newDiscoveredResource);
-            newDiscoveredResource->startMonitoring();
-            newDiscoveredResource->startCaching();
+        OC_LOG_V(DEBUG, DISCOVER_TAG, "Discovered - uri: %s", uri.c_str());
+        if (uri.empty() || uri.compare(remoteObject->getUri()) == 0){
+            RemoteResourceUnit::Ptr newDiscoveredResource =
+                       RemoteResourceUnit::createRemoteResourceInfo(remoteObject,
+                               pUpdatedCBFromServer);
+                m_vecRemoteResource.push_back(newDiscoveredResource);
+                newDiscoveredResource->startMonitoring();
+                newDiscoveredResource->startCaching();
+
+            OC_LOG_V(DEBUG, DISCOVER_TAG, "Created remote resource unit");
+        }
+        else{
+            OC_LOG_V(DEBUG, DISCOVER_TAG, "URI is not matching - uri: %s", uri.c_str());
         }
     }
     else
index 580f118..76cc224 100644 (file)
@@ -28,6 +28,7 @@ namespace OIC
     namespace Service
     {
         constexpr char CONTAINER_TAG[] = "RESOURCE_CONTAINER";
+        constexpr char DISCOVER_TAG[] = "DISCOVER_RESOURCE_UNIT";
 
         constexpr char BUNDLE_TAG[] = "bundle";
         constexpr char BUNDLE_ID[] = "id";
index 66d5a53..b6ecc34 100644 (file)
@@ -274,7 +274,8 @@ namespace OIC
             RCSResourceObject::Ptr server = nullptr;
 
             OC_LOG_V(INFO, CONTAINER_TAG, "Registration of resource (%s)" ,
-                     std::string(strUri + ", " + strResourceType + "," + resource->m_bundleId).c_str());
+                     std::string(strUri + ", " + strResourceType + "," +
+                             resource->m_bundleId).c_str());
 
             registrationLock.lock();
             if (m_mapResources.find(strUri) == m_mapResources.end())
@@ -300,14 +301,14 @@ namespace OIC
                     if (m_config->isHasInput(resource->m_bundleId))
                     {
                         OC_LOG_V(INFO, CONTAINER_TAG, "Resource has input (%s)",
-                                                                        std::string(strUri + ", " +
-                                                                                    strResourceType).c_str());
+                              std::string(strUri + ", " +
+                              strResourceType).c_str());
                         discoverInputResource(strUri);
                     }
                     else{
                         OC_LOG_V(INFO, CONTAINER_TAG, "Resource has no input (%s)",
-                                                                                                std::string(strUri + ", " +
-                                                                                                            strResourceType).c_str());
+                                 std::string(strUri + ", " +
+                                 strResourceType).c_str());
                     }
                     OC_LOG_V(INFO, CONTAINER_TAG, "Registration finished (%s)",
                                                 std::string(strUri + ", " +
@@ -811,7 +812,7 @@ namespace OIC
                         std::string attributeName = makeValue(INPUT_RESOURCE_ATTRIBUTENAME);
 
 
-                        OC_LOG_V(DEBUG, CONTAINER_TAG, "Start discovery %s, %s, %s", uri.c_str(),
+                        OC_LOG_V(DEBUG, CONTAINER_TAG, "Start discovery: %s, %s, %s", uri.c_str(),
                                 type.c_str(), attributeName.c_str());
                         DiscoverResourceUnit::Ptr newDiscoverUnit = std::make_shared
                                 < DiscoverResourceUnit > (outputResourceUri);