Annotate deprecated functions with macro 87/24387/6
authorGeorge Nash <george.nash@intel.com>
Tue, 13 Mar 2018 22:57:46 +0000 (15:57 -0700)
committerDave Thaler <dthaler@microsoft.com>
Fri, 23 Mar 2018 05:35:03 +0000 (05:35 +0000)
If a function was already marked as deprecated using
the @derecated doxygen annotation the OC_DEPRECATED_MSG
macro was added to generate compiler warnings when a
deprecated function was used.

The date the function was deprecated was obtained by
using git blame to find when the @deprecated tag
was added to the function documentation. The date the
tag was added was used in the macro.

Three instances of the function registerDeviceInfo
are marked as deprecated but the macro was not added
due to inheritance and mock objects implementing
their own version of the registerDeviceInfo. Caused
difficulty adding the macro to them without breaking
the build.

An attempt was made to clean up any remaining usages
of deprecated functions that were not part of unit tests.
It is possible that one or more instances of the
'registerDeviceInfo' function was missed.

Java is still using deprecated functions:
IOT-3011 and IOT-3012 to address the fact that Java is
still using deprecated functions.

Change-Id: I39b1af690b99d52f2e0d026e4c27b908e2f6c052
Signed-off-by: George Nash <george.nash@intel.com>
48 files changed:
cloud/samples/client/airconditioner/aircon_controlee.cpp
cloud/samples/client/airconditioner/aircon_controller.cpp
cloud/samples/client/group_invite/group_invite.cpp
examples/OICMiddle/OICMiddle.cpp
java/jni/JniOcPlatform.cpp
java/jni/JniOcProvisioning.cpp
resource/IPCA/samples/ElevatorServer/elevatorserver.cpp
resource/IPCA/unittests/mockOC.cpp
resource/IPCA/unittests/testelevatorserver.cpp
resource/csdk/connectivity/src/adapter_util/cacertprofile.c
resource/examples/simpleserverHQ.cpp
resource/include/InProcServerWrapper.h
resource/include/OCApi.h
resource/include/OCProvisioningManager.hpp
resource/include/OutOfProcServerWrapper.h
resource/provisioning/examples/provisioningclient.cpp
resource/provisioning/examples/subownerclient.cpp
resource/provisioning/unittests/OCProvisioningTest.cpp
resource/provisioning/unittests/SConscript
resource/src/OCPlatform_impl.cpp
resource/unittests/OCPlatformTest.cpp
resource/unittests/SConscript
service/easy-setup/sampleapp/mediator/linux/richsdk_sample/mediator.cpp
service/easy-setup/sampleapp/mediator/linux/richsdk_sample/submediator.cpp
service/notification/cpp-wrapper/unittest/NSConsumerServiceTest.cpp
service/notification/cpp-wrapper/unittest/NSConsumerServiceTest2.cpp
service/notification/cpp-wrapper/unittest/NSProviderServiceTest.cpp
service/notification/cpp-wrapper/unittest/NSProviderServiceTest2.cpp
service/notification/unittest/NSConsumerTest.cpp
service/notification/unittest/NSConsumerTest2.cpp
service/notification/unittest/NSProviderTest.cpp
service/notification/unittest/NSProviderTest2.cpp
service/resource-container/examples/BMISensorBundle/src/inputSensors/HeightSensorApp/include/HeightSensorApp.h
service/resource-container/examples/BMISensorBundle/src/inputSensors/HeightSensorApp/src/HeightSensorApp.cpp
service/resource-container/examples/BMISensorBundle/src/inputSensors/WeightSensorApp/include/WeightSensorApp.h
service/resource-container/examples/BMISensorBundle/src/inputSensors/WeightSensorApp/src/WeightSensorApp.cpp
service/resource-container/examples/ContainerSampleClient.cpp
service/resource-container/examples/DiscomfortIndexSensorBundle/src/inputSensors/THSensorApp/include/ThingResourceServer.h
service/resource-container/examples/DiscomfortIndexSensorBundle/src/inputSensors/THSensorApp/src/ThingResourceServer.cpp
service/resource-container/examples/DiscomfortIndexSensorBundle/src/inputSensors/THSensorApp1/include/ThingResourceServer1.h
service/resource-container/examples/DiscomfortIndexSensorBundle/src/inputSensors/THSensorApp1/src/ThingResourceServer1.cpp
service/resource-encapsulation/examples/linux/NestedAttributesClient.cpp
service/resource-encapsulation/examples/linux/SampleResourceClient.cpp
service/resource-encapsulation/unittests/DiscoveryManagerTest.cpp
service/scene-manager/sampleapp/linux/fanserver.cpp
service/scene-manager/sampleapp/linux/lightserver.cpp
service/scene-manager/sampleapp/linux/sceneclient.cpp
service/scene-manager/sampleapp/linux/sceneserver.cpp

