-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added plugin-related functions to the Java client #1979
base: master
Are you sure you want to change the base?
Conversation
- Add OlaClient.reloadPlugins() - Add OlaClient.getPluginState() - Add OlaClient.setPluginState() - Changed evaluation of PROTOBUF_VERSION, because pkg-config adds trailing ".0" to the version, which is not compatible with the available Java dependencies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @moritzvieli .
I don't know whether you want to split this in two, as apart from some minor styling, the client changes are ready to go, whereas the Protobuf Java versioning may need a bit more testing and thought.
It would also be good to add some tests too please:
https://github.com/OpenLightingProject/ola/blob/master/java/src/test/java/ola/OlaClientTest.java
<version>0.1.0</version> | ||
<version>0.0.3</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should never go backwards in our versions, even if I failed to update the separate Java changelog last time around.
I think this should be 0.2.0 given:
MINOR version when you add functionality in a backward compatible manner
@@ -1,3 +1,9 @@ | |||
02/10/2024 Moritz Vieli <[email protected]> | |||
* v0.0.23 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you mean v0.0.3 in your versioning, but as mentioned this should be >0.1.0, I believe 0.2.0.
<source>1.6</source> | ||
<target>1.6</target> | ||
<source>1.7</source> | ||
<target>1.7</target> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this just because 1.6 is out of support?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm less keen on all the whitespace changes (particularly alignment within Javadoc) given we don't currently have a linting scheme and the risk of someone else's future edits just conflicting with what you've done.
|
||
|
||
/** | ||
* Change the state of plugins. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Change the state of plugins. | |
* Set the state of a plugin. |
.setEnabled(enabled) | ||
.build(); | ||
|
||
return (Ack) callRpcMethod("SetPluginState", request); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the behaviour of patchPort is more useful:
ola/java/src/main/java/ola/OlaClient.java
Line 240 in c4adb50
* @return true when succeeded. |
ola/java/src/main/java/ola/OlaClient.java
Line 252 in c4adb50
return callRpcMethod("PatchPort", patchRequest) != null; |
@@ -130,6 +142,38 @@ public PluginDescriptionReply getPluginDescription(int pluginId) { | |||
} | |||
|
|||
|
|||
/** | |||
* Return the state for a plugin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be:
* Return the state for a plugin. | |
* Return the state of a plugin. |
* Return the state for a plugin. | ||
* | ||
* @param pluginId number of the plugin for which to receive the state | ||
* @return The list of plugings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @return The list of plugings. | |
* @return The state of the plugin. |
/** | ||
* Return the state for a plugin. | ||
* | ||
* @param pluginId number of the plugin for which to receive the state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param pluginId number of the plugin for which to receive the state | |
* @param pluginId number of the plugin to fetch the state of |
PROTOBUF_VERSION=`pkg-config --modversion protobuf`; | ||
PROTOBUF_VERSION=`protoc --version | awk '{print [$]2}'`; | ||
AC_MSG_NOTICE([PROTOBUF VERSION $PROTOBUF_VERSION]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not hugely keen on adding another means of processing into the mix and we've already got a load of Protobuf versioning stuff in via d4414fe so hopefully we can just reuse some of that to make a Java version that's compatible.
The last change needs to be checked carefully. I tried building it on a Mac and it failed with the pkg-config version, because of the trailing ".0". Using "protoc --version" works, but might introduce other issues.