Improved logging
Former-commit-id: eab453cc52f1d23906d31e429cab40f2d09bc53a
This commit is contained in:
parent
1d57b3f1dd
commit
b39f5c1f0b
2 changed files with 3 additions and 1 deletions
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
|
|
||||||
<target name="run-local-sensor" depends="">
|
<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>
|
<classpath>
|
||||||
<pathelement path="${buildDir}/hal.jar"/> <!--wildcard may not be platform independent, ok?-->
|
<pathelement path="${buildDir}/hal.jar"/> <!--wildcard may not be platform independent, ok?-->
|
||||||
<pathelement path="${libDir}/*"/> <!--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) {
|
public void handleGpioPinDigitalStateChangeEvent(GpioPinDigitalStateChangeEvent event) {
|
||||||
if(event.getState() == PinState.LOW){ //low = light went on
|
if(event.getState() == PinState.LOW){ //low = light went on
|
||||||
//System.out.println("IR LED turned ON");
|
//System.out.println("IR LED turned ON");
|
||||||
|
//logger.log(Level.INFO, "IR LED turned on");
|
||||||
synchronized(impulseCount){
|
synchronized(impulseCount){
|
||||||
impulseCount++;
|
impulseCount++;
|
||||||
}
|
}
|
||||||
|
|
@ -132,6 +133,7 @@ public class RPiImpulseCountSensor implements Runnable {
|
||||||
executorPool.execute(new Runnable(){
|
executorPool.execute(new Runnable(){
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
logger.log(Level.INFO, "Saving data to DB. timestamp_end="+timestamp_end+", data="+data);
|
||||||
try {
|
try {
|
||||||
db.exec("INSERT INTO sensor_data_raw(timestamp, sensor_id, data) VALUES("+timestamp_end+", "+RPiImpulseCountSensor.this.sensorId+", "+data+")");
|
db.exec("INSERT INTO sensor_data_raw(timestamp, sensor_id, data) VALUES("+timestamp_end+", "+RPiImpulseCountSensor.this.sensorId+", "+data+")");
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue