1
0
This repository has been archived on 2024-01-25. You can view files and clone it, but cannot push or open issues or pull requests.
Rémi Heredero d58097d723
Subscription (#7)
* Change update DataPoints by a subscription way

* Remove unused import

* small polish
2023-05-26 12:46:35 +02:00

34 lines
750 B
Java

package ch.hevs.isi.web;
import ch.hevs.isi.core.DataPoint;
import ch.hevs.isi.core.DataPointListener;
public class WebConnector implements DataPointListener {
private static WebConnector mySelf = null;
private WebConnector (){
// Subscribe to the update of DataPoints
DataPointListener.subscribeUpdate(this);
}
public static WebConnector getMySelf(){
if (mySelf == null){
mySelf = new WebConnector();
}
return mySelf;
}
public void initialize(String host, int port){
}
private void pushToWeb(DataPoint dp){
System.out.println(dp.toString() + " -> Web");
}
@Override
public void onNewValue(DataPoint dp) {
pushToWeb(dp);
}
}