Replace conditional compilation marcro WITH_CLOUD and bug fixed.
authorjaesick.shin <jaesick.shin@samsung.com>
Fri, 2 Sep 2016 03:50:56 +0000 (12:50 +0900)
committerUze Choi <uzchoi@samsung.com>
Fri, 2 Sep 2016 09:28:52 +0000 (09:28 +0000)
Macro RD_CLIENT is replaced with WITH_CLOUD.
The codes related to cloud service is not compiled according to
the conditional compilation with the marcro.

modify topic notification filter for remote message
This patch is bug-fix which adds topic notification filter for remote msg.

Change-Id: Ib61957dac3a193706386be5e121e5efdb2bbada8
Signed-off-by: jaesick.shin <jaesick.shin@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/11311
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: Uze Choi <uzchoi@samsung.com>
service/notification/src/provider/NSProviderDiscovery.c
service/notification/src/provider/NSProviderInterface.c
service/notification/src/provider/NSProviderNotification.c
service/notification/src/provider/NSProviderResource.c
service/notification/src/provider/NSProviderSubscription.c
service/notification/src/provider/NSProviderSystem.c
service/notification/src/provider/NSProviderTopic.c

index 5f9d195..81b5903 100644 (file)
@@ -79,7 +79,7 @@ void * NSDiscoverySchedule(void * ptr)
                     NS_LOG(DEBUG, "CASE TASK_REGISTER_RESOURCE : ");\r
                     NSRegisterResource();\r
                     break;\r
-#ifdef RD_CLIENT\r
+#if(defined WITH_CLOUD && defined RD_CLIENT)\r
                 case TASK_PUBLISH_RESOURCE:\r
                     NS_LOG(DEBUG, "CASE TASK_PUBLISH_PESOURCE : ");\r
                     NSPublishResourceToCloud((char*)node->taskData);\r
index 7c60796..0fbd5ed 100644 (file)
@@ -125,8 +125,9 @@ NSResult NSStopProvider()
     return NS_OK;\r
 }\r
 \r
-NSResult NSProviderEnableRemoteService(char * serverAddress)\r
+NSResult NSProviderEnableRemoteService(char *serverAddress)\r
 {\r
+#if(defined WITH_CLOUD && defined RD_CLIENT)\r
     NS_LOG(DEBUG, "NSProviderEnableRemoteService - IN");\r
     pthread_mutex_lock(&nsInitMutex);\r
 \r
@@ -136,20 +137,21 @@ NSResult NSProviderEnableRemoteService(char * serverAddress)
         pthread_mutex_unlock(&nsInitMutex);\r
         return NS_FAIL;\r
     }\r
-    NS_LOG(DEBUG, "Check the remote server login");\r
     NS_LOG_V(DEBUG, "Remote server address: %s", serverAddress);\r
-#ifdef RD_CLIENT\r
     NS_LOG(DEBUG, "Request to publish resource");\r
     NSPushQueue(DISCOVERY_SCHEDULER, TASK_PUBLISH_RESOURCE, serverAddress);\r
-#endif\r
 \r
     pthread_mutex_unlock(&nsInitMutex);\r
     NS_LOG(DEBUG, "NSProviderEnableRemoteService - OUT");\r
     return NS_OK;\r
+#endif\r
+    NS_LOG_V(DEBUG, "Not logged in remote server: %s", serverAddress);\r
+    return NS_FAIL;\r
 }\r
 \r
 NSResult NSProviderDisableRemoteService(char *serverAddress)\r
 {\r
+#if(defined WITH_CLOUD && defined RD_CLIENT)\r
     NS_LOG(DEBUG, "NSProviderDisableRemoteService - IN");\r
     pthread_mutex_lock(&nsInitMutex);\r
 \r
@@ -159,14 +161,16 @@ NSResult NSProviderDisableRemoteService(char *serverAddress)
         return NS_FAIL;\r
     }\r
     NS_LOG_V(DEBUG, "Remote server address: %s", serverAddress);\r
-#ifdef RD_CLIENT\r
+\r
     NS_LOG(DEBUG, "Delete remote server info");\r
     NSDeleteRemoteServerAddress(serverAddress);\r
-#endif\r
 \r
     pthread_mutex_unlock(&nsInitMutex);\r
     NS_LOG(DEBUG, "NSProviderDisableRemoteService - OUT");\r
     return NS_OK;\r
+#endif\r
+    NS_LOG_V(DEBUG, "Not logged in remote server : %s", serverAddress);\r
+    return NS_FAIL;\r
 }\r
 \r
 NSResult NSSendMessage(NSMessage * msg)\r
