Merge branch 'master' into resource-manipulation
authorhunje.yeon <hunje.yeon@samsung.com>
Thu, 16 Jul 2015 08:29:20 +0000 (17:29 +0900)
committerhunje.yeon <hunje.yeon@samsung.com>
Thu, 16 Jul 2015 08:29:28 +0000 (17:29 +0900)
Apply recent changes of 'master' branch into 'resource-manipulation' branch

Change-Id: I201c7759d7ddbf2fd12440315968e270c360e265
Signed-off-by: hunje.yeon <hunje.yeon@samsung.com>
20 files changed:
extlibs/arduino/SConscript
resource/csdk/connectivity/samples/android/sample_service/jni/ResourceModel.c
resource/csdk/connectivity/samples/linux/sample_main.c
resource/csdk/connectivity/samples/tizen/casample.c
resource/csdk/connectivity/src/caconnectivitymanager.c
resource/csdk/connectivity/src/cainterfacecontroller.c
resource/csdk/connectivity/src/camessagehandler.c
resource/csdk/connectivity/src/camessagehandler_singlethread.c
resource/csdk/connectivity/src/canetworkconfigurator.c
resource/csdk/connectivity/src/caprotocolmessage.c
resource/csdk/connectivity/src/caqueueingthread.c
resource/csdk/connectivity/src/caretransmission.c
resource/csdk/stack/src/ocresource.c
service/soft-sensor-manager/SSMCore/src/SSMInterface/SSMModelDefinition.h
service/soft-sensor-manager/SSMCore/src/SensorProcessor/ResourceFinder.cpp
service/soft-sensor-manager/SSMCore/src/SensorProcessor/ResourceFinder.h
service/soft-sensor-manager/SampleApp/linux/THSensorApp/include/ThingResourceServer.h
service/soft-sensor-manager/SampleApp/linux/THSensorApp1/include/ThingResourceServer1.h
service/things-manager/sdk/src/GroupManager.cpp [changed mode: 0755->0644]
service/things-manager/sdk/src/ThingsConfiguration.cpp [changed mode: 0755->0644]

index 268c061..ede704f 100644 (file)
@@ -69,85 +69,112 @@ if target_os == 'arduino':
        timelib_dir         = arduinolib_dir + '/libraries/Time'
 
        if not os.path.exists(timelib_dir):
-               timelib_zip_file    = src_dir + '/extlibs/arduino/Time.zip'
-               timelib_url         = 'http://playground.arduino.cc/uploads/Code/Time.zip'
-               # Install Arduino Time library
-               # If the zip file is not already present, download it
-               os.mkdir(timelib_dir)
-               os.chdir(timelib_dir)
-               if not os.path.exists(timelib_zip_file):
-                       timelib_zip = env.Download(timelib_zip_file, timelib_url)
-               else:
-                       timelib_zip = timelib_zip_file
+               if WhereIs('dos2unix') is not None:
+                       timelib_zip_file    = src_dir + '/extlibs/arduino/Time.zip'
+                       timelib_url         = 'http://playground.arduino.cc/uploads/Code/Time.zip'
+                       # Install Arduino Time library
+                       # If the zip file is not already present, download it
+                       os.mkdir(timelib_dir)
+                       os.chdir(timelib_dir)
+                       if not os.path.exists(timelib_zip_file):
+                               timelib_zip = env.Download(timelib_zip_file, timelib_url)
+                       else:
+                               timelib_zip = timelib_zip_file
 
-               # Unzip the lib
-               print 'Unzipping Arduino Time lib...'
-               env.UnpackAll(timelib_dir + '/Time', timelib_zip)
+                       # Unzip the lib
+                       print 'Unzipping Arduino Time lib...'
+                       env.UnpackAll(timelib_dir + '/Time', timelib_zip)
 
