Commit 93ea54bd authored by Harish Kumara Marappa's avatar Harish Kumara Marappa Committed by Uze Choi

Fix for issue of NM ResourceHosting android sample not working.

Error code type changed from OCStackResult to int in
ISubscribePresenceListener::onPresenceCallback.

Change-Id: I73591fe1baf6adbe448ae290deba3e9234a61e5d
Signed-off-by: default avatarHarish Kumara Marappa <h.marappa@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1089Reviewed-by: default avatarUze Choi <uzchoi@samsung.com>
Tested-by: default avatarUze Choi <uzchoi@samsung.com>
parent 8f9ef44e
......@@ -25,7 +25,12 @@ import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
import org.iotivity.base.ModeType;
import org.iotivity.base.OcPlatform;
import org.iotivity.base.OcResourceHandle;
import org.iotivity.base.PlatformConfig;
import org.iotivity.base.QualityOfService;
import org.iotivity.base.ServiceType;
import android.app.Activity;
import android.os.Bundle;
......@@ -66,6 +71,15 @@ public class ResourceHosting extends Activity implements OnClickListener
findViewById(R.id.btnStartHosting).setOnClickListener(this);
findViewById(R.id.btnStopHosting).setOnClickListener(this);
findViewById(R.id.btLogClear).setOnClickListener(this);
PlatformConfig platformConfigObj;
platformConfigObj = new PlatformConfig(this,ServiceType.IN_PROC,
ModeType.CLIENT_SERVER, "0.0.0.0", 0, QualityOfService.LOW);
Log.i(TAG, "Before Calling Configure of ocPlatform");
OcPlatform.Configure(platformConfigObj);
Log.i(TAG, "Configuration done Successfully");
}
/**
......@@ -261,14 +275,15 @@ public class ResourceHosting extends Activity implements OnClickListener
*/
public native int ResourceHostingTerminate();
static
{
System.loadLibrary("gnustl_shared");
System.loadLibrary("oc_logger");
System.loadLibrary("connectivity_abstraction");
System.loadLibrary("octbstack");
System.loadLibrary("oc");
System.loadLibrary("ocstack-jni");
System.loadLibrary("NotificationManager");
}
static
{
System.loadLibrary("gnustl_shared");
System.loadLibrary("oc_logger");
System.loadLibrary("connectivity_abstraction");
System.loadLibrary("ca-interface");
System.loadLibrary("octbstack");
System.loadLibrary("oc");
System.loadLibrary("ocstack-jni");
System.loadLibrary("NotificationManager");
}
}
......@@ -165,7 +165,7 @@ public class SampleConsumer extends Activity implements View.OnClickListener,
public void initOICStack()
{
PlatformConfig cfg = new PlatformConfig(this,ServiceType.IN_PROC,
ModeType.CLIENT, "0.0.0.0", 0, QualityOfService.HIGH);
ModeType.CLIENT, "0.0.0.0", 0, QualityOfService.LOW);
OcPlatform.Configure(cfg);
current_log_result += "Created Platform...\n";
tv_current_log_result.setText(current_log_result);
......@@ -175,7 +175,7 @@ public class SampleConsumer extends Activity implements View.OnClickListener,
public void findResourceCandidate()
{
nmfindResource("", "coap://224.0.1.187/oc/core?rt=Resource.Hosting");
nmfindResource("", "/oc/core?rt=Resource.Hosting");
current_log_result += "Finding Resource... \n";
tv_current_log_result.setText(current_log_result);
}
......@@ -344,12 +344,12 @@ public class SampleConsumer extends Activity implements View.OnClickListener,
break;
case R.id.btn_delete:
tv_select_method_type.setText(DELETE);
try {
startDelete(curResource);
} catch (OcException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
startDelete(curResource);
} catch (OcException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
btn_delete.setClickable(false);
break;
case R.id.btn_clean:
......@@ -561,27 +561,27 @@ public class SampleConsumer extends Activity implements View.OnClickListener,
btn_delete.setClickable(true);
}
@Override
public void onPutFailed(Throwable arg0) {
// TODO Auto-generated method stub
}
@Override
public void onObserveFailed(Throwable arg0) {
// TODO Auto-generated method stub
}
@Override
public void onDeleteFailed(Throwable arg0) {
// TODO Auto-generated method stub
}
@Override
public void onGetFailed(Throwable arg0) {
// TODO Auto-generated method stub
}
@Override
public void onPutFailed(Throwable arg0) {
// TODO Auto-generated method stub
}
@Override
public void onObserveFailed(Throwable arg0) {
// TODO Auto-generated method stub
}
@Override
public void onDeleteFailed(Throwable arg0) {
// TODO Auto-generated method stub
}
@Override
public void onGetFailed(Throwable arg0) {
// TODO Auto-generated method stub
}
}
......@@ -79,7 +79,6 @@ public class SampleProvider extends Activity implements OnClickListener,
findViewById(R.id.btnHumidityDown).setOnClickListener(this);
findViewById(R.id.btnLogClear).setOnClickListener(this);
isExecutePresence = false;
}
......@@ -88,7 +87,8 @@ public class SampleProvider extends Activity implements OnClickListener,
// create platform config
PlatformConfig cfg = new PlatformConfig(this,ServiceType.IN_PROC,
ModeType.SERVER, "0.0.0.0", // bind to all available interfaces
0, QualityOfService.HIGH);
0, QualityOfService.LOW);
OcPlatform.Configure(cfg);
try
......
......@@ -38,5 +38,5 @@ public interface ISubscribePresenceListener {
* @param result
* error code.
*/
public void onPresenceCallback(String resource, OCStackResult result);
public void onPresenceCallback(String resource, int result);
}
......@@ -400,15 +400,15 @@ class ThingsManagerCallback {
*
* @param resource
* URI of resource.
* @param result
* @param errorValue
* error code.
*
*/
public void onPresenceCallback(String resource, OCStackResult result) {
public void onPresenceCallback(String resource, int errorValue) {
if (null != presenceListener) {
Log.i("ThingsManagerCallback : onPresenceCallback",
"Received Callback from JNI");
presenceListener.onPresenceCallback(resource, result);
presenceListener.onPresenceCallback(resource, errorValue);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment