divide code about related cloud service.
authorjaesick.shin <jaesick.shin@samsung.com>
Tue, 2 Aug 2016 04:24:30 +0000 (13:24 +0900)
committerMadan Lanka <lanka.madan@samsung.com>
Wed, 3 Aug 2016 13:24:31 +0000 (13:24 +0000)
while scons builds, cloud service code is
not required without WITH_CLOUD option in scons options.
It was modified as follows, #ifdef WITH_CLOUD #endif in code.
we should modify cpp_wrapper layer.
so, this commit makes the related build script of cpp_wrapper being commented out.

Change-Id: I9172b32e9242cc8d9ed038f024437dbd3b28da43
Signed-off-by: jaesick.shin <jaesick.shin@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/9921
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
service/notification/SConscript
service/notification/examples/linux/notificationprovider.c
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

index e9aa079..012a9b2 100644 (file)
@@ -85,6 +85,9 @@ if target_os == 'android':
 if not env.get('RELEASE'):
     notification_env.PrependUnique(LIBS = ['gcov'])
     notification_env.AppendUnique(CCFLAGS = ['--coverage'])
+    
+if env.get('WITH_CLOUD') == True:      
+       notification_env.AppendUnique(CPPDEFINES = ['WITH_CLOUD'])    
 
 ######################################################################
 # Source files and Targets
@@ -127,8 +130,8 @@ notification_env.UserInstallTargetHeader('include/NSConsumerInterface.h',\
        'service/notification', 'NSConsumerInterface.h')
 
 # Go to build Unit test
-if target_os == 'linux':
-#SConscript('unittest/SConscript')
+if target_os == 'linux':
+ SConscript('unittest/SConscript')
 
 # Go to build sample apps
 SConscript('examples/SConscript')
@@ -138,4 +141,4 @@ if target_os == 'android':
     SConscript('android/SConscript')
 
  # Go to build c++ wrapper
-SConscript('cpp-wrapper/SConscript')
\ No newline at end of file
+#SConscript('cpp-wrapper/SConscript')
\ No newline at end of file
index 70d5821..105ef7c 100644 (file)
@@ -74,6 +74,7 @@ void syncCallback(NSSyncInfo *sync)
     printf("NS_APP Sync State: %d\n", sync->state);\r
 }\r
 \r
+#ifdef WITH_CLOUD\r
 OCStackApplicationResult CloudLoginoutCallback(void *ctx,\r
         OCDoHandle handle, OCClientResponse *clientResponse)\r
 {\r
@@ -104,6 +105,7 @@ OCStackApplicationResult CloudLoginoutCallback(void *ctx,
 \r
     return OC_STACK_KEEP_TRANSACTION;\r
 }\r
+#endif\r
 \r
 FILE* server_fopen(const char *path, const char *mode)\r
 {\r
@@ -205,13 +207,16 @@ int main()
                 printf("Session Code: ");\r
                 gets(REMOTE_SERVER_SESSION);\r
 \r
+#ifdef WITH_CLOUD\r
                 NSCloudLogin(REMOTE_SERVER_ADDRESS, REMOTE_SERVER_SESSION, CloudLoginoutCallback);\r
+#endif\r
                 printf("OCCloudLogin requested");\r
                 break;\r
             case 12:\r
                 printf("NSCloudLogout");\r
-\r
+#ifdef WITH_CLOUD\r
                 NSCloudLogout(REMOTE_SERVER_ADDRESS, REMOTE_SERVER_SESSION, CloudLoginoutCallback);\r
+#endif\r
                 printf("OCCloudLogout requested");\r
                 break;\r
             case 0:\r
index 37855be..74bd3be 100644 (file)
@@ -79,10 +79,12 @@ void * NSDiscoverySchedule(void * ptr)
                     NS_LOG(DEBUG, "CASE TASK_REGISTER_RESOURCE : ");\r
                     NSRegisterResource();\r
                     break;\r
+#ifdef WITH_CLOUD\r
                 case TASK_PUBLISH_RESOURCE:\r
                     NS_LOG(DEBUG, "CASE TASK_PUBLISH_PESOURCE : ");\r
                     NSPublishResourceToCloud((char*)node->taskData);\r
                     break;\r
+#endif\r
                 default:\r
                     break;\r
             }\r
index 60ee5ac..95c4662 100644 (file)
@@ -124,6 +124,7 @@ NSResult NSStopProvider()
     return NS_OK;\r
 }\r
 \r
+#ifdef WITH_CLOUD\r
 NSResult NSProviderEnableRemoteService(char *serverAddress)\r
 {\r
     NS_LOG(DEBUG, "NSProviderEnableRemoteService - IN");\r
@@ -160,6 +161,7 @@ NSResult NSProviderDisableRemoteService(char *serverAddress)
     NS_LOG(DEBUG, "NSProviderDisableRemoteService - OUT");\r
     return NS_OK;\r
 }\r
+#endif\r
 \r
 NSResult NSSendMessage(NSMessage *msg)\r
 {\r
index a149efd..3b1dced 100644 (file)
@@ -127,10 +127,13 @@ NSResult NSSendNotification(NSMessage *msg)
                 obArray[obCount++] = subData->messageObId;
             }
 
