Merge branch 'master' of http://repo.koc.se/hal
Former-commit-id: 9a0f546853b78d3780d00a27ef77a70a3849ac2f
This commit is contained in:
commit
5f55b5da65
2 changed files with 3 additions and 1 deletions
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
|
||||
<target name="run-local-sensor" depends="">
|
||||
<java fork="true" failonerror="true" classname="se.hal.plugin.localsensor.ImpulseTracker">
|
||||
<java fork="true" failonerror="true" classname="se.hal.plugin.localsensor.RPiImpulseCountSensor">
|
||||
<classpath>
|
||||
<pathelement path="${buildDir}/hal.jar"/> <!--wildcard may not be platform independent, ok?-->
|
||||
<pathelement path="${libDir}/*"/> <!--wildcard may not be platform independent, ok?-->
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ public class RPiImpulseCountSensor implements Runnable {
|
|||
public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) {
|
||||
if(event.getState() == PinState.LOW){ //low = light went on
|
||||
//System.out.println("IR LED turned ON");
|
||||
//logger.log(Level.INFO, "IR LED turned on");
|
||||
synchronized(impulseCount){
|
||||
impulseCount++;
|
||||
}
|
||||
|
|
@ -132,6 +133,7 @@ public class RPiImpulseCountSensor implements Runnable {
|
|||
executorPool.execute(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
logger.log(Level.INFO, "Saving data to DB. timestamp_end="+timestamp_end+", data="+data);
|
||||
try {
|
||||
db.exec("INSERT INTO sensor_data_raw(timestamp, sensor_id, data) VALUES("+timestamp_end+", "+RPiImpulseCountSensor.this.sensorId+", "+data+")");
|
||||
} catch (SQLException e) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue