Beispiel #1
0
  /** Ignore. */
  public void run() {

    try {

      while (running) {

        if (!pachubePOSTurl.equals("") && localSensorsAdded) {
          try {
            updateLocalSensors(dOut);
            int response = dOut.updatePachube();
            if (response != 200) {
              System.out.println("There was an error posting: " + response);
              if (response == 401) {
                System.out.println(
                    "Incorrect API key, or you are trying to update a feed that does not belong to you.");
              } else if (response == 404) {
                System.out.println("The Pachube feed you are trying to update does not exist.");
              }
            } else {

              System.out.print("Pachube updated with local sensor values: ");

              for (int i = 0; i < totalLocalSensors; i++) {
                System.out.print(localSensor[i].value + "\t");
              }
              System.out.println();
            }
          } catch (Exception e) {
            System.err.println("Problem running DataOut...");
            e.printStackTrace();
            postThread = null;
          }
        }

        try {
          sleep(POST_RATE);
        } catch (Exception e) {
          System.err.println("DataOut: There was a problem sleeping.");
          e.printStackTrace();
        }
      }

    } catch (Exception e) {
      System.err.println("DataOut: There was a problem running.");
      e.printStackTrace();
    }
  }
Beispiel #2
0
 public void setLocation(float lat, float lon, float ele) {
   dOut.setLocation(lat, lon, ele);
 }
Beispiel #3
0
 public void setLocation(
     String exposure, String domain, String disposition, float lat, float lon, float ele) {
   dOut.setLocation(exposure, domain, disposition, lat, lon, ele);
 }
Beispiel #4
0
 public void setLocation(String exposure, String domain, String disposition) {
   dOut.setLocation(exposure, domain, disposition);
 }
Beispiel #5
0
 void update(DataOut d) {
   d.update(id, value);
 }