mirror of
https://github.com/jlengrand/cellar.git
synced 2026-03-10 08:01:19 +00:00
Working makefile. Starting helidon app
This commit is contained in:
@@ -36,6 +36,11 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>nl.lengrand</groupId>
|
||||
<artifactId>cellar-driver</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.helidon.microprofile.bundles</groupId>
|
||||
<artifactId>helidon-microprofile</artifactId>
|
||||
@@ -60,6 +65,12 @@
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>nl.lengrand</groupId>
|
||||
<artifactId>cellar-driver</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
11
cellar-app/src/main/java/nl/lengrand/CellarProvider.java
Normal file
11
cellar-app/src/main/java/nl/lengrand/CellarProvider.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package nl.lengrand;
|
||||
|
||||
import javax.enterprise.context.ApplicationScoped;
|
||||
|
||||
@ApplicationScoped
|
||||
public class CellarProvider {
|
||||
|
||||
public SensorValues getSensorValues(){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
39
cellar-app/src/main/java/nl/lengrand/CellarResource.java
Normal file
39
cellar-app/src/main/java/nl/lengrand/CellarResource.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package nl.lengrand;
|
||||
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.json.Json;
|
||||
import javax.json.JsonBuilderFactory;
|
||||
import javax.json.JsonObject;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import java.util.Collections;
|
||||
|
||||
@Path("/sensor")
|
||||
@RequestScoped
|
||||
public class CellarResource {
|
||||
|
||||
private static final JsonBuilderFactory JSON = Json.createBuilderFactory(Collections.emptyMap());
|
||||
private final CellarProvider cellarProvider;
|
||||
|
||||
@Inject
|
||||
public CellarResource(CellarProvider cellarConfig){
|
||||
this.cellarProvider = cellarConfig;
|
||||
}
|
||||
|
||||
@GET
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public JsonObject getSensorValues(){
|
||||
return createResponse(cellarProvider.getSensorValues());
|
||||
}
|
||||
|
||||
private JsonObject createResponse(SensorValues values) {
|
||||
return JSON.createObjectBuilder()
|
||||
.add("test", "test")
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
4
cellar-app/src/main/java/nl/lengrand/SensorValues.java
Normal file
4
cellar-app/src/main/java/nl/lengrand/SensorValues.java
Normal file
@@ -0,0 +1,4 @@
|
||||
package nl.lengrand;
|
||||
|
||||
public class SensorValues {
|
||||
}
|
||||
@@ -4,7 +4,7 @@ HEADERS = ../../target/headers/Dht11Driver.h adafruit/common_dht_read.h adafruit
|
||||
FILES = adafruit/common_dht_read.c adafruit/Raspberry_Pi_2/pi_2_mmio.c adafruit/Raspberry_Pi_2/pi_2_dht_read.c Dht11Driver.c
|
||||
OUT = libdht11
|
||||
|
||||
default: library
|
||||
default: library move
|
||||
|
||||
program: Dht11Driver.c
|
||||
gcc -Wall $(INCLUDES) $(HEADERS) $(FILES) -o $(OUT)
|
||||
|
||||
Reference in New Issue
Block a user