diff --git a/pi4j-spring-boot-starter-sample-app/src/main/java/com/pi4j/spring/boot/sample/app/service/Pi4JService.java b/pi4j-spring-boot-starter-sample-app/src/main/java/com/pi4j/spring/boot/sample/app/service/Pi4JService.java index 4853575..f595857 100644 --- a/pi4j-spring-boot-starter-sample-app/src/main/java/com/pi4j/spring/boot/sample/app/service/Pi4JService.java +++ b/pi4j-spring-boot-starter-sample-app/src/main/java/com/pi4j/spring/boot/sample/app/service/Pi4JService.java @@ -6,10 +6,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.actuate.info.Info; +import org.springframework.boot.actuate.info.InfoContributor; import org.springframework.stereotype.Service; @Service -public class Pi4JService { +public class Pi4JService implements InfoContributor { private static final Logger logger = LoggerFactory.getLogger(Pi4JService.class); private static final int PIN_LED = 22; // PIN 15 = BCM 22 @@ -51,6 +53,12 @@ public Pi4JService(@Autowired Context pi4j) { } } + @Override + public void contribute(Info.Builder builder) { + builder.withDetail("pi4j.status.led", led.state()); + builder.withDetail("pi4j.status.button", button.state()); + } + private void handleButtonChange(DigitalStateChangeEvent e) { logger.info("Button state changed to {}", e.state()); }