index c0fcda4..4ed4fe5 100644 (file)
@@ -827,8 +827,7 @@ int main(int argc, char *argv[])
     {
         ServiceType::InProc,
         ModeType::Both,
-        "0.0.0.0", // By setting to "0.0.0.0", it binds to all available interfaces
-        0,         // Uses randomly available port
+        OC_DEFAULT_ADAPTER,
         QualityOfService::LowQos,
         &ps
     };
index e8f5cc1..766ca72 100644 (file)
@@ -380,8 +380,7 @@ int main(int argc, char *argv[])
     {
         ServiceType::InProc,
         ModeType::Both,
-        "0.0.0.0", // By setting to "0.0.0.0", it binds to all available interfaces
-        0,         // Uses randomly available port
+        OC_DEFAULT_ADAPTER,
         QualityOfService::LowQos,
         &ps
     };
index fc7d53a..0a5d879 100644 (file)
@@ -607,8 +607,7 @@ int main(int argc, char *argv[])
     {
         ServiceType::InProc,
         ModeType::Both,
-        "0.0.0.0", // By setting to "0.0.0.0", it binds to all available interfaces
-        0, // Uses randomly available port
+        OC_DEFAULT_ADAPTER,
         QualityOfService::LowQos,
         &ps
     };
index 54e230f..87eea06 100644 (file)
@@ -95,12 +95,8 @@ void Middle::run(int argc, char* argv[])
 
 void Middle::startPlatform()
 {
-    uint16_t port = 0;
-    //std::string ipaddr = INADDR_ANY;
-    std::string ipaddr = "0.0.0.0";
-
     PlatformConfig cfg { ServiceType::InProc, ModeType::Both,
-                  ipaddr, port, QualityOfService::LowQos};
+                         OC_DEFAULT_ADAPTER, QualityOfService::LowQos};
 
     OC::OCPlatform::Configure(cfg);
 }
index b6d0617..9ea86ba 100644 (file)
@@ -502,7 +502,10 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_configure
     {
         port = static_cast<uint16_t>(jPort);
     }
-
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
     PlatformConfig cfg{
         JniUtils::getServiceType(env, jServiceType),
         JniUtils::getModeType(env, jModeType),
@@ -512,6 +515,9 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcPlatform_configure
         JniUtils::getQOS(env, static_cast<int>(jQOS)),
         JniOcSecurity::getOCPersistentStorage()
     };
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
     OCPlatform::Configure(cfg);
 }
 
index 7d23cad..53ea34f 100644 (file)
@@ -119,7 +119,14 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcProvisioning_ownershipTransferCB
             {
                 delete jniPinListener;
                 jniPinListener = new JniPinCheckListener(env, jListener);
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
                 result = OCSecure::setInputPinCallback(Callback);
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
             }
             else
             {
@@ -500,12 +507,19 @@ JNIEXPORT void JNICALL Java_org_iotivity_base_OcProvisioning_setDisplayPinListen
 
     try
     {
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
         OCStackResult result = OCSecure::setDisplayPinCB(displayPinCB);
         if (OC_STACK_OK != result)
         {
             ThrowOcException(result, "Failed to set displayPinListener");
             return;
         }
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
     }
     catch (OCException& e)
     {
index b003c32..598a461 100644 (file)
@@ -193,9 +193,7 @@ bool ElevatorServer::Start(const std::string& elevatorName)
         PlatformConfig Configuration {
                                 ServiceType::InProc,
                                 ModeType::Server,
-                                "0.0.0.0", // By setting to "0.0.0.0", it binds to all available
-                                           // interfaces
-                                0,         // Uses randomly available port
+                                OC_DEFAULT_ADAPTER,
                                 QualityOfService::NaQos,
                                 &ps
                             };
index 2e92703..5e55799 100644 (file)
@@ -97,7 +97,11 @@ struct PendingRequest
     DeleteCallback deleteCallback;\r
 };\r
 \r
-PlatformConfig g_platformConfig;\r
+PlatformConfig g_platformConfig(ServiceType::InProc,\r
+                                ModeType::Both,\r
+                                OC_DEFAULT_ADAPTER,\r
+                                QualityOfService::NaQos,\r
+                                nullptr);\r
 Mock_OCDeviceInfo g_deviceInfo; // C++ version of OCDeviceInfo.\r
 Mock_OCPlatformInfo g_platformInfo; // C++ version of OCPlatformInfo.\r
 \r
index 1ab9c4c..08b63ed 100644 (file)
@@ -341,9 +341,7 @@ bool ElevatorServer::Start(std::string& elevatorName)
         PlatformConfig Configuration {
                                 ServiceType::InProc,
                                 ModeType::Both,
-                                "0.0.0.0", // By setting to "0.0.0.0", it binds to all available
-                                           // interfaces
-                                0,         // Uses randomly available port
+                                OC_DEFAULT_ADAPTER,
                                 QualityOfService::NaQos,
                                 &elevatorServerPS
                             };
index f5e0249..3cebfc7 100644 (file)
@@ -30,6 +30,7 @@
 
 #define TAG "OIC_CC_CERT_PROFILE"
 
+#if defined(__WITH_DTLS__) || defined (__WITH_TLS__)
 // OCF Compliant ID Cert profiles
 static const mbedtls_x509_crt_profile s_certProfile = {
     MBEDTLS_X509_ID_FLAG(MBEDTLS_MD_SHA256),        // MD algorithms
@@ -65,8 +66,6 @@ static const unsigned int s_caNonKeyUsage = MBEDTLS_X509_KU_DIGITAL_SIGNATURE |
                                             MBEDTLS_X509_KU_ENCIPHER_ONLY |
                                             MBEDTLS_X509_KU_DECIPHER_ONLY;
 
-#if defined(__WITH_DTLS__) || defined (__WITH_TLS__)
-
 static CertProfileResult FindEndEntityCert(const mbedtls_x509_crt *certChain, mbedtls_x509_crt const **eeCert)
 {
     *eeCert = NULL;
index 9101e71..949bb27 100644 (file)
@@ -557,8 +557,7 @@ int main(int argc, char* argv[])
     PlatformConfig cfg {
         OC::ServiceType::InProc,
         OC::ModeType::Server,
-        "0.0.0.0", // By setting to "0.0.0.0", it binds to all available interfaces
-        0,         // Uses randomly available port
+        OC_DEFAULT_ADAPTER,
         OC::QualityOfService::LowQos,
         &ps
     };
index 3d213bd..436dd8d 100644 (file)
@@ -54,8 +54,11 @@ namespace OC
                     OCTpsSchemeFlags resourceTpsTypes);
 
         // @deprecated: Use setPropertyValue instead.
+        OC_DEPRECATED_MSG(
         virtual OCStackResult registerDeviceInfo(
-                    const OCDeviceInfo deviceInfo);
+                    const OCDeviceInfo deviceInfo),
+                          "Use setPropertyValue instead.",
+                          2017.01);
 
         virtual OCStackResult registerPlatformInfo(
                     const OCPlatformInfo PlatformInfo);
index 2684391..205c548 100644 (file)
@@ -191,7 +191,10 @@ namespace OC
                 useLegacyCleanup(false)
         {}
             /* @deprecated: Use a non deprecated constructor. */
-            PlatformConfig()
+            OC_DEPRECATED_MSG(
+            PlatformConfig(),
+            "Use a non deprecated constructor",
+            2014.10)
                 : serviceType(ServiceType::InProc),
                 mode(ModeType::Both),
                 serverConnectivity(CT_DEFAULT),
@@ -204,12 +207,15 @@ namespace OC
                 useLegacyCleanup(true)
         {}
             /* @deprecated: Use a non deprecated constructor. */
+            OC_DEPRECATED_MSG(
             PlatformConfig(const ServiceType serviceType_,
-            const ModeType mode_,
-            OCConnectivityType serverConnectivity_,
-            OCConnectivityType clientConnectivity_,
-            const QualityOfService QoS_,
-            OCPersistentStorage *ps_ = nullptr)
+                           const ModeType mode_,
+                           OCConnectivityType serverConnectivity_,
+                           OCConnectivityType clientConnectivity_,
+                           const QualityOfService QoS_,
+                           OCPersistentStorage *ps_ = nullptr),
+            "Use a non deprecated constructor",
+            2017.03)
                 : serviceType(serviceType_),
                 mode(mode_),
                 serverConnectivity(serverConnectivity_),
@@ -222,12 +228,15 @@ namespace OC
                 useLegacyCleanup(true)
         {}
             /* @deprecated: Use a non deprecated constructor. */
+            OC_DEPRECATED_MSG(
             PlatformConfig(const ServiceType serviceType_,
-            const ModeType mode_,
-            const std::string& ipAddress_,
-            const uint16_t port_,
-            const QualityOfService QoS_,
-            OCPersistentStorage *ps_ = nullptr)
+                           const ModeType mode_,
+                           const std::string& ipAddress_,
+                           const uint16_t port_,
+                           const QualityOfService QoS_,
+                           OCPersistentStorage *ps_ = nullptr),
+            "Use a non deprecated constructor",
+            2017.03)
                 : serviceType(serviceType_),
                 mode(mode_),
                 serverConnectivity(CT_DEFAULT),
@@ -240,13 +249,16 @@ namespace OC
                 useLegacyCleanup(true)
         {}
             /* @deprecated: Use a non deprecated constructor. */
+            OC_DEPRECATED_MSG(
             PlatformConfig(const ServiceType serviceType_,
-            const ModeType mode_,
-            const std::string& ipAddress_,
-            const uint16_t port_,
-            const OCTransportAdapter transportType_,
-            const QualityOfService QoS_,
-            OCPersistentStorage *ps_ = nullptr)
+                           const ModeType mode_,
+                           const std::string& ipAddress_,
+                           const uint16_t port_,
+                           const OCTransportAdapter transportType_,
+                           const QualityOfService QoS_,
+                           OCPersistentStorage *ps_ = nullptr),
+            "Use a non deprecated constructor",
+            2017.03)
                 : serviceType(serviceType_),
                 mode(mode_),
                 serverConnectivity(CT_DEFAULT),
@@ -258,10 +270,10 @@ namespace OC
                 ps(ps_)
         {}
             PlatformConfig(const ServiceType serviceType_,
-            const ModeType mode_,
-            OCTransportAdapter transportType_,
-            const QualityOfService QoS_,
-            OCPersistentStorage *ps_ = nullptr)
+                           const ModeType mode_,
+                           OCTransportAdapter transportType_,
+                           const QualityOfService QoS_,
+                           OCPersistentStorage *ps_ = nullptr)
                 : serviceType(serviceType_),
                 mode(mode_),
                 serverConnectivity(CT_DEFAULT),
@@ -274,13 +286,16 @@ namespace OC
                 useLegacyCleanup(true)
         {}
             /* @deprecated: Use a non deprecated constructor. */
+            OC_DEPRECATED_MSG(
             PlatformConfig(const ServiceType serviceType_,
-            const ModeType mode_,
-            OCConnectivityType serverConnectivity_,
-            OCConnectivityType clientConnectivity_,
-            OCTransportAdapter transportType_,
-            const QualityOfService QoS_,
-            OCPersistentStorage *ps_ = nullptr)
+                           const ModeType mode_,
+                           OCConnectivityType serverConnectivity_,
+                           OCConnectivityType clientConnectivity_,
+                           OCTransportAdapter transportType_,
+                           const QualityOfService QoS_,
+                           OCPersistentStorage *ps_ = nullptr),
+            "Use a non deprecated constructor",
+            2017.03)
                 : serviceType(serviceType_),
                 mode(mode_),
                 serverConnectivity(serverConnectivity_),
index bbcee44..d769058 100644 (file)
@@ -257,8 +257,11 @@ namespace OC
              * @return ::OC_STACK_OK in case of success and other value otherwise.
              *
              */
+            OC_DEPRECATED_MSG(
             static OCStackResult setOwnerTransferCallbackData(OicSecOxm_t oxm,
-                    OTMCallbackData_t* callbackData, InputPinCallback inputPin);
+                    OTMCallbackData_t* callbackData, InputPinCallback inputPin),
+            "Use setInputPinCallback to set input pin callback value.",
+            2017.03);
 
             /**
              * API is responsible for discovery of devices in specified endpoint/deviceID.
@@ -336,7 +339,10 @@ namespace OC
              *         OC_STACK_INVALID_CALLBACK if inputPin is invalid.
              *         OC_STACK_DUPLICATE_REQUEST if an input pin callback has already been set.
              */
-            static OCStackResult setInputPinCallback(InputPinCallback inputPin);
+            OC_DEPRECATED_MSG(
+            static OCStackResult setInputPinCallback(InputPinCallback inputPin),
+            "Use registerInputPinCallback instead.",
+            2017.01);
 
             /**
              * API for de-registering a pin callback.
@@ -345,7 +351,10 @@ namespace OC
              *
              * @return ::OC_STACK_OK in case of success and other value otherwise.
              */
