replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / service / notification / src / provider / NSProviderResource.c
index 0fb9e44..c4d2b58 100644 (file)
@@ -27,17 +27,17 @@ NSMessageResource NotificationMessageResource;
 NSSyncResource NotificationSyncResource;
 NSTopicResource NotificationTopicResource;
 
-#if(defined WITH_CLOUD && defined RD_CLIENT)
+#if (defined WITH_CLOUD)
 #define DEFAULT_CONTEXT_VALUE 0x99
 
 OCStackApplicationResult NSHandlePublishCb(void *ctx, OCDoHandle handle,
     OCClientResponse *clientResponse)
 {
     (void) handle;
-    if(ctx != (void *)DEFAULT_CONTEXT_VALUE)
+    if (ctx != (void *)DEFAULT_CONTEXT_VALUE)
     {
         NS_LOG(DEBUG, "Invalid Publish callback received");
-    } 
+    }
 
     NS_LOG_V(DEBUG, "Publish resource response received code: %d", clientResponse->result);
 
@@ -48,15 +48,15 @@ NSResult NSPublishResourceToCloud(char *serverAddress)
 {
 
     NS_LOG(DEBUG, "NSPublishResourceToCloud - IN");
-    NS_LOG_V(DEBUG, "Remote Server Address: %s", serverAddress);
+    NS_LOG_V(INFO_PRIVATE, "Remote Server Address: %s", serverAddress);
 
     OCCallbackData cbData;
     cbData.cb = NSHandlePublishCb;
     cbData.context = (void *)DEFAULT_CONTEXT_VALUE;
     cbData.cd = NULL;
 
-    OCResourceHandle resourceHandles[1] = {NotificationResource.handle};
-    OCStackResult res = OCRDPublish(serverAddress, CT_ADAPTER_TCP, resourceHandles, 1,
+    OCResourceHandle resourceHandles[1] = { NotificationResource.handle };
+    OCStackResult res = OCRDPublish(NULL, serverAddress, CT_ADAPTER_TCP, resourceHandles, 1,
             &cbData, OC_LOW_QOS);
 
     if (res != OC_STACK_OK)
@@ -75,7 +75,7 @@ NSResult NSCreateResource(char *uri)
 
     if (!uri)
     {
-        NS_LOG(NS_ERROR, "Resource URI cannot be NULL");
+        NS_LOG(ERROR, "Resource URI cannot be NULL");
         return NS_ERROR;
     }
 
@@ -91,7 +91,7 @@ NSResult NSCreateResource(char *uri)
         NotificationResource.version = VERSION;
         NotificationResource.handle = NULL;
 
-        if(NSGetResourceSecurity())
+        if (NSGetResourceSecurity())
         {
             NS_LOG(DEBUG, "Create secured resource");
             resourceProperties = OC_DISCOVERABLE | OC_SECURE;
@@ -105,14 +105,14 @@ NSResult NSCreateResource(char *uri)
                 NS_ROOT_URI, NSEntityHandlerNotificationCb, NULL,
                 resourceProperties) != OC_STACK_OK)
         {
-            NS_LOG(NS_ERROR, "Fail to Create Notification Resource");
+            NS_LOG(ERROR, "Fail to Create Notification Resource");
             return NS_ERROR;
         }
 
         if (OCBindResourceInterfaceToResource(NotificationResource.handle, NS_INTERFACE_READ)
             != OC_STACK_OK)
         {
-            NS_LOG(NS_ERROR, "Fail to bind Notification Resource Type");
+            NS_LOG(ERROR, "Fail to bind Notification Resource Type");
             return NS_ERROR;
         }
     }
@@ -131,7 +131,7 @@ NSResult NSCreateResource(char *uri)
         NotificationMessageResource.topicName = NULL;
         NotificationMessageResource.mediaContents = NULL;
 
-        if(NSGetResourceSecurity())
+        if (NSGetResourceSecurity())
         {
             NS_LOG(DEBUG, "Create secured resource");
             resourceProperties = OC_OBSERVABLE | OC_SECURE;
@@ -145,14 +145,14 @@ NSResult NSCreateResource(char *uri)
                 NS_INTERFACE_BASELINE, NS_COLLECTION_MESSAGE_URI, NSEntityHandlerMessageCb, NULL,
                 resourceProperties) != OC_STACK_OK)
         {
-            NS_LOG(NS_ERROR, "Fail to Create Notification Message Resource");
+            NS_LOG(ERROR, "Fail to Create Notification Message Resource");
             return NS_ERROR;
         }
 
         if (OCBindResourceInterfaceToResource(NotificationMessageResource.handle, NS_INTERFACE_READ)
             != OC_STACK_OK)
         {
-            NS_LOG(NS_ERROR, "Fail to bind Notification Message Resource Type");
+            NS_LOG(ERROR, "Fail to bind Notification Message Resource Type");
             return NS_ERROR;
         }
     }
@@ -163,7 +163,7 @@ NSResult NSCreateResource(char *uri)
         NotificationSyncResource.state = NULL;
         NotificationSyncResource.handle = NULL;
 
-        if(NSGetResourceSecurity())
+        if (NSGetResourceSecurity())
         {
             NS_LOG(DEBUG, "Create secured resource");
             resourceProperties = OC_OBSERVABLE | OC_SECURE;
@@ -177,7 +177,7 @@ NSResult NSCreateResource(char *uri)
                 NS_INTERFACE_BASELINE, NS_COLLECTION_SYNC_URI, NSEntityHandlerSyncCb, NULL,
                 resourceProperties) != OC_STACK_OK)
         {
-            NS_LOG(NS_ERROR, "Fail to Create Notification Sync Resource");
+            NS_LOG(ERROR, "Fail to Create Notification Sync Resource");
             return NS_ERROR;
         }
 
@@ -185,7 +185,7 @@ NSResult NSCreateResource(char *uri)
                 NS_INTERFACE_READWRITE)
             != OC_STACK_OK)
         {
-            NS_LOG(NS_ERROR, "Fail to bind Notification Sync Resource Type");
+            NS_LOG(ERROR, "Fail to bind Notification Sync Resource Type");
             return NS_ERROR;
         }
     }
@@ -196,7 +196,7 @@ NSResult NSCreateResource(char *uri)
         NotificationTopicResource.TopicList = NULL;
         NotificationTopicResource.handle = NULL;
 
-        if(NSGetResourceSecurity())
+        if (NSGetResourceSecurity())
         {
             NS_LOG(DEBUG, "Create secured resource");
             resourceProperties = OC_RES_PROP_NONE | OC_SECURE;
@@ -210,7 +210,7 @@ NSResult NSCreateResource(char *uri)
                 NS_INTERFACE_BASELINE, NS_COLLECTION_TOPIC_URI, NSEntityHandlerTopicCb, NULL,
                 resourceProperties) != OC_STACK_OK)
         {
-            NS_LOG(NS_ERROR, "Fail to Create Notification Sync Resource");
+            NS_LOG(ERROR, "Fail to Create Notification Sync Resource");
             return NS_ERROR;
         }
 
@@ -218,7 +218,7 @@ NSResult NSCreateResource(char *uri)
                 NS_INTERFACE_READWRITE)
             != OC_STACK_OK)
         {
-            NS_LOG(NS_ERROR, "Fail to bind Notification Topic Resource Type");
+            NS_LOG(ERROR, "Fail to bind Notification Topic Resource Type");
             return NS_ERROR;
         }
     }