Revert "[CONPRO-1337] Disabled Presence Feature" 47/193147/1 accepted/tizen/5.0/unified/20181116.080142 submit/tizen_5.0/20181115.083511
authorDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 15 Nov 2018 08:14:53 +0000 (17:14 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 15 Nov 2018 08:33:52 +0000 (17:33 +0900)
This reverts commit 127c4d9e2773e22cb3f4d6ffd8a568fa67312ec2.

Change-Id: I2690b11b0fb187f6fbf8348c36beb218c449f307
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
18 files changed:
build_common/SConscript
plugins/samples/linux/IotivityandZigbeeServer.c
resource/csdk/stack/include/octypes.h
resource/csdk/stack/src/ocserverrequest.c
resource/examples/SConscript
resource/src/InProcClientWrapper.cpp
resource/src/InProcServerWrapper.cpp
resource/unittests/OCExceptionTest.cpp
resource/unittests/OCRepresentationEncodingTest.cpp
service/notification/src/common/NSUtil.c [changed mode: 0644->0755]
service/notification/src/consumer/NSConsumerDiscovery.c
service/notification/src/consumer/NSConsumerDiscovery.h
service/notification/src/consumer/NSConsumerNetworkEventListener.c
service/notification/src/provider/NSProviderDiscovery.c
service/notification/src/provider/NSProviderDiscovery.h
service/resource-encapsulation/src/resourceBroker/src/DevicePresence.cpp
service/resource-encapsulation/src/resourceBroker/src/ResourcePresence.cpp
service/resource-encapsulation/src/resourceCache/src/ObserveCache.cpp

index 4a9a350..3d2404c 100644 (file)
@@ -101,7 +101,6 @@ help_vars.Add(BoolVariable('WITH_PROXY', 'Build with CoAP-HTTP Proxy', False))
 help_vars.Add(ListVariable('WITH_MQ', 'Build with MQ publisher/broker', 'OFF', ['OFF', 'SUB', 'PUB', 'BROKER']))
 help_vars.Add(BoolVariable('WITH_CLOUD', 'Build including AccountManager class and Cloud Client sample', False))
 help_vars.Add(ListVariable('RD_MODE', 'Resource Directory build mode', 'CLIENT', ['CLIENT', 'SERVER']))
-help_vars.Add(BoolVariable('DISABLE_PRESENCE', 'Disable Presence Feature', False))
 
 help_vars.Add(BoolVariable('SIMULATOR', 'Build with simulator module', False))
 
@@ -359,9 +358,6 @@ if env.get('WITH_TCP'):
 if env.get('DISABLE_TCP_SERVER'):
        defines.append('-DDISABLE_TCP_SERVER=1')
 
-if env.get('DISABLE_PRESENCE') == False:
-    env.AppendUnique(CPPDEFINES = ['WITH_PRESENCE'])
-
 libs = []
 if env.get('SECURED') == '1':
     defines.append('-D__WITH_DTLS__=1')
index 74d987c..8caa729 100644 (file)
@@ -51,14 +51,13 @@ int main()
         goto IotivityStop;
     }
 
-#ifdef WITH_PRESENCE
     result  = OCStartPresence(0);
     if (result != OC_STACK_OK)
     {
         OIC_LOG_V(ERROR, TAG, "OCStartPresence Failed: %d", result);
         goto IotivityStop;
     }
-#endif
+
     // PIStartPlugin
     PIPlugin* plugin = NULL;
     OIC_LOG(INFO, TAG, "IoTivity Initialized properly, Starting Zigbee Plugin...");
