diff --git a/pi4j-spring-boot/pom.xml b/pi4j-spring-boot/pom.xml
index 951143c..3e7d236 100644
--- a/pi4j-spring-boot/pom.xml
+++ b/pi4j-spring-boot/pom.xml
@@ -19,10 +19,6 @@
com.pi4j
pi4j-core
-
- com.pi4j
- pi4j-board-info
-
com.pi4j
pi4j-plugin-raspberrypi
@@ -35,6 +31,10 @@
com.pi4j
pi4j-plugin-linuxfs
+
+ com.pi4j
+ pi4j-plugin-gpiod
+
diff --git a/pi4j-spring-boot/src/main/java/com/pi4j/spring/boot/ContextConditions.java b/pi4j-spring-boot/src/main/java/com/pi4j/spring/boot/ContextConditions.java
index 0c5c7f3..ad24dd4 100644
--- a/pi4j-spring-boot/src/main/java/com/pi4j/spring/boot/ContextConditions.java
+++ b/pi4j-spring-boot/src/main/java/com/pi4j/spring/boot/ContextConditions.java
@@ -9,6 +9,9 @@ public ContextConditions() {
super(ConfigurationPhase.REGISTER_BEAN);
}
+ /**
+ * TODO are these still needed? Can't we use Pi4jActuatorConfiguration.boardInfo ?
+ */
@ConditionalOnProperty(prefix = "os", name = "arch", havingValue = "armv6l")
static class Armv6l {
}
diff --git a/pi4j-spring-boot/src/main/java/com/pi4j/spring/boot/ContextConfiguration.java b/pi4j-spring-boot/src/main/java/com/pi4j/spring/boot/ContextConfiguration.java
index b9ab877..883a702 100644
--- a/pi4j-spring-boot/src/main/java/com/pi4j/spring/boot/ContextConfiguration.java
+++ b/pi4j-spring-boot/src/main/java/com/pi4j/spring/boot/ContextConfiguration.java
@@ -12,10 +12,16 @@
@ConditionalOnClass(Context.class)
public class ContextConfiguration {
+ private final Context pi4j;
+
+ public ContextConfiguration() {
+ this.pi4j = Pi4J.newAutoContext();
+ }
+
@Bean
@Conditional(ContextConditions.class)
@ConditionalOnMissingBean
Context context() {
- return Pi4J.newAutoContext();
+ return pi4j;
}
}
diff --git a/pi4j-spring-boot/src/main/java/com/pi4j/spring/boot/Pi4jActuatorConfiguration.java b/pi4j-spring-boot/src/main/java/com/pi4j/spring/boot/Pi4jActuatorConfiguration.java
index 41b2e82..857717e 100644
--- a/pi4j-spring-boot/src/main/java/com/pi4j/spring/boot/Pi4jActuatorConfiguration.java
+++ b/pi4j-spring-boot/src/main/java/com/pi4j/spring/boot/Pi4jActuatorConfiguration.java
@@ -1,7 +1,7 @@
package com.pi4j.spring.boot;
-import com.pi4j.boardinfo.model.DetectedBoard;
-import com.pi4j.boardinfo.util.BoardModelDetection;
+import com.pi4j.boardinfo.model.BoardInfo;
+import com.pi4j.boardinfo.util.BoardInfoHelper;
import com.pi4j.context.Context;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -17,7 +17,7 @@
public class Pi4jActuatorConfiguration implements InfoContributor {
private final Context context;
- private final DetectedBoard detectedBoard;
+ private final BoardInfo boardInfo;
private final Logger logger = LoggerFactory.getLogger(Pi4jActuatorConfiguration.class);
/**
@@ -27,14 +27,33 @@ public class Pi4jActuatorConfiguration implements InfoContributor {
*/
public Pi4jActuatorConfiguration(Context context) {
this.context = context;
- this.detectedBoard = BoardModelDetection.getDetectedBoard();
+ this.boardInfo = BoardInfoHelper.current();
}
@Override
public void contribute(Builder builder) {
- builder.withDetail("os", detectedBoard.getOperatingSystem());
- builder.withDetail("board", detectedBoard.getBoardModel());
- builder.withDetail("java", detectedBoard.getJavaInfo());
+ var os = boardInfo.getOperatingSystem();
+ builder.withDetail("os.name", os.getName());
+ builder.withDetail("os.architecture", os.getArchitecture());
+ builder.withDetail("os.version", os.getVersion());
+ builder.withDetail("os.architecture", os.getArchitecture());
+ var boardModel = boardInfo.getBoardModel();
+ builder.withDetail("board.name", boardModel.getName());
+ builder.withDetail("board.description", boardModel.getLabel());
+ builder.withDetail("board.model.label", boardModel.getModel().getLabel());
+ builder.withDetail("board.cpu.label", boardModel.getCpu().getLabel());
+ builder.withDetail("board.soc", boardModel.getSoc().name());
+ var java = boardInfo.getJavaInfo();
+ builder.withDetail("java.version", java.getVersion());
+ builder.withDetail("java.runtime", java.getRuntime());
+ builder.withDetail("java.vendor", java.getVendor());
+ builder.withDetail("java.vendor.version", java.getVendorVersion());
+ var boardReading = BoardInfoHelper.getBoardReading();
+ builder.withDetail("reading.volt.value", boardReading.getVoltValue());
+ builder.withDetail("reading.temperature.celsius", boardReading.getTemperatureInCelsius());
+ builder.withDetail("reading.temperature.fahrenheit", boardReading.getTemperatureInFahrenheit());
+ builder.withDetail("reading.uptime", boardReading.getUptimeInfo());
+
try {
// TODO https://github.com/Pi4J/pi4j-springboot/issues/11
//builder.withDetail("pi4jPlatforms", context.platforms().all());
diff --git a/pom.xml b/pom.xml
index 3f1c530..048a56d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
org.springframework.boot
spring-boot-starter-parent
- 3.1.0
+ 3.2.5
@@ -19,9 +19,8 @@
17
- 3.1.0
- 2.3.0
- 0.2.0
+ 3.2.5
+ 2.6.0-SNAPSHOT
0.8.10
@@ -40,6 +39,20 @@
pi4j-spring-boot-starter-sample-app
+
+
+ oss-snapshots-repo
+ Sonatype OSS Maven Repository
+ https://oss.sonatype.org/content/groups/public
+
+ false
+
+
+ true
+
+
+
+
@@ -69,16 +82,14 @@
com.pi4j
- pi4j-plugin-mock
+ pi4j-plugin-gpiod
${pi4j.version}
- test
-
-
com.pi4j
- pi4j-board-info
- ${pi4j.boardinfo.version}
+ pi4j-plugin-mock
+ ${pi4j.version}
+ test