-            static OCStackResult unsetInputPinCallback();
+            OC_DEPRECATED_MSG(
+            static OCStackResult unsetInputPinCallback(),
+            "Use deregisterInputPinCallback instead.",
+            2017.01);
 
             /**
              * API to register for a callback to input a pin. Only one input pin callback is allowed
@@ -381,7 +390,10 @@ namespace OC
              *         OC_STACK_INVALID_CALLBACK if displayPin is invalid.
              *         OC_STACK_DUPLICATE_REQUEST if a display pin callback has already been set.
              */
-            static OCStackResult setDisplayPinCB(GeneratePinCallback displayPin);
+            OC_DEPRECATED_MSG(
+            static OCStackResult setDisplayPinCB(GeneratePinCallback displayPin),
+            "Use registerDisplayPinCallback instead.",
+            2017.01);
 
             /**
              * API for de-registering the display pin callback.
@@ -390,7 +402,10 @@ namespace OC
              *
              * @return ::OC_STACK_OK in case of success and other value otherwise.
              */
-            static OCStackResult unsetDisplayPinCB();
+            OC_DEPRECATED_MSG(
+            static OCStackResult unsetDisplayPinCB(),
+            "Use registerDisplayPinCallback instead.",
+            2017.01);
 
             /**
              * API to set Pin Type policy.
index 9f5b21c..badfe72 100644 (file)
@@ -53,8 +53,12 @@ namespace OC
             return OC_STACK_NOTIMPL;
         }
 
+        // @deprecated: Use setPropertyValue instead.
+        OC_DEPRECATED_MSG(
         virtual OCStackResult registerDeviceInfo(
-            const OCDeviceInfo /*deviceInfo*/)
+            const OCDeviceInfo /*deviceInfo*/),
+            "Use setPropertyValue instead.",
+            2017.01)
         {
             // Not implemented
             return OC_STACK_NOTIMPL;
index db73bde..24e5713 100644 (file)
@@ -744,8 +744,7 @@ int main(void)
     PlatformConfig cfg {
         OC::ServiceType::InProc,
             OC::ModeType::Both,
-            "0.0.0.0",
-            0,
+            OC_DEFAULT_ADAPTER,
             OC::QualityOfService::LowQos,
             &ps
     };
index ae05e0d..c29f652 100644 (file)
@@ -202,8 +202,7 @@ int main(void)
     PlatformConfig cfg {
         OC::ServiceType::InProc,
             OC::ModeType::Both,
-            "0.0.0.0",
-            0,
+            OC_DEFAULT_ADAPTER,
             OC::QualityOfService::LowQos,
             &ps
     };
index 529c8b8..72ad5e8 100644 (file)
@@ -199,6 +199,13 @@ namespace OCProvisioningTest
         EXPECT_EQ(OC_STACK_INVALID_PARAM, OCSecure::setDisplayPinCB(nullptr));
     }
 
+    TEST(SetDisplayPinCBTest, RegisterDisplayPinCallbackTestNullCB)
+    {
+        DisplayPinCallbackHandle displayPinCallbackHandle;
+        EXPECT_EQ(OC_STACK_INVALID_PARAM, OCSecure::registerDisplayPinCallback(nullptr, &displayPinCallbackHandle));
+    }
+
+
     TEST(ProvisionAclTest, ProvisionAclTestNullAcl)
     {
         OCSecureResource device;
index f76115a..48bd055 100644 (file)
@@ -61,9 +61,13 @@ provisiontests_env.PrependUnique(CPPPATH=[
 if target_os in ['windows']:
     # Non-Windows platforms find the boost headers under /usr/include or similar path.
     provisiontests_env.AppendUnique(CPPPATH=['#/extlibs/boost/boost'])
+    # C4996 Using deprecated code warning. We still test deprecated functions. 
+    provisiontests_env.AppendUnique(CCFLAGS=['/wd4996'])
 
     provisiontests_env.AppendUnique(LIBS=['sqlite3', 'win_helper'])
 elif target_os in ['tizen', 'linux']:
+    # We still test deprecated functions.
+    provisiontests_env.AppendUnique(CCFLAGS=['-Wno-deprecated-declarations'])
     provisiontests_env.ParseConfig('pkg-config --cflags --libs sqlite3 gobject-2.0 gio-2.0 glib-2.0')
 
 # build fix: don't use _internal unless have to
index 1d4c49f..ead6994 100644 (file)
@@ -55,7 +55,11 @@ namespace OC
 
     PlatformConfig& OCPlatform_impl::globalConfig()
     {
-        static PlatformConfig s_config;
+        static PlatformConfig s_config(ServiceType::InProc,
+                                       ModeType::Both,
+                                       OC_DEFAULT_ADAPTER,
+                                       QualityOfService::NaQos,
+                                       nullptr);
         return s_config;
     }
 
index 871910e..207205f 100644 (file)
@@ -358,7 +358,7 @@ namespace OCPlatformTest
         uint8_t resourceProperty = 0;
         EXPECT_EQ(OC_STACK_OK, OCPlatform::registerResource(
                 gResourceHandle, uri, type,
-                gResourceInterface, entityHandler, resourceProperty, (OCTpsSchemeFlags)(OC_COAP || OC_COAP_TCP)));
+                gResourceInterface, entityHandler, resourceProperty, (OCTpsSchemeFlags)(OC_COAP | OC_COAP_TCP)));
     }
 #endif
 