index df6df44..6afdb95 100644 (file)
@@ -39,6 +39,9 @@
 extern "C" {
 #endif // __cplusplus
 
+/** For the feature presence.*/
+#define WITH_PRESENCE
+
 #include "ocpresence.h"
 
 // TODO : need for secure psi
@@ -84,11 +87,12 @@ extern "C" {
 
 /** Presence URI through which the OIC devices advertise their presence.*/
 #define OC_RSRVD_PRESENCE_URI                 "/oic/ad"
-#endif // WITH_PRESENCE
 
 /** Presence URI through which the OIC devices advertise their device presence.*/
 #define OC_RSRVD_DEVICE_PRESENCE_URI         "/oic/prs"
 
+#endif // WITH_PRESENCE
+
 /** For multicast Discovery mechanism.*/
 #define OC_MULTICAST_DISCOVERY_URI            "/oic/res"
 
index 3dde884..325abb7 100644 (file)
@@ -739,8 +739,8 @@ OCStackResult HandleSingleResponse(OCEntityHandlerResponse * ehResponse)
 
     OIC_LOG(INFO, TAG, "Calling OCSendResponse with:");
     OIC_LOG_V(INFO, TAG, "\tEndpoint address: %s", responseEndpoint.addr);
-    OIC_LOG_V(INFO, TAG, "\tEndpoint adapter: %d", responseEndpoint.adapter);
-    OIC_LOG_V(INFO, TAG, "\tResponse result : %d", responseInfo.result);
+    OIC_LOG_V(INFO, TAG, "\tEndpoint adapter: %s", responseEndpoint.adapter);
+    OIC_LOG_V(INFO, TAG, "\tResponse result : %s", responseInfo.result);
     OIC_LOG_V(INFO, TAG, "\tResponse for uri: %s", responseInfo.info.resourceUri);
 
     result = OCSendResponse(&responseEndpoint, &responseInfo);
index b2ce91f..4896179 100644 (file)
@@ -102,6 +102,7 @@ example_names = [
 if target_os not in ['windows', 'msys_nt']:
        example_names += [
                'fridgeserver', 'fridgeclient',
+               'presenceserver', 'presenceclient',
                'roomserver', 'roomclient',
                'garageserver',
                'garageclient',
@@ -114,8 +115,6 @@ if target_os not in ['windows', 'msys_nt']:
                examples_env.AppendUnique(CPPPATH = ['../csdk/resource-directory/include'])
                example_names += ['rdclient']
                examples_env.AppendUnique(LIBS = ['resource_directory'])
-       if examples_env.get('DISABLE_PRESENCE') == False:
-               example_names += ['presenceserver', 'presenceclient']
 
 examples = map(make_single_file_cpp_program, example_names)
 
index 41bb8fa..ee47425 100644 (file)
@@ -1433,7 +1433,6 @@ namespace OC
         return result;
     }
 
-#ifdef WITH_PRESENCE
     OCStackApplicationResult subscribePresenceCallback(void* ctx,
                                                        OCDoHandle /*handle*/,
             OCClientResponse* clientResponse)
@@ -1454,13 +1453,11 @@ namespace OC
 
         return OC_STACK_KEEP_TRANSACTION;
     }
-#endif
 
     OCStackResult InProcClientWrapper::SubscribePresence(OCDoHandle* handle,
         const std::string& host, const std::string& resourceType,
         OCConnectivityType connectivityType, SubscribeCallback& presenceHandler)
     {
-#ifdef WITH_PRESENCE
         if (!presenceHandler)
         {
             return OC_STACK_INVALID_PARAM;
@@ -1494,14 +1491,10 @@ namespace OC
                             os.str().c_str(), nullptr,
                             nullptr, connectivityType,
                             OC_LOW_QOS, &cbdata, NULL, 0);
-#else
-        return OC_STACK_NOT_IMPLEMENTED;
-#endif
     }
 
     OCStackResult InProcClientWrapper::UnsubscribePresence(OCDoHandle handle)
     {
-#ifdef WITH_PRESENCE
         OCStackResult result;
         auto cLock = m_csdkLock.lock();
 
@@ -1516,9 +1509,6 @@ namespace OC
         }
 
         return result;
-#else
-        return OC_STACK_NOT_IMPLEMENTED;
-#endif
     }
 
 #ifdef WITH_CLOUD
index 5989cf5..b4b799e 100644 (file)
@@ -606,7 +606,6 @@ namespace OC
 
     OCStackResult InProcServerWrapper::startPresence(const unsigned int seconds)
     {
-#ifdef WITH_PRESENCE
         auto cLock = m_csdkLock.lock();
         OCStackResult result = OC_STACK_ERROR;
         if(cLock)
@@ -620,14 +619,10 @@ namespace OC
             throw OCException(OC::Exception::START_PRESENCE_FAILED, result);
         }
         return result;
-#else
-        return OC_STACK_NOT_IMPLEMENTED;
-#endif
     }
 
     OCStackResult InProcServerWrapper::stopPresence()
     {
-#ifdef WITH_PRESENCE
         auto cLock = m_csdkLock.lock();
         OCStackResult result = OC_STACK_ERROR;
         if(cLock)
@@ -641,9 +636,6 @@ namespace OC
             throw OCException(OC::Exception::END_PRESENCE_FAILED, result);
         }
         return result;
