diff --git a/java/ChangeLog b/java/ChangeLog index 4a3da5b5ee..ac94da5157 100644 --- a/java/ChangeLog +++ b/java/ChangeLog @@ -1,3 +1,9 @@ +02/10/2024 Moritz Vieli + * v0.2.0 + - Add OlaClient.reloadPlugins() + - Add OlaClient.getPluginState() + - Add OlaClient.setPluginState() + 04/22/2017 Erez Makavy * v0.0.2 - Add OlaClient.getUniverseList() diff --git a/java/pom.xml b/java/pom.xml index 1ae5686e35..4a86bfc9e7 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -2,7 +2,7 @@ 4.0.0 ola ola-java-client - 0.1.0 + 0.2.0 Java implementation of OLA RPC UTF-8 @@ -36,8 +36,8 @@ maven-compiler-plugin 2.5.1 - 1.6 - 1.6 + 1.7 + 1.7 diff --git a/java/src/main/java/ola/OlaClient.java b/java/src/main/java/ola/OlaClient.java index 4f09a5af5e..e4a583cc50 100644 --- a/java/src/main/java/ola/OlaClient.java +++ b/java/src/main/java/ola/OlaClient.java @@ -18,6 +18,8 @@ import java.util.logging.Logger; +import ola.proto.Ola; +import ola.proto.Ola.Ack; import ola.proto.Ola.DeviceConfigReply; import ola.proto.Ola.DeviceConfigRequest; import ola.proto.Ola.DeviceInfoReply; @@ -30,10 +32,14 @@ import ola.proto.Ola.OptionalUniverseRequest; import ola.proto.Ola.PatchAction; import ola.proto.Ola.PatchPortRequest; +import ola.proto.Ola.PluginReloadRequest; import ola.proto.Ola.PluginDescriptionReply; import ola.proto.Ola.PluginDescriptionRequest; import ola.proto.Ola.PluginListReply; import ola.proto.Ola.PluginListRequest; +import ola.proto.Ola.PluginStateRequest; +import ola.proto.Ola.PluginStateReply; +import ola.proto.Ola.PluginStateChangeRequest; import ola.proto.Ola.PortPriorityRequest; import ola.proto.Ola.RDMRequest; import ola.proto.Ola.RDMResponse; @@ -114,14 +120,23 @@ public PluginListReply getPlugins() { } + /** + * Reload the plugins. + * + * @return true when succeeded. + */ + public boolean reloadPlugins() { + return callRpcMethod("ReloadPlugins", PluginReloadRequest.newBuilder().build()) != null; + } + + /** * Get a plugin description from olad. * * @param pluginId number of the plugin for which to receive the description - * @return The list of plugings. + * @return The description of the plugin. */ public PluginDescriptionReply getPluginDescription(int pluginId) { - PluginDescriptionRequest request = PluginDescriptionRequest.newBuilder() .setPluginId(pluginId) .build(); @@ -130,6 +145,38 @@ public PluginDescriptionReply getPluginDescription(int pluginId) { } + /** + * Return the state of a plugin. + * + * @param pluginId number of the plugin to fetch the state of + * @return The state of the plugin. + */ + public PluginStateReply getPluginState(int pluginId) { + PluginStateRequest request = Ola.PluginStateRequest.newBuilder() + .setPluginId(pluginId) + .build(); + + return (PluginStateReply) callRpcMethod("GetPluginState", request); + } + + + /** + * Set the state of a plugin. + * + * @param pluginId number of the plugin for which to change the state + * @param enabled whether the plugin should be enabled or not + * @return true when succeeded. + */ + public boolean setPluginState(int pluginId, boolean enabled) { + PluginStateChangeRequest request = Ola.PluginStateChangeRequest.newBuilder() + .setPluginId(pluginId) + .setEnabled(enabled) + .build(); + + return callRpcMethod("SetPluginState", request) != null; + } + + /** * Get device info from olad. *