-               # Apply patches to ARDUINO_HOME directory.
-               os.chdir(arduinolib_dir)
-               print 'Patching Arduino libraries...'
-               os.system("find ./libraries/Time/Time/DateStrings.cpp -type f -exec dos2unix {} \;")
-               os.system("patch -p1 < " + src_dir + "/resource/csdk/connectivity/lib/arduino/arduino_libraries.patch --directory=" + arduinolib_dir)
+                       # Apply patches to ARDUINO_HOME directory.
+                       os.chdir(arduinolib_dir)
+                       print 'Patching Arduino libraries...'
 
-               # Remove downloaded file
-               os.remove(timelib_zip_file)
+                       os.system("find ./libraries/Time/Time/DateStrings.cpp -type f -exec dos2unix {} \;")
+                       os.system("patch -p1 < " + src_dir + "/resource/csdk/connectivity/lib/arduino/arduino_libraries.patch --directory=" + arduinolib_dir)
+
+                       # Remove downloaded file
+                       os.remove(timelib_zip_file)
+               else:
+                       print 'Please manually install package dos2unix. The build process will end now. Your Action Required: Install package manually, then restart build process.'
+                       print 'You may likely retrieve this package as follows:'
+                       print '      sudo apt-get install dos2unix'
+                       print '               or'
+                       print '      sudo yum install dos2unix'
+                       exit(1)
 
        redbearlib_dir         = arduinolib_dir + '/libraries/RBL_nRF8001'
 
        if not os.path.exists(redbearlib_dir):
-               redbearlib_zip_file    = src_dir + '/extlibs/arduino/25643e7b1b7da3740406325a471e3faa4b948747.zip'
-               redbearlib_url         = 'https://github.com/RedBearLab/nRF8001/archive/25643e7b1b7da3740406325a471e3faa4b948747.zip'
-               if not os.path.exists(redbearlib_zip_file):
-                       redbearlib_zip = env.Download(redbearlib_zip_file, redbearlib_url)
-               else:
-                       redbearlib_zip = redbearlib_zip_file
+               if WhereIs('dos2unix') is not None:
+                       redbearlib_zip_file    = src_dir + '/extlibs/arduino/25643e7b1b7da3740406325a471e3faa4b948747.zip'
+                       redbearlib_url         = 'https://github.com/RedBearLab/nRF8001/archive/25643e7b1b7da3740406325a471e3faa4b948747.zip'
+                       if not os.path.exists(redbearlib_zip_file):
+                               redbearlib_zip = env.Download(redbearlib_zip_file, redbearlib_url)
+                       else:
+                               redbearlib_zip = redbearlib_zip_file
+
+                       # Unzip the lib
+                       print 'Unzipping Red Bear lib...'
+                       os.chdir(arduinolib_dir + '/libraries')
+                       env.UnpackAll(redbearlib_dir, redbearlib_zip)
 
-               # Unzip the lib
-               print 'Unzipping Red Bear lib...'
-               os.chdir(arduinolib_dir + '/libraries')
-               env.UnpackAll(redbearlib_dir, redbearlib_zip)
+                       # Because the way Red Bear lib is distributed... All Red Bear source files must be moved up a few directories.
+                       shutil.move('nRF8001-25643e7b1b7da3740406325a471e3faa4b948747/Arduino/libraries/RBL_nRF8001/', '.')
+                       shutil.rmtree('nRF8001-25643e7b1b7da3740406325a471e3faa4b948747')
 
-               # Because the way Red Bear lib is distributed... All Red Bear source files must be moved up a few directories.
-               shutil.move('nRF8001-25643e7b1b7da3740406325a471e3faa4b948747/Arduino/libraries/RBL_nRF8001/', '.')
-               shutil.rmtree('nRF8001-25643e7b1b7da3740406325a471e3faa4b948747')
+                       # Apply Red Bear patches
+                       print 'Patching Red Bear library...'
+                       os.chdir(arduinolib_dir + '/libraries/RBL_nRF8001/')
 