-#else
-        return OC_STACK_NOT_IMPLEMENTED;
-#endif
     }
 
     OCStackResult InProcServerWrapper::sendResponse(
index d95d320..921b45f 100644 (file)
@@ -72,11 +72,9 @@ namespace OC
                 OC_STACK_SVR_DB_NOT_EXIST,
                 OC_STACK_AUTHENTICATION_FAILURE,
                 OC_STACK_NOT_ALLOWED_OXM,
-#ifdef WITH_PRESENCE
                 OC_STACK_PRESENCE_STOPPED,
                 OC_STACK_PRESENCE_TIMEOUT,
                 OC_STACK_PRESENCE_DO_NOT_HANDLE,
-#endif
                 OC_STACK_USER_DENIED_REQ,
                 OC_STACK_NOT_ACCEPTABLE,
                 OC_STACK_METHOD_NOT_ALLOWED,
index 83e74df..ff0c657 100644 (file)
@@ -283,7 +283,6 @@ namespace OCRepresentationEncodingTest
         OCPayloadDestroy((OCPayload *)platform1);
     }
 
-#ifdef WITH_PRESENCE
     TEST(PresencePayload, Normal)
     {
         static const char uri1[] = "/testuri";
@@ -309,7 +308,6 @@ namespace OCRepresentationEncodingTest
 
         OCPayloadDestroy(cparsed);
     }