+#ifdef WITH_CLOUD
             if(subData->remote_messageObId != 0)
             {
                 obArray[obCount++] = subData->remote_messageObId;
             }
+#endif
+
         }
         it = it->next;
     }
@@ -201,10 +204,12 @@ NSResult NSSendSync(NSSyncInfo *sync)
                 obArray[obCount++] = subData->syncObId;
             }
 
+#ifdef WITH_CLOUD
             if(subData->remote_syncObId != 0)
             {
                 obArray[obCount++] = subData->remote_syncObId;
             }
+#endif
         }
         it = it->next;
     }
index a0fa445..78e593e 100644 (file)
@@ -25,6 +25,7 @@ NSNotificationResource NotificationResource;
 NSMessageResource NotificationMessageResource;
 NSSyncResource NotificationSyncResource;
 
+#ifdef WITH_CLOUD
 OCStackApplicationResult NSHandlePublishCb(void *ctx, OCDoHandle handle,
     OCClientResponse *clientResponse)
 {
@@ -57,6 +58,7 @@ NSResult NSPublishResourceToCloud(char *serverAddress)
     NS_LOG(DEBUG, "NSPublishResourceToCloud - OUT");
     return NS_OK;
 }
+#endif
 
 NSResult NSCreateResource(char *uri)
 {
index c259251..61aec35 100644 (file)
@@ -128,20 +128,28 @@ void NSHandleSubscription(OCEntityHandlerRequest *entityHandlerRequest, NSResour
         NS_LOG_V(DEBUG, "SubList ID = [%s]", subData->id);\r
 \r
         NS_LOG_V(DEBUG, "Consumer Address: %s", entityHandlerRequest->devAddr.addr);\r
-        if(NSIsRemoteServerAddress(entityHandlerRequest->devAddr.addr))\r
+\r
+        subData->remote_messageObId = subData->messageObId = 0;\r
+\r
+        bool iSRemoteServer = false;\r
+\r
+#ifdef WITH_CLOUD\r
+        iSRemoteServer = NSIsRemoteServerAddress(entityHandlerRequest->devAddr.addr);\r
+        if(iSRemoteServer)\r
         {\r
             NS_LOG(DEBUG, "Requested by remote server");\r
             subData->remote_messageObId = entityHandlerRequest->obsInfo.obsId;\r
-            subData->messageObId = 0;\r
             NS_LOG_V(DEBUG, "SubList message observation ID = [%d]", subData->remote_messageObId);\r
         }\r
-        else\r
+#endif\r
+\r
+        if(!iSRemoteServer)\r
         {\r
             NS_LOG(DEBUG, "Requested by local consumer");\r
             subData->messageObId = entityHandlerRequest->obsInfo.obsId;\r
-            subData->remote_messageObId = 0;\r
             NS_LOG_V(DEBUG, "SubList message observation ID = [%d]", subData->messageObId);\r
         }\r
+\r
         subData->isWhite = false;\r
         subData->remote_syncObId = 0;\r
         subData->syncObId = 0;\r
@@ -177,18 +185,24 @@ void NSHandleSubscription(OCEntityHandlerRequest *entityHandlerRequest, NSResour
         NS_LOG_V(DEBUG, "SubList ID = [%s]", subData->id);\r
 \r
         NS_LOG_V(DEBUG, "Consumer Address: %s", entityHandlerRequest->devAddr.addr);\r
-        if(NSIsRemoteServerAddress(entityHandlerRequest->devAddr.addr))\r
+\r
+        subData->remote_syncObId = subData->syncObId = 0;\r
+        bool isRemoteServer = false;\r
+\r
+#ifdef WITH_CLOUD\r
+        isRemoteServer = NSIsRemoteServerAddress(entityHandlerRequest->devAddr.addr);\r
+        if(isRemoteServer)\r
         {\r
             NS_LOG(DEBUG, "Requested by remote server");\r
             subData->remote_syncObId = entityHandlerRequest->obsInfo.obsId;\r
-            subData->syncObId = 0;\r
             NS_LOG_V(DEBUG, "SubList sync observation ID = [%d]", subData->remote_syncObId);\r
         }\r
-        else\r
+#endif\r
+\r
+        if(!isRemoteServer)\r
         {\r
             NS_LOG(DEBUG, "Requested by local consumer");\r
             subData->syncObId = entityHandlerRequest->obsInfo.obsId;\r
-            subData->remote_syncObId = 0;\r
             NS_LOG_V(DEBUG, "SubList sync observation ID = [%d]", subData->syncObId);\r
         }\r
 \r
index 778bcce..a8a5367 100644 (file)
@@ -40,6 +40,7 @@ NSConnectionState NSGetProviderConnectionState()
     return NSProviderConnectionState;\r
 }\r
 \r
+#ifdef WITH_CLOUD\r
 void NSSetRemoteServerAddress(char *serverAddress)\r
 {\r
 \r
@@ -64,6 +65,7 @@ bool NSIsRemoteServerAddress(char *serverAddress)
 \r
     return false;\r
 }\r
+#endif\r
 \r
 void NSInitProviderInfo()\r
 {\r