Fix the issue of NM tizen sample not working with WiFi connectivity.
authorHarish Kumara Marappa <h.marappa@samsung.com>
Wed, 29 Apr 2015 07:21:09 +0000 (12:51 +0530)
committerUze Choi <uzchoi@samsung.com>
Wed, 29 Apr 2015 07:39:34 +0000 (07:39 +0000)
Modified hosting.c file for using OC_WIFI connectivity type for Tizen,
Android platform and OC_ETHERNET for other platforms.

Change-Id: Ia89423c0d27c375f319aa1b1b4e8274d9c9642e7
Signed-off-by: Harish Kumara Marappa <h.marappa@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/828
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
service/notification-manager/NotificationManager/include/hosting.h
service/notification-manager/NotificationManager/src/hosting.c

index d1f2b22..7d224d1 100755 (executable)
 #include "ocstack.h"
 #include "logger.h"
 
+// TODO: Selecting OC_WIFI for android, tizen and OC_ETHERNET for linux platform
+// is temporary change as OC_ALL is not working currently. Remove this code and use OC_ALL
+// once it is functioning.
+#if defined(__ANDROID__) || defined(__TIZEN__)
+#define OC_TRANSPORT OC_WIFI
+#else
+#define OC_TRANSPORT OC_ETHERNET
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
 
 #define HOSTING_TAG  PCF("Hosting")
 
@@ -49,6 +61,8 @@ OCStackResult OICStartCoordinate();
  */
 OCStackResult OICStopCoordinate();
 
+#ifdef __cplusplus
+}
+#endif // __cplusplus
 
-
-#endif
+#endif //_HOSTING_H_
\ No newline at end of file
index 66b1b36..5931bfd 100755 (executable)
@@ -408,7 +408,7 @@ int requestCoordinateeCandidateDiscovery(char *sourceResourceAddress)
     cbData.cd = NULL;
 
     result = OCDoResource(&handle, OC_REST_GET, queryUri, OIC_COORDINATING_FLAG, 0,
-            OC_ETHERNET, OC_LOW_QOS, &cbData, NULL, 0);
+            OC_TRANSPORT, OC_LOW_QOS, &cbData, NULL, 0);
     if (result != OC_STACK_OK)
     {
         OC_LOG_V(DEBUG, HOSTING_TAG, "OCStack resource error");
@@ -441,7 +441,7 @@ OCStackResult requestPresence(char *sourceResourceAddress)
     OC_LOG_V(DEBUG, HOSTING_TAG, "initializePresenceForCoordinating Query : %s", queryUri);
 
     result = OCDoResource(&handle, OC_REST_PRESENCE, queryUri, 0, 0,
-            OC_ETHERNET, OC_LOW_QOS, &cbData, NULL, 0);
+            OC_TRANSPORT, OC_LOW_QOS, &cbData, NULL, 0);
 
     if (result != OC_STACK_OK)
     {
@@ -827,7 +827,7 @@ OCStackResult requestResourceObservation(MirrorResource *mirrorResource)
             OIC_COORDINATING_FLAG);
 
     result = OCDoResource(&mirrorResource->resourceHandle[OIC_REQUEST_HANDLE], OC_REST_OBSERVE, query,
-                          0, NULL, OC_ETHERNET,
+                          0, NULL, OC_TRANSPORT,
                           OC_HIGH_QOS, &cbData, NULL, 0);
 
     if (result != OC_STACK_OK)
@@ -1386,12 +1386,12 @@ OCStackResult requestQuery(RequestHandle *request, OCMethod method,
          ((OCEntityHandlerRequest*)request->requestHandle[OIC_REQUEST_BY_CLIENT])->reqJSONPayload);
 
         result = OCDoResource(&request->requestHandle[OIC_REQUEST_BY_COORDINATOR],
-                method, queryFullUri, NULL, payload, OC_ETHERNET, OC_LOW_QOS, &cbData, NULL, 0);
+                method, queryFullUri, NULL, payload, OC_TRANSPORT, OC_LOW_QOS, &cbData, NULL, 0);
     }
     else
     {
         result = OCDoResource(&request->requestHandle[OIC_REQUEST_BY_COORDINATOR],
-                method, queryFullUri, NULL, 0, OC_ETHERNET, OC_LOW_QOS, &cbData, NULL, 0);
+                method, queryFullUri, NULL, 0, OC_TRANSPORT, OC_LOW_QOS, &cbData, NULL, 0);
     }
 
     if (result != OC_STACK_OK)