Allow the pi to be shutdown from the app via bluetooth.

This commit is contained in:
MarkBryanMilligan 2021-03-06 20:20:55 -06:00
parent a43222049d
commit 2a5674b736
3 changed files with 11 additions and 2 deletions

View File

@ -3,7 +3,7 @@
<groupId>com.lanternsoftware.currentmonitor</groupId>
<artifactId>lantern-currentmonitor</artifactId>
<packaging>jar</packaging>
<version>1.0.1</version>
<version>1.0.2</version>
<name>lantern-currentmonitor</name>
<properties>

View File

@ -154,6 +154,14 @@ public class MonitorApp {
LOG.error("Exception occurred while trying to reboot", _e);
}
break;
case Shutdown:
LOG.info("Shutting down Pi...");
try {
Runtime.getRuntime().exec(new String[]{"shutdown","now"});
} catch (IOException _e) {
LOG.error("Exception occurred while trying to shutdown", _e);
}
break;
}
}
});

View File

@ -17,7 +17,8 @@ public enum HubConfigCharacteristic {
Flash(9, CharacteristicFlag.WRITE),
Host(10, CharacteristicFlag.WRITE),
Log(11, CharacteristicFlag.READ),
NetworkDetails(12, CharacteristicFlag.READ);
NetworkDetails(12, CharacteristicFlag.READ),
Shutdown(13, CharacteristicFlag.WRITE);
public final int idx;
public final UUID uuid;