Beispiel #1
0
  /**
   * Submit task to the scheduler. Works in async way. The result will be returned in a intent whose
   * action is USER_RESULT_ACTION + clientKey or SERVER_RESULT_ACTION
   *
   * @param task the task to be exectued, created by createTask(..) or composeTask(..)
   * @throws MeasurementError
   */
  public void submitTask(MeasurementTask task) throws MeasurementError {
    Logger.d("API->submitTask called");
    if (task != null) {
      //      // Hongyi: for delay measurement
      //      task.getDescription().parameters.put("ts_api_send",
      //        String.valueOf(System.currentTimeMillis()));

      Logger.i("API: Adding new " + task.getType() + " task " + task.getTaskId());
      Message msg = Message.obtain(null, Config.MSG_SUBMIT_TASK);
      Bundle data = new Bundle();
      data.putParcelable(UpdateIntent.MEASUREMENT_TASK_PAYLOAD, task);
      msg.setData(data);
      sendMessage(msg);
    } else {
      String err = "submitTask: task is null";
      Logger.e(err);
      throw new MeasurementError(err);
    }
  }
Beispiel #2
0
 /**
  * Get the type of a measurement based on its name. Type is for JSON interface only where as
  * measurement name is a readable string for the UI
  */
 public static String getTypeForMeasurementName(String name) {
   return MeasurementTask.getTypeForMeasurementName(name);
 }
Beispiel #3
0
 /** Gets the currently available measurement descriptions */
 public static Set<String> getMeasurementNames() {
   return MeasurementTask.getMeasurementNames();
 }