Hi IoTivity,
I'm developing an IoTivity Client using Android, i can decover all the
resources, but i want to discover all the attributes of each resource
(GET), i haven' t an error, but i think that i miss something in my code,I
try to get only the attribute of the Fan and this my code :
@Override
public synchronized void onResourceFound(OcResource foundResource) {
.
.
.
.
if (resourceUri.equals("/a/collection/Fan")) {
mFoundCollectionResource = foundResource;
msg("Getting representation of a collection resource...");
Map<String, String> queryParams = new HashMap<>();
try {
System.out.println("test1");
mFoundCollectionResource.get(
"",
OcPlatform.DEFAULT_INTERFACE,
queryParams,
this
);
} catch (OcException e) {
Log.e(TAG, e.toString());
msg("Error occurred while invoking \"get\" API");
}
}
printLine();
enableStartStopButton();
.
.
.
}
/**
* An event handler to be executed whenever a "get" request completes
successfully
*
* @param list list of the header options
* @param representation representation of a resource
*/
@Override
public synchronized void onGetCompleted(List<OcHeaderOption> list,
OcRepresentation representation) {
msg("Representation of a light collection resource:");
for (OcRepresentation childRepresentation : representation.getChildren()) {
msg("\t\tURI: " + childRepresentation.getUri());
printLine();
System.out.println("seliiiiiiiim");
}
System.out.println("seliiiiiiiim2");
}
/**
* An event handler to be executed whenever a "get" request fails
*
* @param throwable exception
*/
@Override
public synchronized void onGetFailed(Throwable throwable) {
if (throwable instanceof OcException) {
OcException ocEx = (OcException) throwable;
Log.e(TAG, ocEx.toString());
ErrorCode errCode = ocEx.getErrorCode();
//do something based on errorCode
msg("Error code: " + errCode);
}
msg("Failed to get representation of a found collection resource");
}
////////////////////
Can someone help me to please ?
*Best regards,*
*Salim Zayen*
*Student*
*Phone :+216 23 85 66 25*
*esprit*?
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20160811/138d51ae/attachment.html>