-               # Apply Red Bear patches
-               print 'Patching Red Bear library...'
-               os.chdir(arduinolib_dir + '/libraries/RBL_nRF8001/')
-               os.system("find . -type f -exec dos2unix {} \;")
-               os.system("patch -p1 < " + src_dir + "/resource/csdk/connectivity/lib/arduino/RBL_nRF8001.patch")
+                       os.system("find . -type f -exec dos2unix {} \;")
+                       os.system("patch -p1 < " + src_dir + "/resource/csdk/connectivity/lib/arduino/RBL_nRF8001.patch")
 
-               # Remove downloaded file
-               os.remove(redbearlib_zip_file)
+                       # Remove downloaded file
+                       os.remove(redbearlib_zip_file)
+               else:
+                       print 'Please manually install package dos2unix. The build process will end now. Your Action Required: Install package manually, then restart build process.'
+                       print 'You may likely retrieve this package as follows:'
+                       print '      sudo apt-get install dos2unix'
+                       print '               or'
+                       print '      sudo yum install dos2unix'
+                       exit(1)
 
        nordiclib_dir           = arduinolib_dir + '/libraries/BLE'
 
        if not os.path.exists(nordiclib_dir):
-               nordiclib_zip_file    = src_dir + '/extlibs/arduino/ble-sdk-arduino-0.9.5.beta.zip'
-                nordiclib_url         = 'https://github.com/NordicSemiconductor/ble-sdk-arduino/archive/0.9.5.beta.zip'
-               if not os.path.exists(nordiclib_zip_file):
-                       nordiclib_zip = env.Download(nordiclib_zip_file, nordiclib_url)
-               else:
-                       nordiclib_zip = nordiclib_zip_file
-
-               # Unzip the lib
-               print 'Unzipping Nordic lib...'
-               os.chdir(arduinolib_dir + '/libraries')
-               env.UnpackAll(nordiclib_dir, nordiclib_zip)
-
-               # Because the way Nordic lib is distributed... All Nordic source files must be moved up a few directories.
-               shutil.move('ble-sdk-arduino-0.9.5.beta/libraries/BLE/', '.')
-               shutil.rmtree('ble-sdk-arduino-0.9.5.beta')
-
-               # Apply Nordic lib patches
-               print 'Patching Nordic library...'
-               os.chdir(arduinolib_dir + '/libraries/BLE/')
-               os.system("find . -type f -exec dos2unix {} \;")
-               os.system("patch -p1 < " + src_dir + "/resource/csdk/connectivity/lib/arduino/arduino_due_ble.patch")
+               if WhereIs('dos2unix') is not None:
+                       nordiclib_zip_file    = src_dir + '/extlibs/arduino/ble-sdk-arduino-0.9.5.beta.zip'
+                       nordiclib_url         = 'https://github.com/NordicSemiconductor/ble-sdk-arduino/archive/0.9.5.beta.zip'
+                       if not os.path.exists(nordiclib_zip_file):
+                               nordiclib_zip = env.Download(nordiclib_zip_file, nordiclib_url)
+                       else:
+                               nordiclib_zip = nordiclib_zip_file
+
+                       # Unzip the lib
+                       print 'Unzipping Nordic lib...'
+                       os.chdir(arduinolib_dir + '/libraries')
+                       env.UnpackAll(nordiclib_dir, nordiclib_zip)
+
+                       # Because the way Nordic lib is distributed... All Nordic source files must be moved up a few directories.
+                       shutil.move('ble-sdk-arduino-0.9.5.beta/libraries/BLE/', '.')
+                       shutil.rmtree('ble-sdk-arduino-0.9.5.beta')
+
+                       # Apply Nordic lib patches
+                       print 'Patching Nordic library...'
+                       os.chdir(arduinolib_dir + '/libraries/BLE/')
+
+                       os.system("find . -type f -exec dos2unix {} \;")
+                       os.system("patch -p1 < " + src_dir + "/resource/csdk/connectivity/lib/arduino/arduino_due_ble.patch")
                
-               # Remove downloaded file
-               os.remove(nordiclib_zip_file)
+                       # Remove downloaded file
+                       os.remove(nordiclib_zip_file)
+               else:
+                       print 'Please manually install package dos2unix. The build process will end now. Your Action Required: Install package manually, then restart build process.'
+                       print 'You may likely retrieve this package as follows:'
+                       print '      sudo apt-get install dos2unix'
+                       print '               or'
+                       print '      sudo yum install dos2unix'
+                       exit(1)
 
 # Set the ARDUINO_HOME
 env.Replace(ARDUINO_HOME = arduinolib_dir)
index 3c00394..21ba6b9 100644 (file)
@@ -435,6 +435,8 @@ Java_org_iotivity_ca_service_RMInterface_RMSendReqestToAll(JNIEnv *env, jobject
     if (NULL == headerOpt)
     {
         LOGE("Memory allocation failed");
+        // destroy remote endpoint
+        CADestroyEndpoint(endpoint);
         return;
     }
 
@@ -969,35 +971,15 @@ void request_handler(const CAEndpoint_t* object, const CARequestInfo_t* requestI
         if (0 < securePort) //Set the remote endpoint secure details and send response
         {
             LOGI("This is secure resource...");
-            char *uri = NULL;
-            uint32_t length = 0;
-
-            length = COAPS_PREFIX_LEN; //length of "coaps://"
-            // length of "ipaddress:port"
-            length += strlen(object->addr) + PORT_LENGTH;
-            length += strlen(requestInfo->info.resourceUri) + 1;
-
-            uri = calloc(1, sizeof(char) * length);
-            if (!uri)
-            {
-                LOGE("Failed to create new uri");
-                free(uri);
-                return;
-            }
-            sprintf(uri, "%s%s:%d/%s", COAPS_PREFIX, object->addr,
-                    securePort, requestInfo->info.resourceUri);
 
             CAEndpoint_t *endpoint = NULL;
             if (CA_STATUS_OK != CACreateEndpoint(CA_SECURE,
                         object->adapter, object->addr, securePort, &endpoint))
             {
                 LOGE("Failed to create duplicate of remote endpoint!");
-                free(uri);
                 return;
             }
             object = endpoint;
-
-            free(uri);
         }
     }
 }
index 79c0c36..edfe4ef 100644 (file)
@@ -983,34 +983,15 @@ void request_handler(const CAEndpoint_t *object, const CARequestInfo_t *requestI
         {
             printf("This is secure resource...\n");
 
-            //length of "coaps://"
-            size_t length = COAPS_PREFIX_LEN;
-
-            // length of "ipaddress:port"
-            length += strlen(object->addr) + PORT_LENGTH;
-            length += 1;
-
-            char *uri = calloc(1, sizeof(char) * length);
-            if (!uri)
-            {
-                printf("Failed to create new uri\n");
-                return;
-            }
-            sprintf(uri, "%s%s:%d/", COAPS_PREFIX, object->addr,
-                    object->port);
-
             CAEndpoint_t *endpoint = NULL;
             if (CA_STATUS_OK != CACreateEndpoint(0, object->adapter, object->addr,
                                                  object->port, &endpoint))
             {
                 printf("Failed to create duplicate of remote endpoint!\n");
-                free(uri);
                 return;
             }
             endpoint->flags = CA_SECURE;
             object = endpoint;
-
-            free(uri);
         }
     }
 
index 9e83604..d8f80cf 100644 (file)
@@ -1012,16 +1012,6 @@ void request_handler(const CAEndpoint_t *object, const CARequestInfo_t *requestI
         {
             printf("This is secure resource...\n");
 
-            //length of "coaps://"
-            size_t length = sizeof(SECURE_COAPS_PREFIX) - 1;
-
-            // length of "ipaddress:port"
-            length += strlen(object->addr) + PORT_LENGTH;
-            length += 1;
-
-            printf("%s%s:%d/", SECURE_COAPS_PREFIX, object->addr,
-                    object->port);
-
             CAEndpoint_t *endpoint = NULL;
             if (CA_STATUS_OK != CACreateEndpoint(0, object->adapter, object->addr,
                                                  object->port, &endpoint))
index 5bdd90a..910d167 100644 (file)
@@ -36,7 +36,7 @@
 
 CAGlobals_t caglobals;
 
-#define TAG "CA"
+#define TAG "CA_CONN_MGR"
 
 static bool g_isInitialized = false;
 
index 518ea35..1a91252 100644 (file)
@@ -34,7 +34,7 @@
 #include "cathreadpool.h"
 #include "caipadapter.h"
 
-#define TAG "CA"
+#define TAG "CA_INTRFC_CNTRLR"
 
 #define CA_MEMORY_ALLOC_CHECK(arg) {if (arg == NULL) \
     {OIC_LOG(ERROR, TAG, "memory error");goto memory_error_exit;} }
index a4e37c3..aada31e 100644 (file)
@@ -40,7 +40,7 @@
 #include "oic_string.h"
 #include "canetworkconfigurator.h"
 
-#define TAG PCF("CA")
+#define TAG PCF("CA_MSG_HNDLR")
 #define SINGLE_HANDLE
 
 #define MAX_THREAD_POOL_SIZE    20
@@ -251,6 +251,7 @@ static void CASendThreadProcess(void *threadData)
     if (SEND_TYPE_UNICAST == type)
     {
 
+        OIC_LOG(DEBUG,TAG,"Unicast message");
         if (NULL != data->requestInfo)
         {
             OIC_LOG(DEBUG, TAG, "requestInfo is available..");
@@ -266,6 +267,7 @@ static void CASendThreadProcess(void *threadData)
         else
         {
             OIC_LOG(DEBUG, TAG, "request info, response info is empty");
+            return;
         }
 
         // interface controller function call.
@@ -292,30 +294,46 @@ static void CASendThreadProcess(void *threadData)
 
             coap_delete_pdu(pdu);
         }
+        else
+        {
+            OIC_LOG_V(ERROR,TAG,"Failed to generate unicast PDU");
+            return;
+        }
     }
     else if (SEND_TYPE_MULTICAST == type)
     {
-        OIC_LOG(DEBUG, TAG, "both requestInfo & responseInfo is not available");
+        OIC_LOG(DEBUG,TAG,"Multicast message");
+        if (NULL != data->requestInfo)
+        {
+            OIC_LOG(DEBUG, TAG, "requestInfo is available..");
+            CAInfo_t *info = &data->requestInfo->info;
 
-        CAInfo_t *info = &data->requestInfo->info;
+            info->options = data->options;
+            info->numOptions = data->numOptions;
 
-        info->options = data->options;
-        info->numOptions = data->numOptions;
+            pdu = CAGeneratePDU(CA_GET, info);
+            if (NULL != pdu)
+            {
+                CALogPDUInfo(pdu);
 
-        pdu = CAGeneratePDU(CA_GET, info);
-        if (NULL != pdu)
-        {
-            CALogPDUInfo(pdu);
+                res = CASendMulticastData(data->remoteEndpoint, pdu->hdr, pdu->length);
+                if (CA_STATUS_OK != res)
+                {
+                    OIC_LOG_V(ERROR, TAG, "send failed:%d", res);
+                    coap_delete_pdu(pdu);
+                    return;
+                }
 
-            res = CASendMulticastData(data->remoteEndpoint, pdu->hdr, pdu->length);
-            if (CA_STATUS_OK != res)
-            {
-                OIC_LOG_V(ERROR, TAG, "send failed:%d", res);
                 coap_delete_pdu(pdu);
-                return;
             }
-
-            coap_delete_pdu(pdu);
+            else
+            {
+                OIC_LOG_V(ERROR,TAG,"Failed to generate multicast PDU");
+            }
+        }
+        else
+        {
+            OIC_LOG_V(ERROR, TAG, "request info is empty");
         }
     }
 
index b1567ec..19ea3c0 100644 (file)
@@ -105,6 +105,7 @@ static void CAProcessData(const CAData_t *data)
 
     if (SEND_TYPE_UNICAST == type)
     {
+        OIC_LOG(DEBUG,TAG,"Unicast Message");
         coap_pdu_t *pdu = NULL;
 
         if (NULL != data->requestInfo)
@@ -122,6 +123,7 @@ static void CAProcessData(const CAData_t *data)
         else
         {
             OIC_LOG(DEBUG, TAG, "request info, response info is empty");
+            return;
         }
 
         // interface controller function call.
@@ -148,29 +150,46 @@ static void CAProcessData(const CAData_t *data)
 
             coap_delete_pdu(pdu);
         }
+        else
+        {
+            OIC_LOG_V(ERROR,TAG,"Failed to Generate Unicast PDU");
+            return;
+        }
     }
     else if (SEND_TYPE_MULTICAST == type)
     {
-        OIC_LOG(DEBUG, TAG, "both requestInfo & responseInfo is not available");
+        OIC_LOG(DEBUG,TAG,"Multicast Message");
+        if (NULL != data->requestInfo)
+        {
+            OIC_LOG(DEBUG, TAG, "reqInfo avlbl");
 
-        CAInfo_t *info = &data->requestInfo->info;
+            CAInfo_t *info = &data->requestInfo->info;
 
-        info->options = data->options;
-        info->numOptions = data->numOptions;
+            info->options = data->options;
+            info->numOptions = data->numOptions;
 
-        coap_pdu_t *pdu = (coap_pdu_t *)CAGeneratePDU(CA_GET, info);
+            coap_pdu_t *pdu = (coap_pdu_t *)CAGeneratePDU(CA_GET, info);
 
-        if (NULL != pdu)
-        {
-            CALogPDUInfo(pdu);
-            res = CASendMulticastData(data->remoteEndpoint, pdu->hdr, pdu->length);
-            if(CA_STATUS_OK != res)
+            if (NULL != pdu)
             {
-                OIC_LOG_V(ERROR, TAG, "send failed:%d", res);
+                CALogPDUInfo(pdu);
+                res = CASendMulticastData(data->remoteEndpoint, pdu->hdr, pdu->length);
+                if(CA_STATUS_OK != res)
+                {
+                    OIC_LOG_V(ERROR, TAG, "send failed:%d", res);
+                    coap_delete_pdu(pdu);
+                    return;
+                }
                 coap_delete_pdu(pdu);
-                return;
             }
-            coap_delete_pdu(pdu);
+            else
+            {
+                OIC_LOG(ERROR,TAG,"Failed to Generate Multicast PDU");
+            }
+        }
+        else
+        {
+            OIC_LOG(ERROR,TAG,"requestInfo is empty");
         }
     }
 
index d9c8797..fa776c0 100644 (file)
@@ -25,7 +25,7 @@
 #include "uarraylist.h"
 #include "logger.h"
 
-#define TAG "CANW"
+#define TAG "CA_NW_CONFIG"
 
 static u_arraylist_t *g_selectedNetworkList = NULL;
 static uint32_t NETWORK_IP = CA_ADAPTER_IP;
index 3883c82..b6e3b05 100644 (file)
@@ -48,7 +48,7 @@
 #define HAVE_SRANDOM 1
 #endif
 
-#define TAG "CA"
+#define TAG "CA_PRTCL_MSG"
 
 /**
  * @def VERIFY_NON_NULL_RET
index 01bed4b..4b7a511 100644 (file)
@@ -29,7 +29,7 @@
 #include "oic_malloc.h"
 #include "logger.h"
 
-#define TAG PCF("CA")
+#define TAG PCF("CA_QING")
 
 static void CAQueueingThreadBaseRoutine(void *threadValue)
 {
index 5b4fd05..2b130c2 100644 (file)
@@ -62,7 +62,7 @@
 #include "oic_malloc.h"
 #include "logger.h"
 
-#define TAG "CA"
+#define TAG "CA_RETRANS"
 
 typedef struct
 {
index fb7cdad..f5984e9 100644 (file)
@@ -536,16 +536,24 @@ static OCStackResult HandleVirtualResource (OCServerRequest *request, OCResource
             {
                 discoveryResult = OC_STACK_NO_MEMORY;
             }
+            else
+            {
+                discoveryResult = OC_STACK_OK;
+            }
     }
     else if (virtualUriInRequest == OC_PLATFORM_URI)
     {
-            OCPlatformPayload* payload = OCPlatformPayloadCreate(
+            payload = (OCPayload*)OCPlatformPayloadCreate(
                     OC_RSRVD_PLATFORM_URI,
                     &savedPlatformInfo);
             if (!payload)
             {
                 discoveryResult = OC_STACK_NO_MEMORY;
             }
+            else
+            {
+                discoveryResult = OC_STACK_OK;
+            }
     }
 
     #ifdef WITH_PRESENCE
index 73cbe58..42b62b3 100644 (file)
@@ -57,13 +57,14 @@ class ISSMResource
         ISSMResource(const std::string &n, const std::string &t) :
             name(n), type(t)
         {
-               location = SENSOR_LOCATION_LOCAL;
+            location = SENSOR_LOCATION_LOCAL;
         }
         SENSOR_LOCATION location;
         std::string name;
         std::string type;
         std::string friendlyName;
         std::string ip;
+        int connectivityType;
         std::vector<std::string> inputList;
         std::vector<std::map<std::string, std::string> > outputProperty;
 };
index a11a6ae..a4c51d9 100644 (file)
@@ -19,6 +19,8 @@
  ******************************************************************/
 #include "ResourceFinder.h"
 
+OCConnectivityType g_connectivityType = CT_DEFAULT;
+
 SSMRESULT CResourceFinder::finalConstruct()
 {
     SSMRESULT res = SSM_E_FAIL;
@@ -76,9 +78,9 @@ void CResourceFinder::presenceHandler(OCStackResult result, const unsigned int n
     switch (result)
     {
         case OC_STACK_OK:
-            requestURI << "coap://" << hostAddress << "/oc/core?rt=SSManager.Sensor";
+            requestURI << "coap://" << hostAddress << OC_RSRVD_WELL_KNOWN_URI << "?rt=SSManager.Sensor";
 
-            ret = OC::OCPlatform::findResource("", requestURI.str(), CT_DEFAULT,
+            ret = OC::OCPlatform::findResource("", requestURI.str(), g_connectivityType,
                                                std::bind(&CResourceFinder::onResourceFound, this, std::placeholders::_1));
 
             if (ret != OC_STACK_OK)
@@ -105,7 +107,7 @@ void CResourceFinder::presenceHandler(OCStackResult result, const unsigned int n
         case OC_STACK_PRESENCE_TIMEOUT:
             break;
 
-        case OC_STACK_VIRTUAL_DO_NOT_HANDLE:
+        case OC_STACK_PRESENCE_DO_NOT_HANDLE:
             break;
 
         default:
@@ -127,14 +129,14 @@ SSMRESULT CResourceFinder::startResourceFinder()
     std::ostringstream multicastPresenceURI;
     multicastPresenceURI << "coap://" << OC_MULTICAST_PREFIX;
 
-    ret = OC::OCPlatform::findResource("", requestURI.str(), CT_DEFAULT,
+    ret = OC::OCPlatform::findResource("", requestURI.str(), g_connectivityType,
                                        std::bind(&CResourceFinder::onResourceFound, this, std::placeholders::_1));
 
     if (ret != OC_STACK_OK)
         SSM_CLEANUP_ASSERT(SSM_E_FAIL);
 
     ret = OC::OCPlatform::subscribePresence(m_multicastPresenceHandle, multicastPresenceURI.str(),
-                                            "SSManager.Sensor", CT_DEFAULT, std::bind(&CResourceFinder::presenceHandler, this,
+                                            "SSManager.Sensor", g_connectivityType, std::bind(&CResourceFinder::presenceHandler, this,
                                                     std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
 
     if (ret != OC_STACK_OK)
@@ -194,7 +196,7 @@ void CResourceFinder::onExecute(void *pArg)
             pResourceHandler = new OICResourceHandler();
 
             res = pResourceHandler->initHandler(*pResource, this);
-            if(res != SSM_S_OK)
+            if (res != SSM_S_OK)
             {
                 SAFE_DELETE(pResourceHandler);
                 SSM_CLEANUP_ASSERT(res);
@@ -222,8 +224,9 @@ void CResourceFinder::onExecute(void *pArg)
                 m_mapResourcePresenceHandles.end())
             {
                 ret = OC::OCPlatform::subscribePresence(presenceHandle, ((ISSMResource *)pMessage[1])->ip,
-                                                        "SSManager.Sensor", CT_DEFAULT, std::bind(&CResourceFinder::presenceHandler, this,
-                                                                std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
+                                                        "SSManager.Sensor", (OCConnectivityType)(((ISSMResource *)pMessage[1])->connectivityType),
+                                                        std::bind(&CResourceFinder::presenceHandler, this, std::placeholders::_1, std::placeholders::_2,
+                                                                std::placeholders::_3));
 
                 if (ret != OC_STACK_OK)
                     SSM_CLEANUP_ASSERT(SSM_E_FAIL);
@@ -233,9 +236,6 @@ void CResourceFinder::onExecute(void *pArg)
 
             m_pResourceFinderEvent->onResourceFound((ISSMResource *)pMessage[1]);
 
-            if (ret != OC_STACK_OK)
-                SSM_CLEANUP_ASSERT(SSM_E_FAIL);
-
             break;
 
         case RESOURCE_DISCOVER_UNINSTALL_RESOURCE:
index d9ea15f..8aa7fc0 100644 (file)
@@ -146,7 +146,7 @@ CLEANUP: return res;
                 }
 
                 void onGetResourceProfile(const OC::HeaderOptions &headerOptions,
-                                          const OC::OCRepresentation &representation, const int &eCode)
+                                          const OC::OCRepresentation &representation, const int eCode)
                 {
                     //unpack attributeMap
 
@@ -156,6 +156,7 @@ CLEANUP: return res;
                     m_SSMResource.name = m_pResource->host() + m_pResource->uri();
                     m_SSMResource.type = m_pResource->uri().substr(1);
                     m_SSMResource.ip = m_pResource->host();
+                    m_SSMResource.connectivityType = m_pResource->connectivityType();
 
                     //bind default properties
                     outputProperty["name"] = "lifetime";
index acb6e65..4df0e97 100644 (file)
@@ -68,8 +68,6 @@ class TemphumidResource
 
             printf("Running thing as %s\n", m_resourceUri.c_str());
             m_resourceRep.setUri(m_resourceUri);
-            m_resourceRep.setResourceTypes(m_resourceTypes);
-            m_resourceRep.setResourceInterfaces(m_resourceInterfaces);
         }
 
         ~TemphumidResource()
index 60316d4..9a45dc4 100644 (file)
@@ -68,8 +68,6 @@ class TemphumidResource
 
             printf("Running thing as %s\n", m_resourceUri.c_str());
             m_resourceRep.setUri(m_resourceUri);
-            m_resourceRep.setResourceTypes(m_resourceTypes);
-            m_resourceRep.setResourceInterfaces(m_resourceInterfaces);
         }
 
         ~TemphumidResource()
old mode 100755 (executable)
new mode 100644 (file)