Exemplo n.º 1
0
  @Override
  public void onPutResponseCallback(
      Vector<OcHeaderOption> headerOptions, OcRepresentation rep, int errorValue) {
    Log.i(LOG_TAG, "Got Callback : onPutResponseCallback");

    groupApiActivityObj = GroupApiActivity.getGroupApiActivityObj();
    logMessage = "API Result : SUCCESS" + "\n";
    logMessage += "Recieved Callback for called API (onPutResponseCallback)" + "\n";
    GroupApiActivity.setMessageLog(logMessage);
    // sending message to handler of GroupApiActivity to Update the UI
    msg = Message.obtain();
    msg.what = 1;
    groupApiActivityObj.getHandler().sendMessage(msg);
  }
Exemplo n.º 2
0
  @Override
  public void onGetResponseCallback(
      Vector<OcHeaderOption> headerOptions, OcRepresentation rep, int errorValue) {
    Log.i(LOG_TAG, "Got Callback : onGetResponseCallback");

    String actionSetStr = rep.getValueString("ActionSet");
    groupApiActivityObj = GroupApiActivity.getGroupApiActivityObj();
    logMessage =
        "Recieved Callback for called API (onGetResponseCallback)"
            + "\n"
            + "ActionSet:"
            + actionSetStr;

    GroupApiActivity.setMessageLog(logMessage);
    // sending message to handler of GroupApiActivity to Update the UI
    msg = Message.obtain();
    msg.what = 1;
    groupApiActivityObj.getHandler().sendMessage(msg);

    if (actionSetStr != null) {
      ActionSet actionSet = ActionSet.toActionSet(actionSetStr);
      if (actionSet != null) {
        System.out.println("ActionSet Name : " + actionSet.actionsetName);
        for (int i = 0; i < actionSet.listOfAction.size(); i++) {
          Action action = actionSet.listOfAction.get(i);
          System.out.println("Target : " + action.target);

          Vector<Capability> listOfCapability = action.listOfCapability;
          for (int j = 0; j < listOfCapability.size(); j++) {
            Capability capability = listOfCapability.get(j);
            System.out.println("Capability : " + capability.capability);
            System.out.println("Status : " + capability.status);
          }
        }
      }
    }

    groupApiActivityObj = GroupApiActivity.getGroupApiActivityObj();
    GroupApiActivity.setMessageLog(logMessage);
    msg = Message.obtain();
    msg.what = 1;
    groupApiActivityObj.getHandler().sendMessage(msg);
  }