Working makefile. Starting helidon app

This commit is contained in:
Julien Lengrand-Lambert
2019-12-14 09:10:36 +01:00
parent 1cd447ab54
commit a045aac83e
5 changed files with 66 additions and 1 deletions

View File

@@ -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>

View File

@@ -0,0 +1,11 @@
package nl.lengrand;
import javax.enterprise.context.ApplicationScoped;
@ApplicationScoped
public class CellarProvider {
public SensorValues getSensorValues(){
return null;
}
}

View 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();
}
}

View File

@@ -0,0 +1,4 @@
package nl.lengrand;
public class SensorValues {
}

View File

@@ -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)