-#endif
     // Representation Payloads
     TEST(RepresentationEncoding, BaseAttributeTypes)
     {
old mode 100644 (file)
new mode 100755 (executable)
index 35c1e25..8efb307
@@ -609,9 +609,7 @@ bool NSOCResultToSuccess(OCStackResult ret)
         case OC_STACK_OK:
         case OC_STACK_RESOURCE_CREATED:
         case OC_STACK_RESOURCE_DELETED:
-#ifdef WITH_PRESENCE
         case OC_STACK_PRESENCE_STOPPED:
-#endif
         case OC_STACK_CONTINUE:
         case OC_STACK_RESOURCE_CHANGED:
             return true;
index a408b6e..28c137e 100644 (file)
@@ -32,7 +32,6 @@
 #define NS_DISCOVER_QUERY "/oic/res?rt=x.org.iotivity.notification"
 #define NS_PRESENCE_SUBSCRIBE_QUERY_TCP "/oic/ad?rt=x.org.iotivity.notification"
 
-#ifdef WITH_PRESENCE
 OCStackApplicationResult NSConsumerPresenceListener(
         void * ctx, OCDoHandle handle, OCClientResponse * clientResponse)
 {
@@ -84,7 +83,6 @@ OCStackApplicationResult NSConsumerPresenceListener(
 
     return OC_STACK_KEEP_TRANSACTION;
 }
-#endif
 
 OCStackApplicationResult NSProviderDiscoverListener(
         void * ctx, OCDoHandle handle, OCClientResponse * clientResponse)
@@ -200,12 +198,11 @@ void NSConsumerHandleRequestDiscover(OCDevAddr * address, NSConsumerDiscoverType
         else if (address->adapter == OC_ADAPTER_TCP)
         {
             type = CT_ADAPTER_TCP;
-            NS_LOG(DEBUG, "Request discover [TCP]");
-#ifdef WITH_PRESENCE
+            NS_LOG(DEBUG, "Request discover and subscribe presence [TCP]");
             NS_LOG(DEBUG, "Subscribe presence [TCP]");
             NSInvokeRequest(NULL, OC_REST_PRESENCE, address, NS_PRESENCE_SUBSCRIBE_QUERY_TCP,
                     NULL, NSConsumerPresenceListener, NULL, NULL, type);
-#endif
+
             if (rType == NS_DISCOVER_CLOUD)
             {
                 callbackData = (void *) NS_DISCOVER_CLOUD;
index 33803fd..01b3a25 100644 (file)
@@ -32,9 +32,8 @@ extern "C" {
 
 void NSConsumerDiscoveryTaskProcessing(NSTask *);
 
-#ifdef WITH_PRESENCE
 OCStackApplicationResult NSConsumerPresenceListener(void *, OCDoHandle, OCClientResponse *);
-#endif
+
 // for discover result
 OCStackApplicationResult NSProviderDiscoverListener(void *, OCDoHandle, OCClientResponse *);
 
index 21881b1..d48d897 100644 (file)
@@ -53,14 +53,13 @@ NSResult NSConsumerListenerInit()
 //    {
 //        return NS_ERROR;
 //    }
-    OCStackResult stackResult;
-#ifdef WITH_PRESENCE
+
     NS_LOG(DEBUG, "Request to subscribe presence");
-    stackResult = NSInvokeRequest(getPresenceHandle(), OC_REST_PRESENCE, NULL,
+    OCStackResult stackResult = NSInvokeRequest(getPresenceHandle(), OC_REST_PRESENCE, NULL,
                         NS_PRESENCE_SUBSCRIBE_QUERY, NULL, NSConsumerPresenceListener,
                         NULL, NULL, CT_DEFAULT);
     NS_VERIFY_STACK_SUCCESS(NSOCResultToSuccess(stackResult), NS_ERROR);
-#endif
+
     NS_LOG(DEBUG, "Request to discover provider");
     stackResult = NSInvokeRequest(NULL, OC_REST_DISCOVER, NULL,
                       NS_DISCOVER_QUERY, NULL, NSProviderDiscoverListener,
index 7dac222..9452103 100644 (file)
@@ -20,7 +20,6 @@
 \r
 #include "NSProviderDiscovery.h"\r
 \r
-#ifdef WITH_PRESENCE\r
 NSResult NSStartPresence()\r
 {\r
     NS_LOG(DEBUG, "NSStartPresence()");\r
@@ -48,7 +47,6 @@ NSResult NSStopPresence()
     NS_LOG(DEBUG, "NSStopPresence() NS_OK");\r
     return NS_OK;\r
 }\r
-#endif\r
 \r
 void * NSDiscoverySchedule(void * ptr)\r
 {\r
@@ -69,7 +67,6 @@ void * NSDiscoverySchedule(void * ptr)
 \r
             switch (node->taskType)\r
             {\r
-#ifdef WITH_PRESENCE\r
                 case TASK_START_PRESENCE:\r
                     NS_LOG(DEBUG, "CASE TASK_START_PRESENCE : ");\r
                     NSStartPresence();\r
@@ -78,7 +75,6 @@ void * NSDiscoverySchedule(void * ptr)
                     NS_LOG(DEBUG, "CASE TASK_STOP_PRESENCE : ");\r
                     NSStopPresence();\r
                     break;\r
-#endif\r
                 case TASK_REGISTER_RESOURCE:\r
                     NS_LOG(DEBUG, "CASE TASK_REGISTER_RESOURCE : ");\r
                     NSRegisterResource();\r
index 1b1ffb0..c020ecb 100644 (file)
@@ -26,9 +26,7 @@
 #include "NSProviderScheduler.h"\r
 #include "NSProviderResource.h"\r
 \r
-#ifdef WITH_PRESENCE\r
 NSResult NSStartPresence();\r
 NSResult NSStopPresence();\r
-#endif\r
 \r
 #endif /* _NS_PROVIDER_DISCOVERY_H_ */\r
index 5c36b78..7ebdf3f 100644 (file)
@@ -158,11 +158,9 @@ namespace OIC
                 case OC_STACK_RESOURCE_DELETED:
                 case OC_STACK_TIMEOUT:
                 case OC_STACK_COMM_ERROR:
-#ifdef WITH_PRESENCE
                 case OC_STACK_PRESENCE_STOPPED:
                 case OC_STACK_PRESENCE_TIMEOUT:
                 case OC_STACK_PRESENCE_DO_NOT_HANDLE:
-#endif
                 {
                     setDeviceState(DEVICE_STATE::LOST_SIGNAL);
                     changeAllPresenceMode(BROKER_MODE::NON_PRESENCE_MODE);
index a85e240..9836438 100644 (file)
@@ -288,10 +288,8 @@ namespace OIC
             case OC_STACK_INVALID_REQUEST_HANDLE:
             case OC_STACK_TIMEOUT:
             case OC_STACK_COMM_ERROR:
-#ifdef WITH_PRESENCE
             case OC_STACK_PRESENCE_STOPPED:
             case OC_STACK_PRESENCE_TIMEOUT:
-#endif
             default:
                 verifiedState = BROKER_STATE::LOST_SIGNAL;
                 break;
index c1b7a8f..2703af7 100644 (file)
@@ -136,9 +136,7 @@ namespace OIC
                 case OC_STACK_OK:
                 case OC_STACK_RESOURCE_CREATED:
                 case OC_STACK_RESOURCE_DELETED:
-#ifdef WITH_PRESENCE
                 case OC_STACK_PRESENCE_STOPPED:
-#endif
                 case OC_STACK_CONTINUE:
                 case OC_STACK_RESOURCE_CHANGED:
                     return true;