From 7481b6c5b1d02dcb2de3299727041a0955354f50 Mon Sep 17 00:00:00 2001 From: Harish Kumara Marappa Date: Wed, 29 Apr 2015 12:51:09 +0530 Subject: [PATCH] Fix the issue of NM tizen sample not working with WiFi connectivity. 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 Reviewed-on: https://gerrit.iotivity.org/gerrit/828 Tested-by: jenkins-iotivity Reviewed-by: Uze Choi --- .../NotificationManager/include/hosting.h | 18 ++++++++++++++++-- .../NotificationManager/src/hosting.c | 10 +++++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/service/notification-manager/NotificationManager/include/hosting.h b/service/notification-manager/NotificationManager/include/hosting.h index d1f2b22..7d224d1 100755 --- a/service/notification-manager/NotificationManager/include/hosting.h +++ b/service/notification-manager/NotificationManager/include/hosting.h @@ -30,6 +30,18 @@ #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 diff --git a/service/notification-manager/NotificationManager/src/hosting.c b/service/notification-manager/NotificationManager/src/hosting.c index 66b1b36..5931bfd 100755 --- a/service/notification-manager/NotificationManager/src/hosting.c +++ b/service/notification-manager/NotificationManager/src/hosting.c @@ -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) -- 2.7.4