small refactoring

Former-commit-id: 4294250a28aa0f0c3ed4078ec38ea2a3902c73fb
This commit is contained in:
Ziver Koc 2016-02-04 13:24:38 +01:00
parent 68707cbb35
commit afca115553
2 changed files with 9 additions and 9 deletions

View file

@ -67,7 +67,7 @@ public class SensorDataAggregatorDaemon implements HalDaemon {
*/
private void aggregateRawData(Sensor sensor, long toPeriodSizeInMs, long ageLimitInMs, int expectedSampleCount){
long sensorId = sensor.getId();
AggregationMethod aggrMethod = sensor.getAggregationMethod();
AggregationMethod aggrMethod = sensor.getDeviceData().getAggregationMethod();
DBConnection db = HalContext.getDB();
PreparedStatement stmt = null;
try {

View file

@ -85,18 +85,18 @@ public class Sensor extends AbstractDevice<HalSensorData>{
}
public HalSensorData.AggregationMethod getAggregationMethod(){
return getDeviceData().getAggregationMethod();
}
public Class<? extends HalSensorController> getController(){
return getDeviceData().getSensorController();
}
/**
* Will clear all aggregated data for this Sensor and increment the AggregationVersion
*/
public void clearAggregatedData(DBConnection db) throws SQLException{
PreparedStatement stmt = db.getPreparedStatement( "DELETE FROM sensor_data_aggr WHERE sensor_id == ?" );
stmt.setLong(1, getId());
DBConnection.exec(stmt);
aggr_version++;
}
public Class<? extends HalSensorController> getController(){
return getDeviceData().getSensorController();
}
}