small refactoring
Former-commit-id: 4294250a28aa0f0c3ed4078ec38ea2a3902c73fb
This commit is contained in:
parent
68707cbb35
commit
afca115553
2 changed files with 9 additions and 9 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue