Some bug fixes
Former-commit-id: d282235d58ecb970ef1a7190ccaa592f097e1499
This commit is contained in:
parent
1949d11f99
commit
c99cedb2ad
4 changed files with 14 additions and 8 deletions
|
|
@ -2,6 +2,7 @@ package se.koc.hal;
|
|||
|
||||
|
||||
import se.koc.hal.deamon.DataAggregatorDaemon;
|
||||
import se.koc.hal.deamon.DataSynchronizationClient;
|
||||
import se.koc.hal.deamon.DataSynchronizationDaemon;
|
||||
import se.koc.hal.deamon.HalDaemon;
|
||||
import se.koc.hal.page.PCConfigureHttpPage;
|
||||
|
|
@ -24,7 +25,8 @@ public class PowerChallenge {
|
|||
|
||||
private static HalDaemon[] daemons = new HalDaemon[]{
|
||||
new DataAggregatorDaemon(),
|
||||
new DataSynchronizationDaemon()
|
||||
new DataSynchronizationDaemon(),
|
||||
new DataSynchronizationClient()
|
||||
};
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
|
@ -41,11 +43,11 @@ public class PowerChallenge {
|
|||
daemon.initiate(daemonTimer);
|
||||
}
|
||||
|
||||
HttpServer http = new HttpServer(80);
|
||||
/*HttpServer http = new HttpServer(80);
|
||||
http.setDefaultPage(new HttpFilePage(FileUtil.find("web-resource/")));
|
||||
http.setPage("/", new PCOverviewHttpPage());
|
||||
http.setPage("/configure", new PCConfigureHttpPage());
|
||||
http.setPage("/heatmap", new PCHeatMapHttpPage());
|
||||
http.start();
|
||||
http.start();*/
|
||||
}
|
||||
}
|
||||
|
|
|
|||
2
src/se/koc/hal/deamon/DataSynchronizationClient.java
Normal file → Executable file
2
src/se/koc/hal/deamon/DataSynchronizationClient.java
Normal file → Executable file
|
|
@ -84,7 +84,7 @@ public class DataSynchronizationClient extends TimerTask implements HalDaemon{
|
|||
|
||||
|
||||
/////////////// DTO ///////////////////////
|
||||
protected class PeerDataReqDTO implements Serializable{
|
||||
protected static class PeerDataReqDTO implements Serializable{
|
||||
private static final long serialVersionUID = -9066734025245139989L;
|
||||
|
||||
public long sensorId;
|
||||
|
|
|
|||
10
src/se/koc/hal/deamon/DataSynchronizationDaemon.java
Normal file → Executable file
10
src/se/koc/hal/deamon/DataSynchronizationDaemon.java
Normal file → Executable file
|
|
@ -21,7 +21,8 @@ import zutil.net.threaded.ThreadedTCPNetworkServerThread;
|
|||
|
||||
public class DataSynchronizationDaemon extends ThreadedTCPNetworkServer implements HalDaemon{
|
||||
private static final Logger logger = LogUtil.getLogger();
|
||||
public static final int SERVER_PORT = 6666;
|
||||
//public static final int SERVER_PORT = 6666;
|
||||
public static final int SERVER_PORT = 80;
|
||||
|
||||
|
||||
public DataSynchronizationDaemon() {
|
||||
|
|
@ -88,6 +89,9 @@ public class DataSynchronizationDaemon extends ThreadedTCPNetworkServer implemen
|
|||
out.writeObject(list);
|
||||
}
|
||||
}
|
||||
out.close();
|
||||
in.close();
|
||||
s.close();
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
|
|
@ -99,11 +103,11 @@ public class DataSynchronizationDaemon extends ThreadedTCPNetworkServer implemen
|
|||
}
|
||||
|
||||
/////////////// DTO ///////////////////////
|
||||
protected class SensorDataListDTO extends ArrayList<SensorDataDTO> implements Serializable{
|
||||
protected static class SensorDataListDTO extends ArrayList<SensorDataDTO> implements Serializable{
|
||||
private static final long serialVersionUID = -5701618637734020691L;
|
||||
}
|
||||
|
||||
protected class SensorDataDTO implements Serializable{
|
||||
protected static class SensorDataDTO implements Serializable{
|
||||
private static final long serialVersionUID = 8494331502087736809L;
|
||||
|
||||
public long sequenceId;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class TelstickSerialCommTest {
|
|||
try {
|
||||
db.exec("INSERT INTO sensor_data_raw (timestamp, sensor_id, data) VALUES("+
|
||||
System.currentTimeMillis() + "," +
|
||||
"0," +
|
||||
"1," +
|
||||
(int)((Oregon0x1A2D)protocol).getTemperature()
|
||||
+")");
|
||||
} catch (SQLException e) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue