Package com.openhouseautomation.model

Examples of com.openhouseautomation.model.Reading


    // try {
    // DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
    // Key parkey = entreading.getParent();
    // Entity parent = datastore.get(parkey);
    // String type = (String) parent.getProperty("type");
    Reading reading = ofy().load().fromEntity(entreading);
    if (reading == null) {
      log.log(Level.SEVERE, "null reading");
    }
    Sensor sensor = ofy().load().now(reading.getSensor());
    if (sensor == null) {
      log.log(Level.SEVERE, "null sensor");
    }
    String sentitydate = getDateString(reading.getTimestamp());
    String value = reading.getValue(); // value of reading
    emit(sensor.getType() + ":" + sensor.getId() + ":" + sentitydate, value);
    // emits the form: TEMPERATURE:38382834:20140417, 72
    // where TYPE:SENSORID:DATE,READING
    // } catch (EntityNotFoundException e) {
    // }
View Full Code Here


          // set the value
          sensor.setLastReadingDate(new Date());
          sensor.setLastReading(sensorval);
          ofy().save().entity(sensor);
          log.log(Level.INFO, "saved sensor:{0}", sensor);
          Reading reading = new Reading();
          reading.setSensor(sk);
          reading.setTimestamp(new Date());
          reading.setValue(sensorval);
          ofy().save().entity(reading);
          log.log(Level.INFO, "logged reading:{0}", reading);
          return sensor;
        }
      });
View Full Code Here

TOP

Related Classes of com.openhouseautomation.model.Reading

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.