From 7ddad7485427f7b53bf09518a9110818f1841fd3 Mon Sep 17 00:00:00 2001 From: Parkhi Date: Tue, 22 Nov 2016 19:58:38 +0900 Subject: [PATCH] Update Easysetup mediator android sample app - Add validation check logic when received response of findResource. Change-Id: Ib2e9f6bf3534f77e7d6260fca803ccf629df5b2d Signed-off-by: Parkhi Reviewed-on: https://gerrit.iotivity.org/gerrit/14635 Tested-by: jenkins-iotivity Reviewed-by: Uze Choi --- .../service/easysetup/EasysetupActivity.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/java/org/iotivity/service/easysetup/EasysetupActivity.java b/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/java/org/iotivity/service/easysetup/EasysetupActivity.java index 6d469485a..0271ae531 100755 --- a/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/java/org/iotivity/service/easysetup/EasysetupActivity.java +++ b/service/easy-setup/sampleapp/mediator/android/EasySetup/app/src/main/java/org/iotivity/service/easysetup/EasysetupActivity.java @@ -403,7 +403,7 @@ public class EasysetupActivity extends Activity return; } - if(ocResource.getHost().contains("coap+tcp")) { + if(ocResource.getHost().contains("+tcp")) { Log.d(TAG, "Recv Found resource event from tcp port," + "ignoring URI : " + ocResource.getUri()); runOnUiThread(new Runnable() { @@ -422,6 +422,23 @@ public class EasysetupActivity extends Activity Log.d(TAG,"URI of the resource: " + resourceUri); Log.d(TAG,"Host address of the resource: " + hostAddress); + mRemoteEnrollee = mEasySetup.createRemoteEnrollee(ocResource); + + if(mRemoteEnrollee == null) { + Log.d(TAG, "Recv Found resource event," + + "ignoring URI : " + ocResource.getUri()); + runOnUiThread(new Runnable() { + @Override + public void run() { + mDiscoverResource.setEnabled(true); + } + }); + return; + } + + isFirstTime = false; + mEnrolleeDeviceID = ocResource.getServerId(); + runOnUiThread(new Runnable() { @Override public void run() { @@ -434,9 +451,6 @@ public class EasysetupActivity extends Activity mProvisionCloudPropProcess.setEnabled(true); } }); - isFirstTime = false; - mRemoteEnrollee = mEasySetup.createRemoteEnrollee(ocResource); - mEnrolleeDeviceID = ocResource.getServerId(); } } } -- 2.34.1