-
-
Notifications
You must be signed in to change notification settings - Fork 412
Implement tracking commands in libnutclient #673
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
Implement tracking commands in libnutclient #673
Conversation
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.
Beside from my comments, I'd like to see evidences that you tested the following:
- older upsd with TRACKING feature not available
- newer upsd with TRACKING feature enabled / not enabled
Documentation:
- docs/man/nutclient* needs update
- It could be good to also complete a bit the code example in docs/new-clients.txt -> High level library: libnutclient, to also illustrate the use of the new async / tracking methods.
thx
clients/nutclient.cpp
Outdated
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.
As per https://github.com/networkupstools/nut/blob/master/docs/net-protocol.txt#L209
Result can also be:
- ERR UNKNOWN (command execution failed with unknown error)
- ERR INVALID-ARGUMENT (command execution failed due to missing or invalid argument)
beside from the ERR FAILED (command execution failed)
clients/nutclient.h
Outdated
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.
not sure what you wanna mean by "redeem", but should be reworded.
Also async ID is to be worded "tracking ID", as elsewhere.
|
part of #656 |
|
Updated pull request, tested with sample program on both old and new upsd with no issues. |
aa361e2 to
67b2305
Compare
Signed-off-by: Jean-Baptiste Boric <Jean-BaptisteBORIC@Eaton.com>
67b2305 to
9b0a799
Compare
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.
Please also handle "ERR INVALID-ARGUMENT (command execution failed due to missing or invalid argument)" beside from the generic Failure on "ERR FAILED"
Once fixed, I'll be able to merge.
Signed-off-by: Jean-Baptiste Boric <Jean-BaptisteBORIC@Eaton.com>
| using namespace std; | ||
|
|
||
| int main(int argc, char** argv) | ||
| int main(int argc, char **argv) |
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.
@boricj nitpicking somehow, but:
a comment here in the code would be helpful to depict that
// argv[1] is the mandatory NUT device name (@localhost), used to list variables from
// argv[2] is an optional command. When provided, it will be executed and possibly with status tracking enabled
I'll merge the PR and do it myself to avoid another 1d delay, so FYI and for future PR ;)
* Implement tracking commands in libnutclient Signed-off-by: Jean-Baptiste Boric <Jean-BaptisteBORIC@Eaton.com> * Add TrackingResult::INVALID_ARGUMENT Signed-off-by: Jean-Baptiste Boric <Jean-BaptisteBORIC@Eaton.com>
Extends libnutclient's C++ API to support tracking commands.