index 1b5f893..13ebdfd 100644 (file)
@@ -129,12 +129,16 @@ NSResult NSSendNotification(NSMessage *msg)
                 }
             }
 
-#ifdef RD_CLIENT
+#if(defined WITH_CLOUD && defined RD_CLIENT)
             if(subData->remote_messageObId != 0)
             {
-                if(NSProviderIsTopicSubScribed(consumerTopicList->head, subData->id, msg->topic))
+                if(msg->topic)
                 {
-                    obArray[obCount++] = subData->remote_messageObId;
+                    NS_LOG_V(DEBUG, "this is topic message via remote server: %s", msg->topic);
+                    if(NSProviderIsTopicSubScribed(consumerTopicList->head, subData->id, msg->topic))
+                    {
+                        obArray[obCount++] = subData->remote_messageObId;
+                    }
                 }
                 else
                 {
@@ -213,7 +217,7 @@ NSResult NSSendSync(NSSyncInfo *sync)
                 obArray[obCount++] = subData->syncObId;
             }
 
-#ifdef RD_CLIENT
+#if(defined WITH_CLOUD && defined RD_CLIENT)
             if(subData->remote_syncObId != 0)
             {
                 obArray[obCount++] = subData->remote_syncObId;
index fa26e0f..a3fa316 100644 (file)
@@ -26,7 +26,7 @@ NSMessageResource NotificationMessageResource;
 NSSyncResource NotificationSyncResource;
 NSTopicResource NotificationTopicResource;
 
-#ifdef RD_CLIENT
+#if(defined WITH_CLOUD && defined RD_CLIENT)
 #define DEFAULT_CONTEXT_VALUE 0x99
 
 OCStackApplicationResult NSHandlePublishCb(void *ctx, OCDoHandle handle,
index 4a07a00..090e78d 100644 (file)
@@ -134,7 +134,7 @@ void NSHandleSubscription(OCEntityHandlerRequest *entityHandlerRequest, NSResour
 \r
         bool iSRemoteServer = false;\r
 \r
-#ifdef RD_CLIEND\r
+#if(defined WITH_CLOUD && defined RD_CLIENT)\r
         iSRemoteServer = NSIsRemoteServerAddress(entityHandlerRequest->devAddr.addr);\r
         if(iSRemoteServer)\r
         {\r
@@ -190,7 +190,7 @@ void NSHandleSubscription(OCEntityHandlerRequest *entityHandlerRequest, NSResour
         subData->remote_syncObId = subData->syncObId = 0;\r
         bool isRemoteServer = false;\r
 \r
-#ifdef RD_CLIENT\r
+#if(defined WITH_CLOUD && defined RD_CLIENT)\r
         isRemoteServer = NSIsRemoteServerAddress(entityHandlerRequest->devAddr.addr);\r
         if(isRemoteServer)\r
         {\r
index a3eef6f..deeb4c5 100644 (file)
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
 #include "NSProviderSystem.h"\r
 \r
+#if(defined WITH_CLOUD && defined RD_CLIENT)\r
 #define MAX_SERVER_ADDRESS 32\r
-static NSConnectionState NSProviderConnectionState;\r
-\r
-#ifdef RD_CLIENT\r
 static char NSRemoteServerAddress[MAX_SERVER_ADDRESS] = {0,};\r
 #endif\r
 \r
+static NSConnectionState NSProviderConnectionState;\r
+\r
 NSProviderInfo * providerInfo;\r
 bool NSPolicy = true;\r
 \r
@@ -43,7 +43,7 @@ NSConnectionState NSGetProviderConnectionState()
     return NSProviderConnectionState;\r
 }\r
 \r
-#ifdef RD_CLIENT\r
+#if(defined WITH_CLOUD && defined RD_CLIENT)\r
 void NSSetRemoteServerAddress(char *serverAddress)\r
 {\r
 \r
index 5474671..112c2ef 100644 (file)
@@ -133,13 +133,12 @@ NSResult NSSendTopicUpdation()
                 obArray[obCount++] = subData->messageObId;\r
             }\r
 \r
-#ifdef RD_CLIENT\r
+#if(defined WITH_CLOUD && defined RD_CLIENT)\r
             if(subData->remote_messageObId != 0)\r
             {\r
                 obArray[obCount++] = subData->remote_messageObId;\r
             }\r
 #endif\r
-\r
         }\r
         it = it->next;\r
     }\r