adding ant build script
Former-commit-id: 47153bf95c1f09c1119a11c95f1188d8beca0113
This commit is contained in:
parent
a0dce97932
commit
4c05900dfc
6 changed files with 111 additions and 11 deletions
|
|
@ -23,6 +23,7 @@
|
|||
<classpathentry kind="lib" path="lib/marytts-client-5.1.2-jar-with-dependencies.jar"/>
|
||||
<classpathentry kind="lib" path="lib/marytts-runtime-5.1.2-jar-with-dependencies.jar"/>
|
||||
<classpathentry kind="lib" path="lib/pi4j-core-1.0.jar"/>
|
||||
<classpathentry kind="lib" path="lib/junit-4.12.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/zutil-java"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
||||
|
|
|
|||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/build/
|
||||
90
build.xml
Normal file
90
build.xml
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="Hal" default="" >
|
||||
|
||||
<!-- ________________________ PROPERTIES AND SETTINGS ________________________ -->
|
||||
|
||||
<!--common properties-->
|
||||
<property name="gitRoot" value="." />
|
||||
<property name="srcDir" value="${gitRoot}/src" />
|
||||
<property name="testDir" value="${gitRoot}/test" />
|
||||
<property name="libDir" value="${gitRoot}/lib" />
|
||||
<property name="buildDir" value="${gitRoot}/build" />
|
||||
|
||||
<!--define standard arduments for javac-->
|
||||
<presetdef name="javac">
|
||||
<javac includeantruntime="false" />
|
||||
</presetdef>
|
||||
|
||||
<!-- ________________________ CLASSPATHS ________________________ -->
|
||||
|
||||
<!--classpath included when building-->
|
||||
<path id="classpath.build">
|
||||
<pathelement location="${libDir}/*" />
|
||||
</path>
|
||||
|
||||
<!-- ________________________ PUBLIC TARGETS ________________________ -->
|
||||
|
||||
|
||||
<target name="run-local-sensor" depends="build">
|
||||
<java fork="true" failonerror="true" classname="se.koc.hal.plugin.localsensor.ImpulseTracker">
|
||||
<classpath>
|
||||
<pathelement path="${buildDir}/hal.jar"/> <!--wildcard may not be platform independent, ok?-->
|
||||
<pathelement path="${libDir}/*"/> <!--wildcard may not be platform independent, ok?-->
|
||||
</classpath>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<target name="run-remote-sensor" depends="build">
|
||||
<java fork="true" failonerror="true" classname="se.koc.hal.plugin.tellstick.TelstickSerialCommTest">
|
||||
<classpath>
|
||||
<pathelement path="${buildDir}/hal.jar"/> <!--wildcard may not be platform independent, ok?-->
|
||||
<pathelement path="${libDir}/*"/> <!--wildcard may not be platform independent, ok?-->
|
||||
</classpath>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<target name="run-main-server" depends="build">
|
||||
<java fork="true" failonerror="true" classname="se.koc.hal.PowerChallenge">
|
||||
<classpath>
|
||||
<pathelement path="${buildDir}/hal.jar"/> <!--wildcard may not be platform independent, ok?-->
|
||||
<pathelement path="${libDir}/*"/> <!--wildcard may not be platform independent, ok?-->
|
||||
</classpath>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<!--clean all build paths-->
|
||||
<target name="clean">
|
||||
<delete includeemptydirs="true" failonerror="false">
|
||||
<fileset dir="${buildDir}" includes="**/*"/>
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<!--build product code-->
|
||||
<target name="build" depends="build-dependencies">
|
||||
<mkdir dir="${buildDir}" />
|
||||
<javac srcdir="${srcDir}" destdir="${buildDir}" fork="yes">
|
||||
<include name="**/*.java" />
|
||||
<classpath refid="classpath.build" />
|
||||
</javac>
|
||||
<javac srcdir="${testDir}" destdir="${buildDir}" fork="yes">
|
||||
<include name="**/*.java" />
|
||||
<classpath refid="classpath.build" />
|
||||
</javac>
|
||||
<jar destfile="${buildDir}/hal.jar" basedir="${buildDir}" excludes="hal.jar" />
|
||||
</target>
|
||||
|
||||
<target name="build-dependencies">
|
||||
<mkdir dir="${buildDir}" />
|
||||
<javac srcdir="${libDir}/java-speech-api-master/src" destdir="${buildDir}" fork="yes">
|
||||
<include name="**/*.java" />
|
||||
<classpath refid="classpath.build" />
|
||||
</javac>
|
||||
<javac srcdir="${libDir}/sphinx4-5prealpha-src/sphinx4-core/src/main/java" destdir="${buildDir}" fork="yes" encoding="UTF-8">
|
||||
<include name="**/*.java" />
|
||||
<classpath refid="classpath.build" />
|
||||
</javac>
|
||||
<get src="http://repo.koc.se/zutil-java.git/blob/master/Zutil.jar" dest="${libDir}" verbose="true" usetimestamp="true"/>
|
||||
</target>
|
||||
|
||||
|
||||
</project>
|
||||
BIN
lib/junit-4.12.jar
Normal file
BIN
lib/junit-4.12.jar
Normal file
Binary file not shown.
1
lib/sqlite-jdbc-3.7.2.jar.REMOVED.git-id
Normal file
1
lib/sqlite-jdbc-3.7.2.jar.REMOVED.git-id
Normal file
|
|
@ -0,0 +1 @@
|
|||
b0bec7b000d369a8f3dcaa9c6cd0b3ce87aed454
|
||||
|
|
@ -1,8 +1,12 @@
|
|||
package se.koc.hal.plugin.localsensor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import zutil.db.DBConnection;
|
||||
import zutil.log.LogUtil;
|
||||
|
||||
import com.pi4j.io.gpio.GpioController;
|
||||
import com.pi4j.io.gpio.GpioFactory;
|
||||
|
|
@ -14,17 +18,19 @@ import com.pi4j.io.gpio.event.GpioPinDigitalStateChangeEvent;
|
|||
import com.pi4j.io.gpio.event.GpioPinListenerDigital;
|
||||
|
||||
public class ImpulseTracker implements Runnable {
|
||||
private static final Logger logger = LogUtil.getLogger();
|
||||
|
||||
private static final int IMPULSE_REPORT_TIMEOUT = 60000; //one minute
|
||||
private long nanoSecondsSleep = IMPULSE_REPORT_TIMEOUT * 1000000L;
|
||||
private Integer impulseCount = 0;
|
||||
private ExecutorService executorPool;
|
||||
private final DBConnection db;
|
||||
|
||||
public static void main(String args[]) throws InterruptedException, IOException {
|
||||
public static void main(String args[]) throws Exception {
|
||||
new ImpulseTracker();
|
||||
}
|
||||
|
||||
public ImpulseTracker() throws InterruptedException, IOException{
|
||||
public ImpulseTracker() throws Exception{
|
||||
|
||||
// create gpio controller
|
||||
final GpioController gpio = GpioFactory.getInstance();
|
||||
|
|
@ -48,6 +54,9 @@ public class ImpulseTracker implements Runnable {
|
|||
|
||||
this.executorPool = Executors.newCachedThreadPool();
|
||||
|
||||
logger.info("Connecting to db...");
|
||||
db = new DBConnection(DBConnection.DBMS.SQLite, "hal.db");
|
||||
|
||||
//start a daemon thread to save the impulse count every minute
|
||||
Thread thread = new Thread(this);
|
||||
thread.setDaemon(true);
|
||||
|
|
@ -92,15 +101,13 @@ public class ImpulseTracker implements Runnable {
|
|||
executorPool.execute(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
//this.listener.
|
||||
try {
|
||||
db.exec("INSERT INTO sensor_data_raw (timestamp, sensor_id, data) VALUE("+timestamp_end+", "+2+", "+data+")");
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
public void setListener(Object listener){
|
||||
this.listener = listener;
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue