1
0

change System.out.println to pDebug

This commit is contained in:
Rémi Heredero 2023-06-09 16:23:59 +02:00
parent fd293b15e1
commit 6ea85aa945
3 changed files with 8 additions and 6 deletions

View File

@ -163,7 +163,7 @@ public class DatabaseConnector implements DataPointListener {
if(respondCode != 204){
System.out.println("Error: " + respondCode + ", Data: " + data);
} else {
System.out.println(data + " -> Database");
Utility.pDebug(data + " -> Database");
}
con.disconnect();
con = null;

View File

@ -3,6 +3,7 @@ package ch.hevs.isi.field;
import ch.hevs.isi.core.DataPoint;
import ch.hevs.isi.core.DataPointListener;
import ch.hevs.isi.core.FloatDataPoint;
import ch.hevs.isi.utils.Utility;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
@ -89,7 +90,7 @@ public class FieldConnector implements DataPointListener {
}
private void pushToField(String label, String value){
System.out.println("Field: " + label + " " + value);
Utility.pDebug("Field: " + label + " " + value);
}
@Override
public void onNewValue(DataPoint dp) {

View File

@ -4,6 +4,7 @@ import ch.hevs.isi.core.BooleanDataPoint;
import ch.hevs.isi.core.DataPoint;
import ch.hevs.isi.core.DataPointListener;
import ch.hevs.isi.core.FloatDataPoint;
import ch.hevs.isi.utils.Utility;
import org.java_websocket.WebSocket;
import org.java_websocket.handshake.ClientHandshake;
import org.java_websocket.server.WebSocketServer;
@ -50,7 +51,7 @@ public class WebConnector implements DataPointListener {
@Override
public void onMessage(WebSocket conn, String message) {
System.out.println("received message from " + conn.getRemoteSocketAddress() + ": " + message);
Utility.pDebug("received message from " + conn.getRemoteSocketAddress() + ": " + message);
updateDataPoint(message);
}
@ -74,15 +75,15 @@ public class WebConnector implements DataPointListener {
private void pushToWeb(DataPoint dp){
wss.broadcast(dp.toString());
System.out.println(dp.toString() + " -> Web");
Utility.pDebug(dp.toString() + " -> Web");
}
private void updateDataPoint(String message){
String label = message.split("=")[0];
System.out.println("Label: " + label);
Utility.pDebug("Label: " + label);
String value = message.split("=")[1];
System.out.println("Value: " + value);
Utility.pDebug("Value: " + value);
if( (value.equals("true")) || value.equals("false") ) {
new BooleanDataPoint(label, true).setValue(Boolean.parseBoolean(value));