[Easysetup]Fixed an issue found in internal testing
authorHemant Mahsky <h.mahsky@samsung.com>
Tue, 29 Sep 2015 08:32:21 +0000 (14:02 +0530)
committerMadan Lanka <lanka.madan@samsung.com>
Tue, 29 Sep 2015 14:11:28 +0000 (14:11 +0000)
Change-Id: I5a0bf9e5782765e72c2cc7528a66d241728db07e
Signed-off-by: Hemant Mahsky <h.mahsky@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/3255
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
(cherry picked from commit 6a363a38519075f2158965e98cab7db57705ccd8)
Reviewed-on: https://gerrit.iotivity.org/gerrit/3267

service/easy-setup/sdk/common/common.h
service/easy-setup/sdk/enrollee/common/src/resourceHandler.cpp
service/easy-setup/sdk/mediator/src/prov_adapter.cpp
service/easy-setup/sdk/mediator/src/provisioning.cpp

index d6e8bea..2cd5073 100755 (executable)
@@ -41,7 +41,7 @@
 static OCConnectivityType OC_CONNTYPE = CT_IP_USE_V4;
 static OCConnectivityType OC_CONNTYPE_BLE =  CT_ADAPTER_GATT_BTLE;
 
-static const char * UNICAST_PROVISIONING_QUERY = "coap://%s:%d/oic/res?rt=oic.prov";
+static const char * UNICAST_PROVISIONING_QUERY = "coap://%s:%d/oic/res?rt=oic.r.prov";
 static const char * UNICAST_PROV_STATUS_QUERY = "coap://%s:%d%s";
 
 /**
index 0f4305f..f62b4bd 100755 (executable)
@@ -60,7 +60,7 @@ OCStackResult CreateProvisioningResource()
     sprintf(g_prov.tnn, "Unknown");
     sprintf(g_prov.cd, "Unknown");
 
-    OCStackResult res = OCCreateResource(&g_prov.handle, "oic.prov", OC_RSRVD_INTERFACE_DEFAULT,
+    OCStackResult res = OCCreateResource(&g_prov.handle, "oic.r.prov", OC_RSRVD_INTERFACE_DEFAULT,
             OC_RSRVD_ES_URI_PROV, OCEntityHandlerCb, NULL, OC_DISCOVERABLE | OC_OBSERVABLE);
 
     OC_LOG_V(INFO, TAG, "Created Prov resource with result: %s", getResult(res));
@@ -91,7 +91,7 @@ OCStackResult CreateNetworkResource()
     OC_LOG_V(INFO, TAG, "SSID: %s", g_net.cnn);
     OC_LOG_V(INFO, TAG, "IP Address: %s", g_net.ipaddr);
 
-    OCStackResult res = OCCreateResource(&g_net.handle, "oic.net", OC_RSRVD_INTERFACE_DEFAULT,
+    OCStackResult res = OCCreateResource(&g_net.handle, "oic.r.net", OC_RSRVD_INTERFACE_DEFAULT,
             OC_RSRVD_ES_URI_NET, OCEntityHandlerCb,NULL, OC_DISCOVERABLE | OC_OBSERVABLE);
     OC_LOG_V(INFO, TAG, "Created Net resource with result: %s", getResult(res));
 
index 343b9c0..ad64ad0 100755 (executable)
@@ -77,11 +77,8 @@ void UnRegisterCallback() {
 OCStackResult StartProvisioning(const EnrolleeNWProvInfo_t *netInfo) {
 
     char findQuery[64] = {0};
-
-    if (netInfo->connType == CT_IP_USE_V4) {
-        snprintf(findQuery, sizeof(findQuery), UNICAST_PROVISIONING_QUERY,
-                 netInfo->netAddressInfo.WIFI.ipAddress, IP_PORT);
-    }
+    snprintf(findQuery, sizeof(findQuery) - 1, UNICAST_PROVISIONING_QUERY,
+             netInfo->netAddressInfo.WIFI.ipAddress, IP_PORT);
 
     return StartProvisioningProcess(netInfo, cbData, findQuery);
 }
@@ -94,3 +91,4 @@ OCStackResult StopProvisioning(OCConnectivityType connectivityType) {
     return result;
 }
 
+
index cf0d8a2..f3ef773 100644 (file)
@@ -75,10 +75,6 @@ OCStackResult InitProvisioningHandler() {
         return OC_STACK_ERROR;
     }
 
-    pthread_join(thread_handle, NULL);
-
-    ResetProgress();
-
     return OC_STACK_OK;
 }
 
@@ -200,8 +196,7 @@ OCStackResult StartProvisioningProcess(const EnrolleeNWProvInfo_t *netInfo,
 
     OCStackResult result = OC_STACK_ERROR;
 
-    strncpy(szFindResourceQueryUri, findResQuery, sizeof(szFindResourceQueryUri, findResQuery) - 1);
-
+    snprintf(szFindResourceQueryUri, sizeof(szFindResourceQueryUri) - 1, findResQuery);
     char *string = "Starting provisioning process ";
 
     pthread_t thread_handle;