Commit 4a6a779d authored by Larry Sachs's avatar Larry Sachs

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's avatarLarry Sachs <larry.j.sachs@intel.com>
parent ae7b7cb5
...@@ -165,7 +165,9 @@ public class UpnpClientActivity extends Activity implements ...@@ -165,7 +165,9 @@ public class UpnpClientActivity extends Activity implements
tracked = true; tracked = true;
} else { } 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) { if (tracked) {
...@@ -343,27 +345,29 @@ public class UpnpClientActivity extends Activity implements ...@@ -343,27 +345,29 @@ public class UpnpClientActivity extends Activity implements
Links links = device.getLinks(); Links links = device.getLinks();
for (Link link : links.getLinks()) { for (Link link : links.getLinks()) {
String href = link.getHref(); String href = link.getHref();
// rt could be String or String[] if (!href.equals("/oic/d")) {
Object rt = link.getRt(); // rt could be String or String[]
String rtAsString = null; Object rt = link.getRt();
if (rt instanceof String) { String rtAsString = null;
rtAsString = (String) rt; if (rt instanceof String) {
rtAsString = (String) rt;
} else if (rt instanceof String[]) {
if (((String[]) rt).length > 0) { } else if (rt instanceof String[]) {
rtAsString = ((String[]) rt)[0]; if (((String[]) rt).length > 0) {
rtAsString = ((String[]) rt)[0];
} else {
Log.e(TAG, "(String[])rt is empty");
}
} else { } else {
Log.e(TAG, "(String[])rt is empty"); Log.e(TAG, "Unknown rt type of " + rt.getClass().getName());
} }
} else { if ((rtAsString != null) && (!mResourceLookup.containsKey(href))) {
Log.e(TAG, "Unknown rt type of " + rt.getClass().getName()); 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 ...@@ -908,6 +912,7 @@ public class UpnpClientActivity extends Activity implements
Log.i(TAG, "Cancelling Observe..."); Log.i(TAG, "Cancelling Observe...");
for (OcResource resource : iotivityResources) { for (OcResource resource : iotivityResources) {
try { try {
Log.i(TAG, "Cancelling Observe for " + resource.getUri());
resource.cancelObserve(); resource.cancelObserve();
} catch (OcException e) { } catch (OcException e) {
Log.e(TAG, "Error occurred while invoking \"cancelObserve\" API -- " + e.toString(), e); Log.e(TAG, "Error occurred while invoking \"cancelObserve\" API -- " + e.toString(), e);
......
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