Created
October 27, 2020 17:23
-
-
Save IT-Berater/c58da54b1f20337827f8de827715d728 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package de.wenzlaff; | |
import javax.ws.rs.GET; | |
import javax.ws.rs.Path; | |
import javax.ws.rs.Produces; | |
import javax.ws.rs.core.MediaType; | |
@Path("/v1") | |
public class CO2AmpelResource { | |
static { | |
try { | |
MqttCo2Client.start(); | |
} catch (Exception e) { | |
} | |
} | |
@Path("/rest/co2ampel") | |
@GET | |
@Produces(MediaType.TEXT_PLAIN) | |
public String co2ampel() { | |
return "CO2Ampel: " + MqttCo2Client.bewertungUBAausgeben(MqttCo2Client.getCo2WertInPpm()); | |
} | |
@Path("/rest/co2") | |
@GET | |
@Produces(MediaType.TEXT_PLAIN) | |
public String co2wert() { | |
return "CO2 Wert: " + MqttCo2Client.getCo2WertInPpm(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment