diff --git a/src/java/com/wasteinformationserver/db/MySQLConnector.java b/src/java/com/wasteinformationserver/db/MySQLConnector.java index 0053679..c4d447b 100755 --- a/src/java/com/wasteinformationserver/db/MySQLConnector.java +++ b/src/java/com/wasteinformationserver/db/MySQLConnector.java @@ -19,7 +19,7 @@ public class MySQLConnector extends Database { } public Connection getConnection() throws SQLException { - DriverManager.setLoginTimeout(1); // TODO: 30.11.19 set higher maybe + DriverManager.setLoginTimeout(1); return DriverManager.getConnection( "jdbc:mysql://" + host + ":" + port + "/" + dbName + "?useSSL=false", user, diff --git a/src/java/com/wasteinformationserver/mqtt/MqttService.java b/src/java/com/wasteinformationserver/mqtt/MqttService.java index c5cee33..7c36053 100644 --- a/src/java/com/wasteinformationserver/mqtt/MqttService.java +++ b/src/java/com/wasteinformationserver/mqtt/MqttService.java @@ -43,7 +43,7 @@ public class MqttService { @Override public void messageArrived(String s, MqttMessage mqttMessage) { String message = new String(mqttMessage.getPayload()); - Log.info("received Request from PCB"); + Log.message("received Request from PCB"); ResultSet res = db.executeQuery("SELECT * from devices WHERE DeviceID=" + message); try { @@ -61,6 +61,7 @@ public class MqttService { } else { //new device db.executeUpdate("INSERT INTO devices (DeviceID) VALUES (" + message + ")"); + Log.info("new device registered to server"); tramsmitMessage(message + ",-1"); } } catch (SQLException e) { @@ -99,6 +100,7 @@ public class MqttService { if (timestamp == timestampnow || timestamp == timestampnow + 86400000) { // 86400000 == one day // valid time + // TODO: 12.01.20 read right waste type from db and replace below tramsmitMessage(deviceid + "," + "Plastic" + "," + 1); Log.debug("valid time"); return;