aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLarry Sachs <larry.j.sachs@intel.com>2018-01-16 17:33:05 -0800
committerLarry Sachs <larry.j.sachs@intel.com>2018-01-16 17:33:05 -0800
commit4a6a779d0dc1ca0348024d490c38b1e2081aa796 (patch)
tree158a5f50f4f21bb50ac0e4cb0be9dc7b9fa811c7
parentae7b7cb5786511f0fd2957c857e08e71c042afc9 (diff)
Don't track /oic/d for cancel observe
This change is necessary to work with OCF light servers. Change-Id: I055c1ae95b3ebdba06de79a68abca7effcd2ab2c Signed-off-by: Larry Sachs <larry.j.sachs@intel.com>
-rw-r--r--android/examples/upnpclient/src/main/java/org/iotivity/base/examples/UpnpClientActivity.java43
1 files changed, 24 insertions, 19 deletions
diff --git a/android/examples/upnpclient/src/main/java/org/iotivity/base/examples/UpnpClientActivity.java b/android/examples/upnpclient/src/main/java/org/iotivity/base/examples/UpnpClientActivity.java
index 742fb85..63bf993 100644
--- a/android/examples/upnpclient/src/main/java/org/iotivity/base/examples/UpnpClientActivity.java
+++ b/android/examples/upnpclient/src/main/java/org/iotivity/base/examples/UpnpClientActivity.java
@@ -165,7 +165,9 @@ public class UpnpClientActivity extends Activity implements
tracked = true;
} else {
- Log.i(TAG, "URI of the new (for now, untracked) resource: " + resourceUri);
+ if (!resourceUri.equals("/oic/d")) {
+ Log.i(TAG, "URI of the new (for now, untracked) resource: " + resourceUri);
+ }
}
if (tracked) {
@@ -343,27 +345,29 @@ public class UpnpClientActivity extends Activity implements
Links links = device.getLinks();
for (Link link : links.getLinks()) {
String href = link.getHref();
- // rt could be String or String[]
- Object rt = link.getRt();
- String rtAsString = null;
- if (rt instanceof String) {
- rtAsString = (String) rt;
-
- } else if (rt instanceof String[]) {
- if (((String[]) rt).length > 0) {
- rtAsString = ((String[]) rt)[0];
+ if (!href.equals("/oic/d")) {
+ // rt could be String or String[]
+ Object rt = link.getRt();
+ String rtAsString = null;
+ if (rt instanceof String) {
+ rtAsString = (String) rt;
+
+ } else if (rt instanceof String[]) {
+ if (((String[]) rt).length > 0) {
+ rtAsString = ((String[]) rt)[0];
+ } else {
+ Log.e(TAG, "(String[])rt is empty");
+ }
+
} else {
- Log.e(TAG, "(String[])rt is empty");
+ Log.e(TAG, "Unknown rt type of " + rt.getClass().getName());
}
- } else {
- Log.e(TAG, "Unknown rt type of " + rt.getClass().getName());
- }
-
- if ((rtAsString != null) && (!mResourceLookup.containsKey(href))) {
- Log.i(TAG, "Finding all resources of type " + rtAsString);
- String requestUri = OcPlatform.WELL_KNOWN_QUERY + "?rt=" + rtAsString;
- OcPlatform.findResource("", requestUri, EnumSet.of(OcConnectivityType.CT_DEFAULT), new ResourceFoundListener(ocRepUri, href));
+ if ((rtAsString != null) && (!mResourceLookup.containsKey(href))) {
+ Log.i(TAG, "Finding all resources of type " + rtAsString);
+ String requestUri = OcPlatform.WELL_KNOWN_QUERY + "?rt=" + rtAsString;
+ OcPlatform.findResource("", requestUri, EnumSet.of(OcConnectivityType.CT_DEFAULT), new ResourceFoundListener(ocRepUri, href));
+ }
}
}
@@ -908,6 +912,7 @@ public class UpnpClientActivity extends Activity implements
Log.i(TAG, "Cancelling Observe...");
for (OcResource resource : iotivityResources) {
try {
+ Log.i(TAG, "Cancelling Observe for " + resource.getUri());
resource.cancelObserve();
} catch (OcException e) {
Log.e(TAG, "Error occurred while invoking \"cancelObserve\" API -- " + e.toString(), e);