index 211c9ef..1ccfccd 100644 (file)
@@ -104,6 +104,9 @@ unittests_src = [
 
 # TODO: IOT-2039: Fix errors in the following Windows tests.
 if target_os in ['windows']:
+    # Ignore deprecated code warning in unit tests.
+    # We still test deprecated code till removal.
+    unittests_env.AppendUnique(CCFLAGS=['/wd4996'])
     if '12.0' == unittests_env['MSVC_VERSION']:
         unittests_src.remove('OCPlatformTest.cpp')
         unittests_src.remove('OCRepresentationEncodingTest.cpp')
index 9cae990..cef92fb 100644 (file)
@@ -564,7 +564,7 @@ int main(void)
 
     PlatformConfig config
     {
-        OC::ServiceType::InProc, ModeType::Both, "0.0.0.0", 0, OC::QualityOfService::HighQos, &ps
+        OC::ServiceType::InProc, ModeType::Both, OC_DEFAULT_ADAPTER, OC::QualityOfService::HighQos, &ps
     };
 
     OCPlatform::Configure(config);
index c2efc94..6951003 100644 (file)
@@ -562,7 +562,7 @@ int main(void)
 
     PlatformConfig config
     {
-        OC::ServiceType::InProc, ModeType::Both, "0.0.0.0", 0, OC::QualityOfService::HighQos, &ps
+        OC::ServiceType::InProc, ModeType::Both, OC_DEFAULT_ADAPTER, OC::QualityOfService::HighQos, &ps
     };
 
     OCPlatform::Configure(config);
index c04a31c..3f3e86c 100644 (file)
@@ -147,8 +147,7 @@ class NotificationServiceConsumerTest : public TestWithMock
                 {
                     OC::ServiceType::InProc,
                     OC::ModeType::Both,
-                    "0.0.0.0",
-                    0,
+                    OC_DEFAULT_ADAPTER,
                     OC::QualityOfService::LowQos
                 };
                 OC::OCPlatform::Configure(cfg);
index 72aebf2..e607c91 100644 (file)
@@ -150,8 +150,7 @@ class NotificationServiceConsumerTest : public TestWithMock
                 {
                     OC::ServiceType::InProc,
                     OC::ModeType::Both,
-                    "0.0.0.0",
-                    0,
+                    OC_DEFAULT_ADAPTER,
                     OC::QualityOfService::LowQos
                 };
                 OC::OCPlatform::Configure(cfg);
index c75748d..97f76c8 100644 (file)
@@ -129,8 +129,7 @@ class NotificationProviderServiceTest : public TestWithMock
                 {
                     OC::ServiceType::InProc,
                     OC::ModeType::Both,
-                    "0.0.0.0",
-                    0,
+                    OC_DEFAULT_ADAPTER,
                     OC::QualityOfService::HighQos
                 };
                 OC::OCPlatform::Configure(cfg);
index 81b6559..765cf30 100644 (file)
@@ -98,8 +98,7 @@ class NotificationProviderServiceTest : public TestWithMock
                 {
                     OC::ServiceType::InProc,
                     OC::ModeType::Both,
-                    "0.0.0.0",
-                    0,
+                    OC_DEFAULT_ADAPTER,
                     OC::QualityOfService::HighQos
                 };
                 OC::OCPlatform::Configure(cfg);
index 34f2dfe..af4d31a 100644 (file)
@@ -185,8 +185,7 @@ protected:
             {
                 OC::ServiceType::InProc,
                 OC::ModeType::Both,
-                "0.0.0.0",
-                0,
+                OC_DEFAULT_ADAPTER,
                 OC::QualityOfService::LowQos,
                 &gps
             };
index f9c619c..54d3100 100644 (file)
@@ -321,8 +321,7 @@ namespace
         {
             OC::ServiceType::InProc,
             OC::ModeType::Both,
-            "0.0.0.0",
-            0,
+            OC_DEFAULT_ADAPTER,
             OC::QualityOfService::LowQos,
             &gps
         };
index 72dc70d..71b396c 100644 (file)
@@ -149,8 +149,7 @@ protected:
             {
                 OC::ServiceType::InProc,
                 OC::ModeType::Both,
-                "0.0.0.0",
-                0,
+                OC_DEFAULT_ADAPTER,
                 OC::QualityOfService::HighQos,
                 &gps
             };
index 618a461..87c205a 100644 (file)
@@ -151,8 +151,7 @@ namespace
         {
             OC::ServiceType::InProc,
             OC::ModeType::Both,
-            "0.0.0.0",
-            0,
+            OC_DEFAULT_ADAPTER,
             OC::QualityOfService::HighQos,
             &gps
         };
index 75982b8..9dc4991 100644 (file)
@@ -29,9 +29,6 @@
 #include <string>
 #include <cstdlib>
 
-
-#define COAP_IP                 "0.0.0.0"
-#define COAP_PORT               0
 #define COAP_MODE               OC::ModeType::Server
 #define COAP_SRVTYPE            OC::ServiceType::InProc
 
index 2a9dd86..acad2e5 100644 (file)
@@ -204,7 +204,7 @@ OCEntityHandlerResult entityHandler(std::shared_ptr< OCResourceRequest > request
 int main()
 {
     // Create PlatformConfig object
-    PlatformConfig cfg(COAP_SRVTYPE, COAP_MODE, COAP_IP, COAP_PORT, OC::QualityOfService::LowQos);
+    PlatformConfig cfg(COAP_SRVTYPE, COAP_MODE, OC_DEFAULT_ADAPTER, OC::QualityOfService::LowQos);
 
     try
     {
index ca3c4d8..ab990d4 100644 (file)
@@ -29,8 +29,6 @@
 #include <string>
 #include <cstdlib>
 
-#define COAP_IP                 "0.0.0.0"
-#define COAP_PORT               0
 #define COAP_MODE               OC::ModeType::Server
 #define COAP_SRVTYPE            OC::ServiceType::InProc
 
index a52cb70..4af7b4d 100644 (file)
@@ -205,7 +205,7 @@ OCEntityHandlerResult entityHandler(std::shared_ptr< OCResourceRequest > request
 int main()
 {
     // Create PlatformConfig object
-    PlatformConfig cfg(COAP_SRVTYPE, COAP_MODE, COAP_IP, COAP_PORT, OC::QualityOfService::LowQos);
+    PlatformConfig cfg(COAP_SRVTYPE, COAP_MODE, OC_DEFAULT_ADAPTER, OC::QualityOfService::LowQos);
 
     try
     {
index 631f5fe..92b0b88 100644 (file)
@@ -687,8 +687,7 @@ int main(int argc, char *argv[])
     {
         OC::ServiceType::InProc,
         OC::ModeType::Both,
-        "0.0.0.0",
-        0,
+        OC_DEFAULT_ADAPTER,
         OC::QualityOfService::LowQos,
         &ps
     };
index f47a1be..1c8966c 100644 (file)
@@ -29,8 +29,6 @@
 #include <string>
 #include <cstdlib>
 
-#define COAP_IP                 "0.0.0.0"
-#define COAP_PORT               0
 #define COAP_MODE               OC::ModeType::Server
 #define COAP_SRVTYPE            OC::ServiceType::InProc
 
index ed99f57..1219d3f 100644 (file)
@@ -196,7 +196,7 @@ OCEntityHandlerResult entityHandler(std::shared_ptr< OCResourceRequest > request
 int main()
 {
     // Create PlatformConfig object
-    PlatformConfig cfg(COAP_SRVTYPE, COAP_MODE, COAP_IP, COAP_PORT, OC::QualityOfService::LowQos);
+    PlatformConfig cfg(COAP_SRVTYPE, COAP_MODE, OC_DEFAULT_ADAPTER, OC::QualityOfService::LowQos);
 
     try
     {
index 611b0e0..b883ef6 100644 (file)
@@ -29,8 +29,6 @@
 #include <string>
 #include <cstdlib>
 
-#define COAP_IP                 "0.0.0.0"
-#define COAP_PORT               0
 #define COAP_MODE               OC::ModeType::Server
 #define COAP_SRVTYPE            OC::ServiceType::InProc
 
index a1c9f07..3092602 100644 (file)
@@ -195,7 +195,7 @@ OCEntityHandlerResult entityHandler(std::shared_ptr< OCResourceRequest > request
 int main()
 {
     // Create PlatformConfig object
-    PlatformConfig cfg(COAP_SRVTYPE, COAP_MODE, COAP_IP, COAP_PORT, OC::QualityOfService::LowQos);
+    PlatformConfig cfg(COAP_SRVTYPE, COAP_MODE, OC_DEFAULT_ADAPTER, OC::QualityOfService::LowQos);
 
     try
     {
index 6ef9202..3e826ee 100644 (file)
@@ -249,7 +249,7 @@ void platFormConfigure()
 {
     PlatformConfig config
     {
-        OC::ServiceType::InProc, ModeType::Client, "0.0.0.0", 0, OC::QualityOfService::LowQos
+        OC::ServiceType::InProc, ModeType::Client, OC_DEFAULT_ADAPTER, OC::QualityOfService::LowQos
     };
     OCPlatform::Configure(config);
 }
index f97ca5d..dd33bbe 100644 (file)
@@ -548,7 +548,7 @@ void configurePlatform()
 {
     PlatformConfig config
     {
-        OC::ServiceType::InProc, ModeType::Client, "0.0.0.0", 0, OC::QualityOfService::LowQos
+        OC::ServiceType::InProc, ModeType::Client, OC_DEFAULT_ADAPTER, OC::QualityOfService::LowQos
     };
     OCPlatform::Configure(config);
 }
index 6675c5f..42d60c4 100644 (file)
@@ -100,7 +100,7 @@ TEST(DiscoveryManagerTest, ThrowIfDiscoverWithEmptyCallback)
 #ifdef SECURED
     static OCPersistentStorage gps {client_open, fread, fwrite, fclose, unlink };
     OC::PlatformConfig cfg
-    { OC::ServiceType::InProc, OC::ModeType::Both, "0.0.0.0", 0,
+    { OC::ServiceType::InProc, OC::ModeType::Both, OC_DEFAULT_ADAPTER,
             OC::QualityOfService::LowQos, &gps };
     OC::OCPlatform::Configure(cfg);
 #endif
index e21b4db..b086ba8 100644 (file)
@@ -291,10 +291,8 @@ int main()
 {
     // Create PlatformConfig object
     PlatformConfig cfg
-    { OC::ServiceType::InProc, OC::ModeType::Server, "0.0.0.0",
-    // By setting to "0.0.0.0", it binds to all available interfaces
-            0,// Uses randomly available port
-            OC::QualityOfService::LowQos };
+    { OC::ServiceType::InProc, OC::ModeType::Server,
+      OC_DEFAULT_ADAPTER, OC::QualityOfService::LowQos };
 
     OCPlatform::Configure(cfg);
     try
index 58b515c..326dad9 100644 (file)
@@ -291,10 +291,8 @@ int main()
 {
     // Create PlatformConfig object
     PlatformConfig cfg
-    { OC::ServiceType::InProc, OC::ModeType::Server, "0.0.0.0",
-    // By setting to "0.0.0.0", it binds to all available interfaces
-            0,// Uses randomly available port
-            OC::QualityOfService::LowQos };
+    { OC::ServiceType::InProc, OC::ModeType::Server,
+      OC_DEFAULT_ADAPTER, OC::QualityOfService::LowQos };
 
     OCPlatform::Configure(cfg);
     try
index 1236338..3a30021 100644 (file)
@@ -256,7 +256,7 @@ void configurePlatform()
 {
     PlatformConfig config
     {
-        OC::ServiceType::InProc, ModeType::Both, "0.0.0.0", 0, OC::QualityOfService::LowQos
+        OC::ServiceType::InProc, ModeType::Both, OC_DEFAULT_ADAPTER, OC::QualityOfService::LowQos
     };
     OCPlatform::Configure(config);
 }
index d606d8c..ab0fabb 100644 (file)
@@ -82,7 +82,7 @@ void configurePlatform()
 {
     PlatformConfig config
     {
-        OC::ServiceType::InProc, ModeType::Both, "0.0.0.0", 0, OC::QualityOfService::LowQos
+        OC::ServiceType::InProc, ModeType::Both, OC_DEFAULT_ADAPTER, OC::QualityOfService::LowQos
     };
     OCPlatform::Configure(config);
 }